树莓派ROS机器人
ROS机器人总结笔记
ifconfig Linux查看IP
ipconfig Windows查看IP
连接树莓派
ssh [email protected]地址
修改IP地址
如若更换IP,必须修改
sudo gedit ~/.bashrc // 修改IP地址一致
source ~/.bashrc
开启底盘节点
[email protected]:~roslaunch clbrobot bringup.launch
校准IMU
重新打开控制台连接树莓派
- roscd clbrobot/
-
[email protected]:~/catkin_ws/src/clbrobot_project/clbrobot$ cd param/imu
//校准X,Y,Z方向 - [email protected]:~/catkin_ws/src/clbrobot_project/clbrobot/param/imu$ rosrun imu_calib do_calib
- rostopic echo /imu/data
调用键盘:
指令
I 前进
J 左转
L 右转
M 左后退
< 后退
> 右后退
U 左前
O 右前
C 角速度
X 线速度
1.连接树莓派 ssh [email protected]地址
2.开启底盘节点: [email protected]:~roslaunch clbrobot bringup.launch
3.新开终端,并连接树莓派
[email protected]:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
角速度校正
1.连接树莓派 ssh [email protected]地址
2.启动底盘节点:[email protected]:~roslaunch clbrobot bringup.launch
3.新开终端,连接树莓派,启动底盘节点
[email protected]:~$ rosrun rikirobot_nav calibrate_angular.py
5,新开终端
[email protected]:~$ rosrun rqt_reconfigure rqt_reconfigure
鼠标构建地图
1.连接树莓派
2.启动底盘节点
3.新建终端,连接树莓派
4.开启雷达 [email protected]:~$ roslaunch clbrobot lidar_slam.launch
5.新建终端 rosrun rviz rviz
6.选择slam.rviz文件open
7.调用键盘控制小车移动[email protected]:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
保存地图
1.连接树莓派
2.打开[email protected]:~$ roscd clbrobot/
[email protected]:~/catkin_ws/src/clbrobot_project/clbrobot$ cd maps
[email protected]:~/catkin_ws/src/clbrobot_project/clbrobot/maps$ ./map.sh
自动导航与自动避障
1.连接树莓派
2.启动底盘
3.创建新终端,连接树莓派
[email protected]:~$ roslaunch clbrobot navigate.launch
5.新终端输入 [email protected]:~$ rosrun rviz rviz
6.打开navigate.rviz
使用Hector算法构建地图(会有重影,不适合障碍物多的地方)
1.连接树莓派
2.开启底盘
3.新建终端,连接树莓派
[email protected]:~$ roslaunch clbrobot hector_slam.launch
5.新建终端,rosrun rviz rviz
6.选择slam.rviz
7.调用键盘操控小车
[email protected]:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
>动态调节PID参数
1.连接树莓派
2.启动底盘
3.新建终端,连接树莓派
[email protected]:~$ rosrun riki_pid pid_configure
5.新开终端:[email protected]:~$ rosrun rqt_reconfigure rqt_reconfigure
6.新开终端,开启键盘:[email protected]:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
摄像头寻线 与雷达跟随
1.连接树莓派
2.启动底盘
3.新建终端,连接树莓派
[email protected]:~$ roslaunch clbrobot camera.launch
5.摄像头寻线:
新建终端:[email protected]:~$ roslaunch riki_line_follower riki_line.launch
5.雷达跟随:
新建终端:连接树莓派
[email protected]:~$ roslaunch riki_lidar_follower laser_follower.launch
多点导航
1.连接树莓派
2.启动底盘
3.新建终端,连接树莓派
4.多点导航[email protected]:~$ roslaunch clbrobot navigate_multi.launch
5.新建终端, rosrun rviz rviz
会提示报错,这个不用管(个别电脑会导致虚拟机崩溃掉,建议换台电脑):
APP连接
1.连接树莓派
2.启动底盘
3.新建终端,连接树莓派
[email protected]:~$ roslaunch clbrobot appcamera.launch
打开树莓派自带APP,输入IP地址,点击connnect
(自带的树莓派我打开APP会崩溃,我在网上找的博客下载的)
opencv_apps图像事例
1.连接树莓派
2.开启摄像头:[email protected]:~$ roslaunch clbrobot camera.launch
3.新建终端:
4.边缘提取:
[email protected]:~$ roslaunch opencv_apps edge_detection.launch
4,直线检测:
[email protected]:~$ roslaunch opencv_apps hough_lines.launch
4.结构特征轮廓
[email protected]:~$ roslaunch opencv_apps find_contours.launch
4.凸高检测
[email protected]:~$ roslaunch opencv_apps convex_hull.launch
4.椭圆形轮廓识别
[email protected]:~$ roslaunch opencv_apps general_contours.launch
4.身高识别
[email protected]:~$ roslaunch opencv_apps people_detect.launch
这只是举例,还有很多,大家多多尝试吧!
APP建图
1.连接树莓派
2.连接底盘
3.新建树莓派,连接树莓派
4.启动雷达:[email protected]:~$ roslaunch clbrobot lidar_slam.launch
5.新建树莓派,连接树莓派
6.启动摄像头[email protected]:~$ roslaunch clbrobot camera.launch
7.打开树莓派自带APP,输入IP地址连接