我是刚认识Gumstix和ROS的。我想用rosserial连接Gumstix到Arduino (ATMega2560)。我在Gumstix和Arduino之间有两条路。一个(Gumstix中的/dev/ttyO0)是电路板中的连接,另一个(Gumstix中的/dev/ttyACM3)是使用USB A到B电缆的连接。
作为一个测试,我尝试运行这个示例:arduino/Tutorials/Hello%20World
在/dev/ttyACM3的情况下,我可以成功地运行以下命令:
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] 但是,在/dev/ttyO0的电路链接中,我不能:
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什么是ttyO设备?它是不同的ttyUSB还是ttyACM?为什么不能在/dev/ttyO0端口上运行rosserial_python?
我还检查了/dev/ttyO0 0的端口是否运行良好,使用了Gumstix和Arduino之间的echo测试。
致以敬意,
金姆
这是运行rosserial_python后两个串口的配置。他们是一样的。
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发布于 2014-12-08 01:03:59
自我回答。
我的/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;
}发布于 2016-11-23 21:34:20
除了正确的版本之外,您还需要将#include <ros.h>放在代码的顶部,ros::NodeHandle nh;声明为全局版本,nh.initNode();和Serial.begin(115200);在void setup()中,nh.spinOnce();在void loop()中。
https://stackoverflow.com/questions/27312137
复制相似问题