Table of Contents

Run the PyCRAM demos

There are two demos available for PyCRAM, the first shows the usage of the BulletWorld and its reasoning mechanisms. The second can only be used with a real PR2 and shows how to use the ProcessModules, Motion Designators and the PyCRAM plan language.

Demo 1

This demo shows the capabilities of the BulletWorld and its reasoning mechanisms.

Setup

To setup PyCRAM please see the tutorial at here.

Start the IK service

To run the demo an external IK service is needed. To start this service a working ROS installation is needed, for a tutorial on how to install and setup ROS look here

cd ~/pycram/launch 
roslaunch ik_and_description.launch

Choose the robot

The launchfile in the previous section included a robot description of the PR2. But the demo can also use the Boxy robot of the Institute of Artificial Intelligence, for this to work the repo which contains the robot description has to be cloned first.

git clone git@github.com:code-iai/iai_robots.git 

Now you can choose which robot description to upload in the launch file. This can be done by editing the argument 'robot' at the top of the launch file.

Note, in order for ROS to be able to find the robot description you have to build the iai_robots repo using catkin.

Run the Demo

Now that all dependencies are installed and the IK service is running the demo can be executed. For this open a new terminal and enter the pycram_pr2_bullet_world_demo in the PyCRAM repository.

cd ~/pycram/demos/pycram_pr2_bullet_world_demo

Now execute the run.py.

python3 run.py

Demo 2

For this demo a real PR2 is needed. Furthermore, ROS1 is needed to communicate with the PR2. It is meant to show what is possible with the ProcessModules, Motion Designator and PyCRAM plan language.

Setup

Because ROS1 works mostly with Python2 and PyCRAM is written in Python3 a virtual environment is needed. To setup this virtual environment a few packages need to be installed. In Ubuntu this can be done with the following command:

apt install python-pip python3-pip libbullet-dev python-virtualenv

Libbullet is needed for the ROS1 geometry2 package which is used in this demo.

Now setup a new ROS workspace and pull the required packages.

mkdir -p ~/ros_ws/src
cd ros_ws/src 
git clone https://www.github.com/ros/geometry
git clone https://www.github.com/ros/geometry2 
git clone https://www.github.com/cram2/pycram

Now the virtual environment can be created and activated.

virtualenv -p /usr/bin/python3 venv
source venv/bin/activate 

With the virtual environment up and running the Python ROS packages can be installed. This can be done via pip.

 pip install -U rosdep rosinstall-generator wstool rosinstall ros-buildfarm rosdistro rospkg pyyaml catkin_pkg 

Run the Demo

Now the Demo can be run by simply executing the run.py srcipt.

cd ~/ros_ws/src/pycram/demos/pycram_pr2_demo/src
python3 run.py