rosserial baud rate not being set
I am trying to use rosserial with an Arduino Uno (ROS Indigo & ubuntu 14.04) to control a Kangaroo motor controller from Dimension Engineering. I am publishing a twist message which the Arduino subscribes to. Things are working at 57600 baud except that over half of the commands are not making it through, and after roughly 10 seconds it looses sync.
Now I'm trying to lower the baud rate to 9600. In my arduino code I have:
#define TX_Pin 10
#define RX_Pin 9
SoftwareSerial SerialPort(RX_PIN, TX_PIN);
KangarooSerial K(SerialPort);
KangarooChannel Drive(K, 'D');
KangarooChannel Turn(K, 'T');
ros::NodeHandle nh;
ros::Subscriber<geometry_msgs::Twist> sub("move", &move_cb);
void setup()
{
nh. initNode();
nh.getHardware()->setBaud(9600);
nh.subscribe(sub);
SerialPort.begin(9600);
SerialPort.listen();
}
And in my launch file I put:
<node pkg="rosserial_python" type="serial_node.py" name="serial_node" output="screnn">
<param name="port" value="/dev/ttyACM0" />
<param name ="baud" value="9600" />
</node>
The Arduino then fails to sync, but if I change the launch file to
<node pkg="rosserial_python" type="serial_node.py" name="serial_node" output="screnn">
<param name="port" value="/dev/ttyACM0" />
<param name ="baud" value="57600" />
</node>
Then i connect, which tells me that the baud rate of the Arduino is not being set properly. Does anyone know how to properly set the baud rate?
UPDATE:
I have since abandoned using ROSSERIAL and instead am using an FTDI cable which I highly recommend. A lot of sensors have packages already made for them to communicate over serial, and those that don't you can use pyserial which is very easy to setup :) This eliminates the need for a unnecessary Arduino, saving money and debugging time.