Skip to content

roboticswithjulia/MRAC_ur_commander

 
 

Repository files navigation

Quick start

Docker

Moveit and Docker: best practices

Installation

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

 

Docker commands

Familiarize yourself with the following Docker CLI commands

 

Vscode

Install vs code and the following vs code extensions

 

Set up required permissions on host for interfacing with hardware

  • 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 and sudo 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

 

Use

 

fork and clone repo

  1. Go to MRAC_ur_commander and fork the repository.
  2. cd ~/dev_ws/src
  3. clone the forked repository.
  4. cd ~/dev_ws
  5. rosdep install --from-paths src --ignore-src -r -y
  6. catkin clean
  7. catkin build
  8. source devel/setup.bash
  9. cd ~/dev_ws/src/MRAC_ur_commander
  10. code . open vscode

 

Building the image

  1. Open a terminal inside the vscode
  2. Running the following command from the root of the repo will execute the build image shell script
.docker/build_image.sh

⚠️ Docker build: takes time! Build at the beginning of the class.

 

Running the image

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

 

Attach vs code to container

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.

 

Using the container as a development environment

Terminal

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

 

Launch the simulation

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.

Saving

Before closing the terminal you ran the docker image from remember to commit and push your changes.

Launch the real robot

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 34.6%
  • C++ 34.0%
  • Python 23.3%
  • CMake 6.1%
  • Dockerfile 1.4%
  • Shell 0.6%