ROS Arduino HelloWorld例程的一些问题
来源:互联网 发布:sql查询学生总成绩 编辑:程序博客网 时间:2024/05/17 21:53
我使用的是Arduino Due, 板子插上后, 打开Arduino IDE, 提示需要安装Arduino Due的Library, 安装就可以了.
安装ros_lib到Arduino开发环境:
# cd <sketchbook>/libraries cd '/home/dq/Arduino/libraries' rm -rf ros_lib rosrun rosserial_arduino make_libraries.py .
串口连接是需要许可的, 不然不能下载程序, 方法参考 Serial port permissions :
As normal user from terminal: ls -l /dev/ttyUSB*
or ls -l /dev/ttyACM*
You will get something like crw-rw---- 1 root uucp 188, 0 5 apr 23.01 ttyUSB0
or crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyACM0
The “0” might be a different number, or multiple entries might be returned. In the first case the data we need is uucp, in the second dialout. (this is the group owner of the file)
Now we just need to add our user to the group: usermod -a -G group-name username
group-name is the data found before, and username is your Linux user name. You will need to log out and in again for this change to take effect.
我的是ttyACM0, 所以 sudo usermod -a -G dialout wf
就可以了(wf是我的用户名), 注销然后重新登录.
Arduino ROS HelloWorld的代码:
#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);}
这个不行的, 按照步骤走下去会报错:
Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino
参考 rosserial arduino can’t connect 中的方法: 在 #include <ros.h>
前面加上 #define USE_USBCON
才可以.
工具中选择 开发板为Arduino Due, 端口选ttyACM0, 下载到Arduino板中. 三个终端分别输入下面3条命令:
roscore rosrun rosserial_python serial_node.py /dev/ttyACM0 rostopic echo chatter
这样就好了:
- ROS Arduino HelloWorld例程的一些问题
- ROS在ARDUINO的应用
- 使用ROS遇到的一些小问题
- ros中遇到的一些小问题
- 关于ROS环境搭建的一些问题
- Arduino--Helloworld!
- ROS一些问题
- 使用rosserial把Arduino作为ROS一个Node遇到的一个问题
- arduino中断和一些问题
- 关于Arduino Mega 2560串口的一些蛋疼问题
- ROS下Arduino Leonardo报版本错误问题
- ROS Learning-016 Arduino-For-ROS-001 搭建 Arduino 和 ROS 之间相连接的开发环境
- KinectV2在ROS下使用的一些问题(iai_kinect2)
- 在学习ROS过程中碰到的一些问题--1
- arduino 创始人的一些话
- arduino的一些初级函数
- ROS+PI+ARDUINO
- ROS arduino JY901
- 查缺补漏--性能资源
- CodeForces
- 图 广度优先与深度优先搜索
- 将博客搬至CSDN
- Python标准异常总结
- ROS Arduino HelloWorld例程的一些问题
- android-[译]掌握CoordinatorLayout
- linux线程浅析
- php中get_headers函数的作用和用法
- 20170413面试
- 【Shader Forge】Refraction实现折射效果的研究
- Java多线程编程核心技术之---停止线程
- Android Studio中的同一个工程下复制一份module而不改变原来的demo?
- 简学javaScript技术