1.创建工作环境
mkdir gazebo_ws
在 gazebo_ws 文件夹下下载 gazebo_rviz_learn文件夹,将文件夹名称改为src . 拥有了src文件夹,就初步具备了工作环境
在 gazebo_ws 文件夹目录下打开终端
catkin_make 工程制作
2.开始控制(在gazebo_ws目录下运行指令)
学习1:各个模块的定义连接组合
roslaunch urdf_rviz t4_xacro.launch
学习2:移动
roslaunch urdf_rviz t5_arbotix.launch
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.2, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.5}}' (新建终端)
学习3:gazebo和rviz联动
roslaunch urdf_gazebo t7_gazebo.launch
roslaunch urdf_gazebo t7_rviz.launch (新建终端)
rosrun teleop_twist_keyboard teleop_twist_keyboard.py (新建终端)
学习4:gazebo和rviz建图
roslaunch urdf_gazebo t7_gazebo.launch
roslaunch urdf_gazebo t1_slam.launch (新建终端)
rosrun teleop_twist_keyboard teleop_twist_keyboard.py (新建终端)
学习5:amcl定位
roslaunch urdf_gazebo t7_gazebo.launch
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
roslaunch urdf_gazebo t5_amcl_test.launch
学习6:导航移动
roslaunch urdf_gazebo t7_gazebo.launch
roslaunch nav_demo t7_346.launch
3.rviz操作步骤
在rviz中点击左下角的add按钮:
- Add--by topic--Map
- Add--by topic--Laser Scan laser scan中把size参数调高,就能显示出小车雷达监测出的红色的障碍物
- Add--by name--RobotModel