建图导航相关包安装方法:
cd ~/catkin_ws/src/
git clone https://gitee.com/bingda-robot/robot_navigation.git
cd ~/catkin_ws/
catkin_make
sudo apt-get install ros-$ROS_DISTRO-amcl ros-$ROS_DISTRO-move-base ros-$ROS_DISTRO-slam-gmapping ros-$ROS_DISTRO-slam-karto ros-$ROS_DISTRO-cartographer ros-$ROS_DISTRO-cartographer-ros ros-$ROS_DISTRO-dwa-local-planner ros-$ROS_DISTRO-teb-local-planner ros-$ROS_DISTRO-map-server ros-$ROS_DISTRO-hector-slam*
echo "export BASE_TYPE=NanoRobot" >> ~/.bashrc
在.bashrc里添加source /home/hl/catkin_ws/devel/setup.bash
source ~/.bashrc
git clone https://gitee.com/bingda-robot/bingda_tutorials.git
sudo apt install ros-$ROS_DISTRO-gazebo-ros ros-$ROS_DISTRO-gazebo-ros-control ros-$ROS_DISTRO-gazebo-plugins ros-$ROS_DISTRO-joint-state-publisher ros-$ROS_DISTRO-joint-state-publisher-gui ros-$ROS_DISTRO-robot-state-publisher
打开gazebo在终端输入
gazebo
下载gazebo的模型
克隆完,在主目录因为是隐藏文件所以看不到,所以需要ctrl+h
.gazebo文件夹,将下载的gazebo_models改名models到这个文件夹里
之后打开gazebo
gazebo
在insert里可以选择add path选择路径
edit里选择building editor
编辑自己的世界然后保存在主目录下house文件夹
file 里save world as保存在主目录为room.world
环境的模型好了
接下来准备机器人的模型
urdf
roscd bingda_tutorials/urdf/
check_urdf mybot.urdf
roslaunch bingda_tutorials display_robot.launch
roslaunch bingda_tutorials simulation_robot.launch
rqt_image_view
安装控制节点
sudo apt install ros-$ROS_DISTRO-teleop-twist-keyboard
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
roslaunch bingda_tutorials simulation_robot.launch
roslaunch robot_navigation gmapping.launch simulation:=true
roslaunch robot_navigation slam_rviz.launch
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
roscd robot_navigation/maps/
rosrun map_server map_saver -f map
保存地图
重开
roslaunch bingda_tutorials simulation_robot.launch
roslaunch robot_navigation navigation_stack.launch simulation:=true
roslaunch robot_navigation navigation_rviz.launch
如果启动gazebo后,关闭再启动出现如下错误
note:如果启动是出现gazebo-1 process has died [pid 10999,exit code 255]
是因为关闭的过程中有些程序没有完全关闭,
可以用指令关闭程序
killall gzserver