EuropeanRoverChallenge / ERC-Remote-Navigation-Sim

MIT License
46 stars 30 forks source link

ERC Remote Navigation Simulation

This repository provides a Gazebo simulation of the Navigation and Science Task for the ERC Remote competition. \ For the dockerized version, skip to the Using Docker section.

Table of Contents

  1. Prerequisites
  2. Building
  3. Updating
  4. Launching
  5. Using Docker
  6. ROS API
    1. Subscribed Topics
    2. Published Topics
    3. Services
    4. Parameters Set
  7. Troubleshooting

Prerequisites

The current version of the simulation targets ROS Noetic Ninjemys distribution and was mainly developed and tested on Ubuntu 20.04 Focal Fossa.

The tools necessary to build this project can be installed with apt:

sudo apt install python3-rosdep python3-catkin-tools

Building

This repository uses git submodules to link external repositories that contain the ROS packages. \ When cloning this repository, add the --recurse-submodules flag to recursively pull the submodules:

git clone --recurse-submodules https://github.com/EuropeanRoverChallenge/ERC-Remote-Navigation-Sim.git

or if you have already cloned the repository without this option, clone the submodules using:

git submodule update --init

Use the rosdep tool to install any missing dependencies. If you are running rosdep for the first time, you might have to run:

sudo rosdep init

first. Then, to install the dependencies, type:

rosdep update
sudo apt update
rosdep install --rosdistro noetic --from-paths src -iy

Now, use the catkin tool to build the workspace:

catkin config --extend /opt/ros/noetic
catkin build

Updating

To pull the newest commits and recursively update the submodules, simply type:

git pull --recurse-submodules

If you have already pulled the new commits without the --recurse-submodules flag, you can simply update the submodules:

git submodule update --init

The new versions of the packages may have added some new dependencies so make sure to install them by running rosdep install command again:

rosdep install --rosdistro noetic --from-paths src -iy

And rebuild the workspace:

catkin build

Launching

Make sure you source the devel space on each terminal session you want to use the simulation on:

source devel/setup.bash

To start the simulation and gazebo GUI, type:

roslaunch leo_erc_gazebo leo_marsyard.launch

To visualize the model in Rviz, type on another terminal session:

roslaunch leo_erc_viz rviz.launch

The HazCam and NavCam displays should show the images from the simulated cameras.

To test teleoperation with a keyboard, you can run the key_teleop node:

rosrun leo_erc_teleop key_teleop

To control the Rover using a joystick, type:

roslaunch leo_erc_teleop joy_teleop.launch
The command mapping was set for the Xbox 360 controller and looks like this: Xbox 360 controller Command
RB button enable - hold it to send commands
Left joystick Up/Down linear velocity
Right Joystick Left/Right angular velocity
A button drop the next probe
B button despawn probes and reset probe counter

To modify it, you can edit the joy_mapping.yaml file inside the leo_erc_teleop package.

Using Docker


NOTE

All of the commands in this section should be executed as the root user, unless you have configured docker to be managable as a non-root user.


Make sure the Docker Engine is installed and the docker service is running:

systemctl start docker

Then, either pull the newest prebuilt Docker image:

docker pull ghcr.io/europeanroverchallenge/erc-remote-navigation-sim:latest
docker tag ghcr.io/europeanroverchallenge/erc-remote-navigation-sim:latest erc_navigation_sim

or build the image yourself:

docker build -t erc_navigation_sim .

Permit the root user to connect to X window display:

xhost +local:root

Start the docker container:

docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY --name erc_sim erc_navigation_sim

If you want the simulation to be able to communicate with ROS nodes running on the host or another docker container, add --net=host flag:

docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY --name erc_sim --net=host erc_navigation_sim

Gazebo may not run or work really slow without the GPU acceleration. \ If you are running the system with an integrated AMD/Intel Graphics card, try adding --device=/dev/dri flag:

docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY --name erc_sim --device=/dev/dri erc_navigation_sim

To use an Nvidia card, you need to have proprietary drivers installed, as well as the Nvidia Container Toolkit. \ Add the --gpus all flag and set NVIDIA_DRIVER_CAPABILITIES variable to all:

docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY --name erc_sim --gpus all -e NVIDIA_DRIVER_CAPABILITIES=all erc_navigation_sim

To use the other ROS packages, start bash inside the running container:

docker exec -it erc_sim /ros_entrypoint.sh bash

and use the examples from the Launching section.

ROS API

This section describes ROS topics, services and parameters that are available on both the simulation and the real robot.

Subscribed topics

Published topics

Services

Parameters set

Troubleshooting

D-Bus error

The D-Bus error may occure while trying to launch gazebo inside the docker container. The easiest way to solve the problem is to use the --privileged flag to give extended privileges to this container, for example:

docker run --rm --net=host -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY --gpus all -e NVIDIA_DRIVER_CAPABILITIES=all --privileged --name erc_sim erc_navigation_sim