Creating a CRAM Package for the Simple Mobile Manipulation Plan

From David Vernon's Wiki
Revision as of 06:24, 12 July 2019 by Dvernon (Talk | contribs)

Jump to: navigation, search

This tutorial assumes you have done all of the CRAM Beginner Tutorials.

In this tutorial we will create a CRAM package for the Simple Mobile Manipulation Plan intermediate tutorial. We will do this in the same way as we created a CRAM package for the Beginner Tutorials, by creating a CRAM package and adding the Lisp code for the simple mobile manipulation plan. However, since the mobile manipulation plan is itself based on the Bullet World Demonstration tutorial, after creating the new CRAM package we will first copy the Bullet World Demonstration files and then we will add a new Lisp file for the Mobile Manipulation Plan.

The purpose of this exercise is to avoid having to provide all of the function definitions interactively so that we can simply do the tutorial by invoking the example commands, i.e. by evaluating the various example forms in REPL.


Creating the CRAM Package

Creating the ROS package

Just as with the beginner tutorial, first we need to create a ROS package that depends on cram_language.

In the src subdirectory of your ROS workspace execute the following command:

$ catkin_create_pkg cram_my_intermediate_tutorial cram_language

If you have followed the CRAM installation instructions faithfully, the src subdirectory will be ~/workspace/ros/src:

 ~/workspace/ros/src$ catkin_create_pkg cram_my_intermediate_tutorial cram_language

For the rest of the tutorial, we will leave out the ~/workspace/ros/src.

Copying the Bullet World Demonstration Files

Move the the cram_my_intermediate_tutorial directory:

$ cd cram_my_intermediate_tutorial

The catkin_create_pkg command above creates two files:

CMakeLists.txt
package.xml

We would overwrite these when we copy the Bullet World Demonstration files so let's first take the precaution of changing their names, viz.

$ mv CMakeList.txt CMakeLists.txt.tmp
$ mv package.xml package.txt.tmp

Now, copy the Bullet World Demonstration files:

$ cp -rf ~/workspace/ros/src/cram/cram_tutorials/cram_bullet_world_tutorial/*  .


Customizing the Bullet World Demonstration Files

Now, let's customize the package so that it refers to cram_my_intermediate tutorial instead of cram_bullet_world_tutorial.

Rename cram-bullet-world-tutorial.asd to cram-my-intermediate-tutorial.asd

$ mv cram-bullet-world-tutorial.asd cram-my-intermediate-tutorial.asd

Edit CMakeLists.txt.
Change project(cram_bullet_world_tutorial) to project(cram_my_intermediate_tutorial).


Edit package.xml.
Change <name>cram_bullet_world_tutorial</name> to <name>cram-my-intermediate-tutorial</name>.
Change <description>Tutorial code for the bullet world.</description> to <description>Tutorial code for the simple mobile manipulation plan</description>.


Edit cram-my-intermediate-tutorial.asd.
Change (defsystem cram-bullet-world-tutorial to (defsystem cram-my-intermediate-tutorial.

Move into the src directory:

$ cd src


Edit package.lisp
Change (defpackage cram-bullet-world-tutorial to (defpackage cram-my-intermediate-tutorial.
Change (:nicknames #:btw-tutl) to (:nicknames #:smmp-tutl).


Edit setup.lisp
Change (in-package :bwt-tut) to (in-package :smmp-tut).


Edit tutorial.lisp
Change (in-package :bwt-tut) to (in-package :smmp-tut).


Checking That It Still Works

At this point, we should just have a rename working version of the Bullet World Demonstration tutorial.

Before adding the simple mobile manipulation plan Lisp code, let's make sure that everything still works by compiling and running the package (the following instructions are adapted from Bullet World Demonstration tutorial).

Environment Setup

First, let's set up the environment in our terminal by calling the launch file. It already brings up a roscore from within:

$ roslaunch cram_my_intermediate_tutorial world.launch

REPL Setup

Now, let's load the package in the REPL (start the REPL with $ roslisp_repl):

CL-USER> (ros-load:load-system "cram_my_intermediate_tutorial" :cram-my-intermediate-tutorial)
CL-USER> (in-package :cram-my-intermediate-tutorial)

As we will be talking to the ROS master, let's first start a node:

SMMP-TUT> (roslisp:start-ros-node "manipulation_plan")


Bullet World Initialization

Finally, initialize everything.

SMMP-TUT> (roslisp-utilities:startup-ros)

If everything is works as it should, the kitchen and PR2 robot should appear in the Bullet World window.

Now, let's move on to adding the Lisp code for the Simple Mobile Manipulation Plan intermediate tutorial.


Adding the Simple Mobile Manipulation Plan

At this point, we need to add a new Lisp file simple-mobile-manipulation-plan.lisp with the code that is provided in the Simple Mobile Manipulation Plan intermediate tutorial. We also need to add it to the cram-my-intermediate-tutorial.asd file.

Again, the purpose of this exercise is to avoid having to provide all of the function definitions interactively so that we can simply do the tutorial by invoking the example commands, i.e. by evaluating the various example forms in REPL.

In the src</src> directory, edit (and thereby create) <code>simple-mobile-manipulation-plan.lisp and add the following code.