using rosserial_arduino on Gumstix overo

1k views Asked by At

I am new to Gumstix and ROS. And I would like to connect the Gumstix to Arduino (ATMega2560) using rosserial. I have two paths between Gumstix and Arduino. One(/dev/ttyO0 in Gumstix) is a connection in circuit board and the other(/dev/ttyACM3 in Gumstix) is a connection using a USB A to B cable.

As a test, I tried to run this example: http://wiki.ros.org/rosserial_arduino/Tutorials/Hello%20World

In the case of /dev/ttyACM3, I can ran following command successfully:

root@overo:~$ rosrun rosserial_python serial_node.py _port:=/dev/ttyACM3
[INFO] [WallTime: 946697855.203704] ROS Serial Python Node
[INFO] [WallTime: 946697855.330657] Connecting to /dev/ttyACM3 at 57600 baud
[INFO] [WallTime: 946697864.251922] Note: publish buffer size is 512 bytes
[INFO] [WallTime: 946697864.260375] Setup publisher on chatter [std_msgs/String] 

but in the circuit link of /dev/ttyO0, I cannot:

root@overo:~$ rosrun rosserial_python serial_node.py _port:=/dev/ttyO0 
[INFO] [WallTime: 946697911.536193] ROS Serial Python Node
[INFO] [WallTime: 946697911.662841] Connecting to /dev/ttyO0 at 57600 baud
[ERROR] [WallTime: 946697928.814331] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

What is ttyO device? Is it different ttyUSB or ttyACM? Why I cannot run rosserial_python on the port of /dev/ttyO0?

I also checked that the port of /dev/ttyO0 is working well using echo test between Gumstix and Arduino.

Regards,

Kim


This is a configuration of both serial ports after running rosserial_python. They are same.

root@overo:~$ stty -F /dev/ttyACM3
speed 57600 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
root@overo:~$ stty -F /dev/ttyO0
speed 57600 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
2

There are 2 answers

0
Youngmin Kim On BEST ANSWER

Self answer.

My /dev/ttyO0 port is connected to the Serial1 port on Arduino. So I have to change Serial to Serial1 on ros_lib/ArduinoHardware.h.

class ArduinoHardware {
  public:
    ArduinoHardware(SERIAL_CLASS* io , long baud= 57600){
      iostream = io;
      baud_ = baud;
    }
    ArduinoHardware()
    {
#if defined(USBCON) and !(defined(USE_USBCON))
      /* Leonardo support */
      iostream = &Serial1;
#else
      iostream = &Serial1; // <=========== HERE
#endif
      baud_ = 57600;
    }
0
Void On

In addition to the correct versions, you need to have #include <ros.h> at the top of the code, ros::NodeHandle nh; declared as a global, nh.initNode(); and Serial.begin(115200); within void setup(), and nh.spinOnce(); within void loop().