环境文件
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash
export TURTLEBOT3_MODEL=waffle_pi
export LIBGL_ ALWAYS_SOFTWARE=1
export SVGA_VGPU10=0
#echo “source ~/catkin_ws/devel/setup.sh” >> ~/.bashrc
source ~/catkin_ws/devel/setup.sh
export ROS_MASTER_URI=http://192.168.1.106:11311
export ROS_HOSTNAME=192.168.1.106
ip
ifconfig
查看电脑端com
gedit ~/.bashrc
export ROS_MASTER_URI=http://192.168.1.111:11311
export ROS_HOSTNAME=192.168.1.111(IP为虚拟机IP地址)
source ~/.bashrc
ping 192.168.1.111
roscore
启动gazebo
roslaunch turtlebot3_gazebo turtlebot3_world.launch
键盘控制节点:
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
启动导航文件:
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml (后面的地图和gazebo里的地图相同)
运行rviz:
如果rviz显示激光雷达扫出的平面没有与地图的重合,点击rviz上方的2D Pose Estimate按钮设置机器人的初始位置,就可以实现边界的重合了。
点击rviz上方的2D New Goal按钮设置机器人的目标位置,设置完成机器人自主移动