网站制作和app制作,快应用 小程序,四合一小说网站搭建教程,建设一个网站多少钱双系统ubuntu20.04(neotic版本)从0实现Gazebo仿真slam建图 
昨晚完成了ROS的多机通讯#xff0c;还没来得及整理相关操作步骤#xff0c;在进行实际小车的实验之前#xff0c;还是先打算在仿真环境中进行测试#xff0c;熟悉相关的操作步骤#xff0c;计划通过虚拟机…双系统ubuntu20.04(neotic版本)从0实现Gazebo仿真slam建图 
昨晚完成了ROS的多机通讯还没来得及整理相关操作步骤在进行实际小车的实验之前还是先打算在仿真环境中进行测试熟悉相关的操作步骤计划通过虚拟机笔记本来操纵双系统台式机完成在仿真环境中的地图构建导航等功能。 ps:别问为什么不直接通过向日葵远程操控后面要进行实际环境中多机器人编队的测试多机器人编队功能已经被写好了但是需要安装在远程PC的工作空间中进行多机器人的控制 1、安装ROSneotic版本依赖 sudo apt-get install ros-noetic-joy ros-noetic-teleop-twist-joy \ros-noetic-teleop-twist-keyboard ros-noetic-laser-proc \ros-noetic-rgbd-launch ros-noetic-rosserial-arduino \ros-noetic-rosserial-python ros-noetic-rosserial-client \ros-noetic-rosserial-msgs ros-noetic-amcl ros-noetic-map-server \ros-noetic-move-base ros-noetic-urdf ros-noetic-xacro \ros-noetic-compressed-image-transport ros-noetic-rqt* ros-noetic-rviz \ros-noetic-gmapping ros-noetic-navigation ros-noetic-interactive-markersROS1和ROS2其他版本安装相关依赖参考网址ROS1ROS2依赖包注意☝的是一行指令分行输入会报错的。 
2、安装turtlebot3软件包 Install TurtleBot3 via Debian Packages. sudo apt install ros-noetic-dynamixel-sdksudo apt install ros-noetic-turtlebot3-msgssudo apt install ros-noetic-turtlebot33、设置环境变量 source ~/.bashrc4、创建工作空间安装TB3功能包 
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
git clone -b noetic-devel http://ghproxy.com/https://github.com/ROBOTIS-GIT/DynamixelSDK.git
git clone -b noetic-devel http://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone -b noetic-devel http://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone -b noetic-devel http://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ~/catkin_ws  catkin_makeROS1其他版本的TB3功能包参考ROS1功能包 ROS2foxy版本功能包参考ROS2功能包 注意ROS1ROS2的其他版本连接中改对应版本名称 编译成功 5、Gazebo仿真 1选择启动的机器人模型 
export TURTLEBOT3_MODELwaffle_piexport TURTLEBOT3_MODELburger2启动gazebo仿真环境 
roslaunch turtlebot3_gazebo turtlebot3_world.launch可能会出现以下报错  找到错误原因“环境变量设置有问题” 错误原因为环境变量设置有问题后面进行优化 运行下方代码后再执行roslaunch 
source ~/catkin_ws/devel/setup.bashroslaunch turtlebot3_slam turtlebot3_slam.launchturtlebot3_world.launch  3启动rviz进行建图 打开新的终端还要在输入一边机器人选择模型的指令在输入以下指令后面进行优化 
roslaunch turtlebot3_slam turtlebot3_slam.launch4控制小车移动实现建图 打开新的终端还要在输入一边机器人选择模型的指令 
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch5保存地图 
rosrun map_server map_saver -f ~/map_world地图自动保存在~/home/map目录下名为map_world.yaml和map_world.pgm  
优化 
目前在启动机器人小车在仿真环境中的建图非常麻烦每次启动新的节点都要输入指令选择一遍机器人的模型且在启动turtlebot3_world.launch文件前还要进行以便环境的配置总之是非常麻烦的 下面把这些指令提前配置到source ~/.bashrc文件中 1手动配置 输入 
sudo gedit ~/.bashrc 在文本的最后加入以下这些指令 
source ~/catkin_ws/devel/setup.bash
export TURTLEBOT3_MODELwaffle_pi//如果你要选择burger型机器人输入export TURTLEBOT3_MODELburger
export ROS_DOMAIN_ID30 #TURTLEBOT3
export GAZEBO_MODEL_PATH$GAZEBO_MODEL_PATH:~/catkin_ws/src/turtlebot3/turtlebot3_simulations/turtlebot3_gazebo/models然后保存后关闭文件打开终端输入source ~/.bashrc更新环境即可完成。 2输入指令配置 我参考其他配置环境指令输入后可达到相同效果。 
echo source ~/catkin_ws/devel/setup.bash  ~/.bashrc
echo export TURTLEBOT3_MODELwaffle_pi  ~/.bashrc
echo export ROS_DOMAIN_ID30 #TURTLEBOT3  ~/.bashrc
echo export GAZEBO_MODEL_PATH$GAZEBO_MODEL_PATH:~/catkin_ws/src/turtlebot3/turtlebot3_simulations/turtlebot3_gazebo/models  ~/.bashrc输入完成后打开新终端输入 
source ~/.bashrc设置完成后现在启动建图仅需要输入 1启动gazebo仿真环境 
roslaunch turtlebot3_gazebo turtlebot3_world.launch2启动RVIZ 
roslaunch turtlebot3_slam turtlebot3_slam.launch3启动键盘控制节点即可 
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch