3. Problem domain: Scaling chains of integrators¶
Often referred to as “the first domain,” the basic problem is to find a controller for a given chain of integrators system so that all trajectories repeatedly reach several regions while avoiding others.
While below we include pointers to the main websites for dependencies, many are available via packages for your OS and may already be installed, especially if you have ROS on Ubuntu 14.04. Supported platforms are described in the Introduction.
While not necessary to use the benchmark per se,
provide a means to examine problem instances and results of trials, as
demonstrated in the tutorial below. Together with the
fmrb Python package,
which is under
tools/fmrb-pkg/ in the repository, the following additional
dependencies are present:
- NumPy, which is part of the standard scientific Python stack
- Matplotlib, also part of the standard stack
- pycddlib, a Python wrapper for Komei Fukuda’s cddlib
- Python Control Systems Library
Once these are met, install
fmrb from your copy of the repository, e.g.,
cd tools/fmrb-pkg pip install -e .
or get it from PyPI,
pip install fmrb
In the below code,
$FMRBENCHMARK is the absolute path to a copy of the
fmrbenchmark repository on your machine.
3.2.1. Demonstrations of components¶
To build the “standalone” (i.e., independent of ROS) examples demonstrating
various parts of this benchmark, go to the
$FMRBENCHMARK/domains/integrator_chains/dynamaestro) and then follow the
usual CMake build instructions. On Unix without an
IDE, usually these are
mkdir build cd build cmake .. make
One of the resulting programs is
genproblem, the source of which is
The output is a problem instance in JSON. To visualize it, try
dynamaestro/build/genproblem | analysis/plotp.py -
from the directory
3.2.2. Controller examples¶
Note that the
lqr.py controller requires the Python Control System Library
control) and a standard scientific Python stack including NumPy. These and
other dependencies are described above.
Create a catkin workspace.
mkdir -p fmrb_demo/src cd fmrb_demo/src catkin_init_workspace
Create symbolic links to the ROS packages in the fmrbenchmark repository required for this example.
ln -s $FMRBENCHMARK/domains/integrator_chains/dynamaestro ln -s $FMRBENCHMARK/examples/sci_concrete_examples
Build and install it within the catkin workspace.
cd .. catkin_make install
Because the installation is local to the catkin workspace, before beginning and whenever a new shell session is created, you must first
To initiate the performance of a collection of trials defined by the
mc-small-out3-order3.json in the ROS package
sci_concrete_examples of example controllers,
$FMRBENCHMARK/domains/integrator_chains/trial-runner.py -l -f mydata.json src/sci_concrete_examples/trialconf/mc-small-out3-order3.json
This will cause trial data to be saved to the file
mydata.json in the local
directory from where the above command is executed. A description of options can
be obtained from
In a separate terminal, run the example controller using:
roslaunch sci_concrete_examples lqr.launch
You can observe the sequence of states and control inputs using
rostopic echo input, respectively. At each time increment, the
state labeling is published to the topic
/dynamaestro/loutput as an array of
strings (labels) corresponding to the polytopes containing the output at that
Because we used the
-l flag when invoking
trial-runner.py above, two
additional topics are available. The labeling without repetition is published to
“/logger/loutput_norep”, and several elements (up to 3) of the state vector are
published to “/logger/state_PointStamped” as a PointStamped message, which can
be viewed in rviz.
Once all trials have completed, the trial data can be examined using
tdstat.py. E.g., to get a summary about the data for each trial,
$FMRBENCHMARK/domains/integrator_chains/analysis/tdstat.py -s mydata.json
To get the labeling of the trajectory for trial 0, modulo repetition,
$FMRBENCHMARK/domains/integrator_chains/analysis/tdstat.py -t 0 --wordmodrep mydata.json
To get a description of options, try