Hi
I started playing around with an Arduino Uno and rosserial. I am trying to control 2 stepper motors (really a motor controller via pulse/dir signal, using the AccelStepper library), a PWM signal, and few infrequent IOs. The pulse generation is a bit intensive because I need to generate a fairly large number of steps per seconds (about 1000 steps per seconds per motor).
I tested it, motor by motor and it seems to be alright. However, when I connect the arduino to the joystick (via ROS / rosserial python_node), it sends quite a large number of messages (I counted up to 160 messages per seconds). The motor start spinning when I touch the joystick, but after a while the arduino seems to hang.
My guess is that I am sending to many messages, thus stalling the communication channel and overloading the arduino with message decoding. Could this be?
Based on this assumption, I started to write a filter: on the PC side, a node receives the messages destined to the Arduino (i.e. set the position of motor 1 to x), and only send the latest commands, aggregated in one message, every xx ms (currently 25 ms). This will definitely reduce the amount of communication on the serial line and the amount of decoding on the arduino's side, but as a drawback, it will reduce the responsiveness of my hardware: motors will be updated less frequently (I think it should be OK for my application though).
I will try to report whether this is a successful strategy. Right now I am having a problem with rosserial and custom messages...
Originally posted by brice rebsamen on ROS Answers with karma: 1001 on 2011-08-25
Post score: 1
Original comments
Comment by brice rebsamen on 2011-08-31:
So it turned out that limiting the amount of messages transferred solved the problem. First of all, too many messages don't add anything, as my hardware cannot respond that fast anyway. I decided to write a filter node that only transmits the latest commands in an aggregated msg at a fixed rate.