Build the Turtlebot Robot Slam cruise map in the Ros container of the Docker platform
SLAM (simultaneous localization and mapping), also known as CML (Concurrent Mapping and localization), instant positioning and map building, or concurrent mapping and positioning. The problem can be described as: putting a robot in an unknown location in an unknown environment, whether there is a way for the robot to gradually paint a complete map of the environment, while deciding which direction the robot should travel. I. Construction of the ROS container on the Docker platform
According to the previous blog post with pipework to the Docker multi-container LAN network configuration method, the network way to configure the Ros container. However, if this is the case, when you build the map later, you will encounter a problem: "Xserver cannot connect". So it's necessary to set up other variables just to build the Ros container.
$ docker run-it \
--env= "DISPLAY" \
--env= "Qt_x11_no_mitshm=1" \
--volume= "/tmp/. x11-unix:/tmp/. X11-UNIX:RW "\
--name=rostest \
<ros mirroring > \
#执行上述命令后, the ROS container needed for the experiment was constructed, but the ros_hostname needed to be added, Ros_master _uri, the container executes Source/etc/profile, the source Opt/ros/<your distribution your Ros version >setup.bash, please refer to the previous several blog posts in detail.
In the following test, there will be a xserver error problem, in addition to the previous settings, but also to execute the command below
$xhost +local:root # Executes in another terminal window of the host
second, the IP designation of ROS container
Using the Pipework Network Setup tool, it is easy to set the container IP (note the need to set up with local Turtlebot on a LAN for easy communication), the main steps are as follows:
The author's local network basic parameters are:
ip:192.168.1.1, Subnet mask 255.255.255.0
$ sysctl–w net.ipv4.ip_forward=1
$ sudo pipework/pipework br0 <ros container name > 192.168.1.202/24@192.168.1.1
$ sudo apt-get install bridge-utils
$ sudo brctl addif br0 eth0
$ ip addr Add 192.168.1.1/24 dev br0
Ros container IP set to 192.168.1.202
Turtlebot robot IP is 192.168.1.103 three, on the Workstation computer (have set IP for hostname, has the completion of the container network settings, within the/etc/profile of the container) of the Ros container inside, Execute the following command
(1) After setting up the network (not clear this step, you can view the previous posts), source two
# source/etc/profile
# Source/opt/ros/<your Ros Distribution your Ros version >/setup.bash
(2) test the ROS container on the workstation and the Turtlebot Robot Buddha communication: Ping inside the Ros container
#ping 192.168.1.103
(3) Execute the roscore command inside the ROS container and execute successfully. When you need to execute other commands inside the container again, one thing to note is that you need to reopen a container's terminal window. With the EXEC command instead of attach, why not use the latter, open a try to know.
$ sudo docker exec-it < container name >/bin/bash
After entering the container, you still need:
# source/etc/profile
# Source/opt/ros/<your Ros Distribution your Ros version >/setup.bash
Each time a new Ros container terminal is opened, the above command needs to be executed. Iv. executing on the host of the Turtlebot robot
"
$ roscore
$ roslaunch turtlebot_bringup minimal.launch
$ roslaunch turtlebot_navigation gmapping_ Demo.launch
can open Kinect (if using ASUS sensor, can refer to the ROS website settings) to detect whether the image transmission is normal
$ roslaunch freenect_launch freenect.launch
$ rosrun image_view image_view
$ image:=/camera/rgb/image_raw
Execution diagram on Turtlebot robot
v. Perform in a ROS container on a workstation computer
Visualize slam maps in Rviz
$ roslaunch turtlebot_rviz_launchers view_navigation.launch
$ roslaunch turtlebot_teleop keyboard_teleop.launch
These two commands can also be combined in a single command:
# roslaunch Turtlebot turtlebot_rviz_launchers view_teleop_navigation.launch
After the successful implementation, then in the workstation host (ran the Ros container) on the map, the author constructs a small area of the author's bedside laboratory map, black means the barrier, gray means no barrier.
When the map was initially built:
When the map is complete:
for Slam map navigation questions, the next blog post explains.
For questions or questions about the blog post, please ask in the comments section ~