Skip to content

Develop

Raffaello Bonghi edited this page Sep 22, 2021 · 11 revisions

There are some steps to do before working locally on Nanosaur and edit all scripts working with Docker.

Setup the environment on the host

Clone all repositories on your NVIDIA Jetson

cd $HOME
mkdir -p nanosaur_ws/src
cd nanosaur_ws/src
git clone https://github.com/rnanosaur/nanosaur.git
git clone https://github.com/rnanosaur/nanosaur_robot.git

REMEMBER: you don't need to build these packages from your host

Run docker container

Now you can run and connect to the docker container and edit the source code directly from your host. All changes will appear inside the container.

If you want to rebuild a nanosaur docker image follow this link

After this command, you will be able to edit and rebuild all sourcecode inside the container. If you leave the container, you can press CTRL-D. The Docker container will be destroyed, but all packages modifications will be on the host.

Work inside the container

The nanosaur packages are in /opt/ros_ws. From this folder, you can work with all ros2 command features.

Hints

  • Rebuild all packages: colcon build --symlink-install
  • Build only a selected package: colcon build --symlink-install --packages-select [PKG_NAME]
  • Run nanosaur: ros2 launch nanosaur_bringup bringup.launch.py

What is mean nanosaur run?

When you run the command on your NVIDIA Jetson nanosaur run this is equivalent to the line below:

docker run --runtime nvidia -it --rm  --network host --device /dev/i2c-0 --device /dev/i2c-1 --device /dev/input -v /tmp/argus_socket:/tmp/argus_socket -v /run/jtop.sock:/run/jtop.sock -v $HOME/nanosaur_ws/src:/opt/ros_ws/src/ nanosaur/nanosaur:latest bash

Option explained:

  • -it means run in interactive mode
  • --rm will delete the container when finished
  • --runtime nvidia will use the NVIDIA container runtime while running the l4t-base container
  • --network host To read all topics outside the container need to share the same network to the host
  • --device load a device in a container, such as the I2C devices and joystick
  • -v is the mounting directory

Reference

Clone this wiki locally