使用gazebo仿真环境进行SLAM建图和导航实验

建图导航相关包安装方法:

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的模型

 git clone https://gitee.com/bingda-robot/gazebo_models.git

克隆完,在主目录因为是隐藏文件所以看不到,所以需要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

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值