rtabmap_drone_example
rtabmap_drone_example copied to clipboard
Example of using move_base with mavros/px4 and rtabmap visual SLAM
rtabmap_drone_example
2D navigation example of a drone using move_base with mavros/px4 and rtabmap visual SLAM.
Overview video (click to watch on Youtube):
Install
Docker (recommended)
To make it simple, create the following docker image (nvidia GPU required):
git clone https://github.com/matlabbe/rtabmap_drone_example.git
cd rtabmap_drone_example
docker build -t rtabmap_drone_example -f docker/Dockerfile .
Host
Follow instructions from docker/Dockerfile to install dependencies.
Usage
Docker (recommended)
Launch the simulator:
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run -it --rm \
--privileged \
--network=host \
--env="DISPLAY=$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--env="XAUTHORITY=$XAUTH" \
--volume="$XAUTH:$XAUTH" \
--runtime=nvidia \
rtabmap_drone_example \
roslaunch rtabmap_drone_example gazebo.launch
Launch VSLAM:
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run -it --rm \
--privileged \
--network=host \
--env="DISPLAY=$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--env="XAUTHORITY=$XAUTH" \
--volume="$XAUTH:$XAUTH" \
--runtime=nvidia \
rtabmap_drone_example \
roslaunch rtabmap_drone_example slam.launch
Launch rviz:
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run -it --rm \
--privileged \
--network=host \
--env="DISPLAY=$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--env="XAUTHORITY=$XAUTH" \
--volume="$XAUTH:$XAUTH" \
--runtime=nvidia \
rtabmap_drone_example \
roslaunch rtabmap_drone_example rviz.launch
Arm and take off:
docker run -it --rm \
--privileged \
--network=host \
rtabmap_drone_example \
rosrun rtabmap_drone_example offboard
Host
roslaunch rtabmap_drone_example gazebo.launch
roslaunch rtabmap_drone_example slam.launch
roslaunch rtabmap_drone_example rviz.launch
rosrun rtabmap_drone_example offboard
Control
- Autonomous control: use "2D Nav Goal" button in RVIZ to set a goal to reach
- Manual control: If a joystick is plugged, you can send twists by holding L1 and moving the joysticks. Hold L1+L2 with left joystick down to land (be gentle to land smoothly), then hold left joystick in bottom-right position to disarm after the drone is on the ground.