Skip to content

Marsworks/ERC-Remote-Navigation-Sim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ERC Simulation Workspace

This repository aims to provide instructions on how to install and use the Leo Rover simulation environment for the ERC competitions.

Requirements

The simulation is mainly developed and tested on Ubuntu 18.04 Bionic Beaver with ROS Melodic Morenia, so it is a recommended setup.

The rest of the tools used in this guide can be installed with apt:

sudo apt install python-rosdep python-catkin-tools python-vcstool

There is also a dockerized version which should work on most Linux distributions running X Window Server (See Using Docker section).

Building

Use the vcstool tool to clone the required packages:

vcs import < leo-erc.repos

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 melodic --from-paths src -iy

Now, use the catkin tool to build the workspace:

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

Updating

The list of the repositories may change, so make sure you have pulled the latest commit:

git pull

Use vcstool tool to clone any new repositories:

vcs import < leo-erc.repos

And pull the new commits on the already cloned ones:

vcs pull src

Then, make sure you have all the dependencies installed:

rosdep install --rosdistro melodic --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_gazebo leo_marsyard.launch

For more info about available launch files and their arguments, visit the leo_gazebo repository.

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

roslaunch leo_viz rviz.launch

Turn on the Image panel in Rviz to show the simulated camera images.

To control the Rover using a joystick, type:

roslaunch leo_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

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

ROS API

The following topics and parameters are available on both the simulation and the real robot.

Subscribed topics

  • cmd_vel (geometry_msgs/Twist)

    Target velocity of the Rover.
    Only linear.x (m/s) and angular.z (r/s) are used.

Published topics

Parameters set

  • robot_description (type: str)

    The URDF model of the robot.

Using Docker


NOTE

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

Build the docker image by executing:

docker build -t erc_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_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 --net=host -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY --name erc_sim  erc_sim

Gazebo can work really slow without the GPU acceleration.
If you are running the system on an integrated AMD/Intel Graphics card, try adding --device=/dev/dri flag:

docker run --rm --net=host --device=/dev/dri -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY --name erc_sim  erc_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 --net=host -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY --gpus all -e NVIDIA_DRIVER_CAPABILITIES=all --name erc_sim erc_sim

To start any other ROS nodes inside the container, type:

docker exec -it erc_sim /ros_entrypoint.sh <COMMAND>

For example:

docker exec -it erc_sim /ros_entrypoint.sh roslaunch leo_viz rviz.launch

To update the docker image, you need to rebuild it with --no-cache option:

docker build --no-cache -t erc_sim .

Troubleshooting


  • D-Bus error

The D-Bus error may occure while trying to launch gazebo. To solve the problem use --privileged flag, it gives extended privileges to this container.

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_sim

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 100.0%