Search code examples
rosgumstix

using rosserial_arduino on Gumstix overo


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

Solution

  • 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;
        }