Installation

Latest version

rigid-body-motion can be installed via pip:

$ pip install rigid-body-motion

or via conda:

$ conda install -c phausamann -c conda-forge rigid-body-motion

Optional dependencies

Optional dependencies can be installed via pip or conda (just replace pip install with conda install).

Transformations can be sped up significantly by installing the numba library:

$ pip install numba

rigid-body-motion supports xarray data types:

$ pip install xarray

Loading the example datasets requires the pooch and netCDF4 libraries:

$ pip install pooch netcdf4

Plotting functions require matplotlib:

$ pip install matplotlib

ROS integration

The package also integrates with ROS, which can be installed quite conveniently via conda thanks to the amazing work by the people from RoboStack. This even works on Windows and macOS! The necessary dependencies are:

$ conda install -c conda-forge -c robostack ros-noetic-rospy ros-noetic-tf ros-noetic-tf2-ros ros-noetic-tf2-geometry-msgs ros-noetic-geometry-msgs ros-noetic-visualization-msgs python-orocos-kdl boost=1.74

Note that these packages are only available for Python 3.6 and 3.8.

In order to use RViz for visualization you need to install that as well:

$ conda install -c conda-forge -c robostack ros-noetic-rviz

Since ROS can communicate across conda environments, we would however recommend installing RViz in a dedicated environment:

$ conda create -n ros -c conda-forge -c robostack ros-noetic-rviz

After installing, you can spin up a roscore:

$ conda activate ros
$ roscore

and, from a second terminal, launch RViz:

$ conda activate ros
$ rviz

Troubleshooting

In order to make sure all ROS dependencies have been set up correctly, run:

$ python -m rigid_body_motion.ros.check_install

If this is not successful, you need to fix some of your dependencies. The following outlines solutions for common issues:

  1. Problem: boost version

    ImportError: libboost_thread.so.1.74.0: cannot open shared object file:
    No such file or directory
    

    Solution: install correct boost version

    $ conda install -c conda-forge boost=1.74
    

    Replace 1.74 with whatever version the traceback tells you is missing.

Example environments

We recommend using rigid_body_motion in a dedicated conda environment. For the examples in the user guide, we provide an environment file that you can download and set up with:

$ conda env create -f example-env.yml

There’s also an example environment that includes the necessary ROS packages (here) that you can set up with:

$ conda env create -f example-env-ros.yml

If you download the examples as Jupyter notebooks, it is sufficient to have the Jupyter notebook server installed in your base environment alongside nb_conda:

$ conda install -n base nb_conda

Now you can open any of the example notebooks, go to Kernel > Change kernel and select Python [conda env:rbm-examples] (or Python [conda env:rbm-examples-ros]).

Pre-release version

The latest pre-release can be installed from the GitHub master branch:

$ pip install git+https://github.com/phausamann/rigid-body-motion.git