vortexntnu / vortex-asv

GNC for the Vortex ASV. Purpose built for competing in ASV competitions.
MIT License
7 stars 0 forks source link

Vortex-ASV

Vortex ASV software. Purpose built for competing in ASV competitions.

Docker, user guide

Docker is a tool for creating a virtual environment with predetermined dependencies, much like a VM with fixed installation steps. In this case, we are using the the ROS noetic image as a base, and adding our own dependencies on top of it. To use Docker, make sure you have downloaded the Docker Engine and Docker compose.

We use Docker to be able to run the code on any PC that has the Docker installed. This first part is the basics of how to run a docker container on your PC. For developing, skip to the next part

To run a service, navigate to Vortex-ASV where docker-compose.yml is located and run

sudo docker-compose up -d <service_name>

Where is a name from the list:

asv
lidar
simulator

The -d flag (detatch) runs the services in the background instead of taking up your terminal. These are defined in docker-compose.yml. Alternatively you could run all services simultaneously. The services will run in different containers, but because of how they are defined they share their output between containers and the host. This means a ROS instance in any container can communicate with a ROS instance on the host or another container. Note that the first time you run a service it might take a few minutes.

Running the services in this way launches the programs associated with the services. For instance, running the "simulator" service launches the gazebo simulator with the GUI disabled. This makes it so any PC can run the simulator. Some PCs could not run the simulator, but with the GUI disabled, it should run fine. To get some visualization, use rviz:

rosrun rviz rviz -d sim_config.rviz

When you are finished using the container, run

sudo docker-compose down <service_name>

Docker, developer guide

If you are altering the code, running the services listed above is cumbersome. The way you would run the code after making new changes new changes would be:

Now the workflow is like this:

The most common use of this will be running the simulator in one container and running the asv-dev in another for testing of new code. You might need to build the catkin workspace inside the container. This is no different from normal:

cd ~/asv_ws && catkin build 
source ~/asv_ws/devel/setup.bash

Now you can run and test any changes made, and make as many new ones as you'd like. to exit the container, run

exit

When you are finished using the container, run

sudo docker-compose down <service_name>