Moveit and Docker: best practices
Follow instructions from the Docker docs
Follow the first chapter of linux post installation instructions, "manage docker as non-root user"
To enable the Nvidia driver inside containers follow the Nvidia docs (Nvidia driver is not compatible with preempt_rt kernel)
Test your installation by running
docker run hello-world
with Nvidia
docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi
Familiarize yourself with the following Docker CLI commands
- docker build
- docker run
- docker image ls
- docker image prune
- docker container list
- docker container prune
Install vs code and the following vs code extensions
-
Process priority for UR driver
When not using a realtime kernel it is recommended to run the UR driver with high process priority.
See process nice for more information on process niceness.
This requires the user to have the permissions to change the niceness of processes.
Add the following to /etc/security/limits.conf on the Docker host
$USER - nice -15
Once inside the container run
su $USER
in order for the permissions to be loaded. -
Udev rules for Realsense Driver
Download the udev rules and place them in /etc/udev/rules.d
Run
sudo service udev reload
andsudo service udev restart
to load the new rules, not required if you reboot
Recommended to reboot at this point to ensure all changes are applied
- Go to MRAC_ur_commander and fork the repository.
cd ~/dev_ws/src
- clone the forked repository.
cd ~/dev_ws
- rosdep install --from-paths src --ignore-src -r -y
catkin clean
catkin build
source devel/setup.bash
cd ~/dev_ws/src/MRAC_ur_commander
code .
open vscode
- Open a terminal inside the vscode
- Running the following command from the root of the repo will execute the build image shell script
.docker/build_image.sh
note: On Ubuntu 20.04 --privileged flag is required on Ubuntu 22 it can be omitted
Running the following command from the root of the repo will execute the run image shell script
.docker/run_user.sh --privileged
With Nvidia driver
.docker/run_user_nvidia.sh
Once inside the container, ake ownership of the workspace with write in $USER your user
sudo chown -R $USER /dev_ws
Open vscode, go to the docker tab. Select the running container, right click and select attach vscode
In vs code go to the Docker tab in the side bar. Right click on the container named moveit1_ur:latest. Select attach vscode.
When attaching to the container for first time:
In vs code open the command palette (Ctrl-Shift-P). Select Remote-containers: Open attached container configuration file
| Open attached container configuration file
. Copy paste content of devcontainer.json and save. Close the vscode window and reattach.
Terminator is installed in the container for multiple terminals launch terminator from the CLI inside the container. Run terminator
to start. You will need to source your ros environment.
For automatic sourcing of ros environment add the following to your .bashrc or .zshrc
Add the following to your .bashrc (located in home/$USER) to automatically source the ROS environment when opening a new shell in the container.
if [ -f "/dev_ws/setup.bash" ]; then
source /dev_ws/setup.bash
fi
or if you are using zsh to your .zshrc
if [ -f "/dev_ws/setup.zsh" ]; then
source /dev_ws/setup.zsh
fi
This will source the workspace for every new shell opened in /dev_ws or /dev_ws/src
Inside the terminal where the docker has been run the .docker/run_user.sh --privileged execute terminator
Inside the terminator terminal launch the ur10e commander file roslaunch commander ur10e_ka_commander.launch
See that rviz opens, UR10 appears
Go to file commander/notebooks/commander_examples.ipynb → double click and start to run the simulation.
Make sure that the kernel is Started (Python 3.8.10) and start to execute the different codes.
Before closing the terminal you ran the docker image from remember to commit and push your changes.
The bringup launch file will attempt to start the UR driver with hight process priority.
Ensure both the user on the host and container have the required permissions to do so. See section "Process priority for UR driver"
These instructions assume
- Robot IP: 192.168.56.101
- Docker Host IP: 192.168.56.1
Launch the robot bringup, this file sets the robot IP and loads the kinematics calibration for the IAAC UR10e.
-
without endeffector
ur10e_moveit_config ur10e_iaac_bringup.launch
-
with endeffector
ur10e_ee_moveit_config ur10e_ee_iaac_bringup.launch
On the ur pendant open the program named ros and press play
If URcaps fails to connect add the following rule to the firewall (ufw) on the docker host u
sudo ufw allow from 192.168.56.101 to 192.168.56.1
When the robot is connected you should see the following in the terminal you launched the bringup launchfile from.
[ INFO] Sent program to robot
[ INFO] Robot connected to reverse interface. Ready to receive control commands.
You can use the top
command to check the ur driver is running unnicely