How to debug rosserial-arduino?
Dear sir, I use arduino yun and build rosserial-arduino example helloworld, when I complier and upload the code, it show warning: Sketch uses 11,968 bytes (41%) of program storage space. Maximum is 28,672 bytes. Global variables use 1,948 bytes (76%) of dynamic memory, leaving 612 bytes for local variables. Maximum is 2,560 bytes. Low memory available, stability problems may occur. Could this cause problem? How to reduce size? Helloword is simple: #include <ros.h> #include <std_msgs string.h="">
ros::NodeHandle nh;
std_msgs::String str_msg; ros::Publisher chatter("chatter", &str_msg);
char hello[13] = "hello world!";
void setup()
{
nh.initNode();
nh.advertise(chatter);
}
void loop() { str_msg.data = hello; chatter.publish( &str_msg ); nh.spinOnce(); delay(1000); }
The communication errors: john@uDocker:~$ rosrun rosserial_python serial_node.py _port:=/dev/ttyACM1 [INFO] [WallTime: 1461906854.574293] ROS Serial Python Node [INFO] [WallTime: 1461906854.580512] Connecting to /dev/ttyACM1 at 57600 baud [ERROR] [WallTime: 1461906871.685965] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino
I had follow http://wiki.ros.org/rosserial_arduino... and then follow http://answers.ros.org/question/19620... to get indigo source code, but the errors are the same.
Could somebody show me how to debug this? 1. how to low the serial baud from 57600 to a low rate to make the link stable 2. How to check my rosserial_python version and my Arduino version, such as "link software version mismatch such as hydro rosserial_python with groovy Arduino"
Thanks John
Are you sure you have the correct permissions to your Arduino? Also, are you running at the same baud rate on the Arduino? There's likely a mismatch in baud rates between the serial node and the Arduino
Thank Alee, I think the baud rate is control by rosserial. I had add code set the serial port board in setting up. but the result is same.
Both can control baud. There's a baud rate on the arduino side and a baud rate on rosserial's side. Both need to match to communicate
Could you tell me the detail? From the sample code, this is hidden. If I want to reduce it, what should I do? Thanks
nh.getHardware()->setBaud(//some baud rate);
Make sure this value matches what you set for serial node.
Dear alee, it still does not work, even I drop both to 9600. I follow in http://wiki.ros.org/rosserial_arduino... I had done both 3.1.1 and 3.1.2, the only mistake is git clone which somebody see should use indigo, I had redo it but don't know how to clean old one,
What distro of ROS are you on? If you ran make_libraries with the wrong version of ROS, it might cause issues.
Thank alee, john@uDocker:~$ env | grep ROS ROS_ROOT=/opt/ros/indigo/share/ros ROS_PACKAGE_PATH=/opt/ros/indigo/share:/opt/ros/indigo/stacks ROS_MASTER_URI=http://localhost:11311 ROSLISP_PACKAGE_DIRECTORIES= ROS_DISTRO=indigo ROS_ETC_DIR=/opt/ros/indigo/etc/ros It is right.