0

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
4

2 回答 2

1

除了正确的版本之外,您还需要#include <ros.h>在代码顶部ros::NodeHandle nh;声明为全局、withinnh.initNode();和within 。Serial.begin(115200);void setup()nh.spinOnce();void loop()

于 2016-11-23T21:34:20.047 回答
0

自答。

我的 /dev/ttyO0 端口连接到 Arduino 上的 Serial1 端口。所以我必须在 ros_lib/ArduinoHardware.h 上将 Serial 更改为 Serial1。

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;
    }
于 2014-12-08T01:03:59.490 回答