ros之串口通信---imu
1、sudo apt-get install ros-kinetic-rosserial
或者sudo git clonegit://github.com/wjwwood/serial.git (开发板上)
2、步骤:
$ mkdir -p imu_ws/src
$ cd imu_ws/src
$ sudo git clone git://github.com/wjwwood/serial.git
$ cd .. catkin_make
3、添加开发包
$ cd imu_ws/src
$ catkin_create_pkg imu std_msgs rospy roscpp serial
更改CMakeList.txt文件,添加如下两行:
add_executable(${PROJECT_NAME}_node src/serialPort.cpp)
add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}_node
${catkin_LIBRARIES}
)
$ catkin_make