Installing trajopt

This code has been tested on Linux and OSX.

Dependencies

  • OpenRAVE (>= 0.8 required, >= 0.9 highly recommended)
  • OpenSceneGraph
  • CMake
  • boost
  • Eigen
  • Gurobi [1] (recommended)
[1]On Linux, Trajopt now works with the free solver BPMPD, which is included with the source distribution (as a static library). However, Gurobi is better-tested with Trajopt and usually performs better.

Instructions

  • install OpenRAVE. To obtain OpenRAVE 0.9, you can install from source or use the openrave testing PPA.

  • install OpenSceneGraph, CMake, boost, and Eigen using your package manager. In Ubuntu, that’s:

    sudo apt-get install libopenscenegraph-dev cmake libboost-all-dev libeigen3-dev python-numpy
    
  • Gurobi (optional):

    • download and install Gurobi from http://www.gurobi.com. You’ll need to make an account and obtain a license. It’s free for academic use, and non-academic users can get a free trial.
    • set the environment variable GUROBI_HOME to point to the folder of your Gurobi directory that contains the folders include and lib. On my development machines, these are /home/username/Src/gurobi502/linux64 and /Library/gurobi501/mac64.
  • Clone trajopt from github

  • Follow the usual CMake procedure:

    mkdir build_trajopt
    cd build_trajopt
    cmake /path/to/trajopt
    make -j
    

You need to set your PYTHONPATH to call trajopt from python. Add the following two paths to your PYTHONPATH:

/path/to/trajopt                # source directory, so "import trajoptpy" works
/path/to/build_trajopt/lib      # here's where the extension modules (.so files) go

Now you should be able to run the scripts in the python_examples directory.

You can check if the build worked by typing

ctest

in the build directory. The output should look something like this:

Test project /home/joschu/build/trajopt
    Start 1: arm_to_joint_target.py
1/9 Test #1: arm_to_joint_target.py .............   Passed    1.53 sec
    Start 2: arm_to_cart_target.py
2/9 Test #2: arm_to_cart_target.py ..............   Passed    1.78 sec
    Start 3: fullbody_plan.py
3/9 Test #3: fullbody_plan.py ...................   Passed    2.63 sec
    Start 4: position_base.py
4/9 Test #4: position_base.py ...................   Passed    1.84 sec
    Start 5: arm_to_cart_target_position_only
5/9 Test #5: arm_to_cart_target_position_only ...   Passed    1.77 sec
    Start 6: sco-unit
6/9 Test #6: sco-unit ...........................   Passed    0.08 sec
    Start 7: collision-checker-unit
7/9 Test #7: collision-checker-unit .............   Passed    0.09 sec
    Start 8: planning-unit
8/9 Test #8: planning-unit ......................   Passed    1.05 sec
    Start 9: cast-cost-unit
9/9 Test #9: cast-cost-unit .....................   Passed    0.09 sec

100% tests passed, 0 tests failed out of 9

Total Test time (real) =  10.90 sec

If one of the unit tests fails, you can get more diagnostic information by running with ctest -V, or running the test scripts individually. The python executables are in SOURCE_DIR/python_examples and the compiled c++ executables are in BUILD_DIR/bin.

Common installation problems

  • All tests fail, due to Gurobi license issue. Make sure Gurobi license is set up properly.

  • You get an error from libbulletrave.so, e.g.

    [plugindatabase.h:929] /usr/local/share/openrave-0.9/plugins/libbulletrave.so: /usr/local/share/openrave-0.9/plugins/libbulletrave.so: undefined symbol: _ZNK16btCollisionShape17getBoundingSphereER9btVector3Rf
    Segmentation fault (core dumped)
    

    This is due to a name collision between a system installation of bullet and the local version in trajopt. One crude solution: sudo rm /usr/local/share/openrave-0.9/plugins/libbulletrave.so or whatever the path is to the bullet plugin. OpenRAVE uses ODE rather than Bullet by default, so there’s no harm in removing the bullet plugin.

  • All the python tests fail with an ImportError, because trajoptpy is not found or ctrajoptpy is not found. That means your PYTHONPATH is not set correctly. It should have both the trajopt source directory /path/to/trajopt and the lib subdirectory of the build directory, /path/to/build_trajopt/lib.

  • Almost all the tests fail, where OpenRAVE symbols aren’t found. Set LD_LIBRARY_PATH=/usr/local/lib or whereever libopenrave.so is. (Note: if you know how to fix this problem through RPATH settings or linker flags, please enlighten me.)

Table Of Contents

Previous topic

trajopt: Trajectory Optimization for Motion Planning

Next topic

Tutorial