Installing PyCRAM

The setup of PyCRAM can be differentiated in four steps:

  • Install ROS
  • Installing Dependencies
  • Cloning the PyCRAM repo
  • Building your ROS workspace

All dependencies are available via PyPi

PyCRAM is developed and tested currently with Python3.8, Ubuntu 20.04 and ROS Noetic. However, it does still support Ubuntu 18.04 and ROS Melodic. Please see below for installation instructions for both variants.

Installing ROS

PyCRAM uses ROS for a variety of functionality, for this reason you need a working ROS installation on your machine. For information on how to install ROS please referee to the official documentation here.

Installing Dependencies

The dependencies you will need are:

  • Pip
  • vcstool

These are available via the Ubuntu apt-repos and can be installed via the terminal:

sudo apt-get install python3-pip python3-vcstool

PyCRAM on Ubuntu 20.04 (ROS Noetic)

Before installing PyCRAM you need to setup a ROS workspace into which PyCRAM can be cloned.

mkdir -p ~/workspace/ros/src
cd workspace/ros
catkin_make
source devel/setup.bash

If catkin_make does not work this probably means that you did not source your ROS installation, which is needed for catkin_make:

source /opt/ros/noetic/setup.bash

Now you can install PyCRAM into your ROS workspace.

cd <Path to your ROS workspace>
cd src/
vcs import --input https://raw.githubusercontent.com/cram2/pycram/dev/pycram.rosinstall

The cloning and setting up can take several minutes. After the command finishes you should see a number of repositories in your ROS workspace.

Now the last thing that needs to be done is clone the submodules of the PyCRAM repo, this is done via the following commands:

cd pycram
git submodule init
git submodule update

The cloned repository contains the source code for PyCRAM as well as two short demos which demonstrate how to use it.

Python Dependencies

To install the Python dependencies Pip is used. To install Pip type the following command into a terminal.

sudo apt-get install python3-pip

Now the actual Python packages can be installed, these are summarized in the requirements.txt in the PyCRAM repo. For this first navigate to your PyCRAM repo.

cd <path-to-your-pycram-repo>

Then install the Python packages in the requirements.txt file

sudo pip install -r requirements.txt

Building your ROS workspace

Building and sourcing your ROS workspace using catkin compiles all ROS packages and manages the appending to the respective PATH variables. This is necessary to be able to import PyCRAM via the Python import system and to find the robot descriptions in the launch file.

You can build your ROS workspace with the following commands:

cd <Path to your ROS workspace>
catkin_make
source devel/local_setup.bash

Using PyCRAM

To start using PyCRAM you first need to launch the ROS launch file. This launchfile is located in the directory “launch” and is named “ik_and_description.launch”.

The launchfile can be started with the following command:

roslaunch pycram ik_and_description.launch

What the launch file does is start a ROS master, upload the robot URDF to the parameter server as well as starting the IK solver.

Disclaimer At the moment you also need a knowrob node running for PyCRAM to start. This is because while importing packages some will look for the rosprolog services. You don't need a belief state, it only requires the rosprolog services to be reachable.