如果沒有使用過串口,請先安裝minicom赌渣,參考百度經(jīng)驗(yàn):
https://jingyan.baidu.com/article/6b182309f9dd6dba59e1597a.html
依次執(zhí)行以下命令:
sudo apt-get install ros-kinetic-serial #安裝serial,根據(jù)系統(tǒng)版本修改
cd ~catkin_ws/src/
git clone https://github.com/ccny-ros-pkg/imu_tools.git
rosdep install imu_tools #安裝依賴
git clone https://github.com/fsteinhardt/mpu6050_serial_to_imu.git
cd ~catkin_ws/
catkin_make
注意:根據(jù)自己的設(shè)備修改串口波特率,以及ubuntu下的串口端口號救崔,打開mpu6050_serial_to_imu/launch目錄下的demo.launch文件將端口修改為系統(tǒng)現(xiàn)有的串口戈轿,如:/dev/ttyUSB0,如果提示串口打不開,需要修改一下權(quán)限:
sudo chmod 777 /dev/ttyUSB0
最后測試運(yùn)行:
roscore
roslaunch mpu6050_serial_to_imu demo.launch