2. 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.

2.1. Preparations

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.

2.1.1. Dependencies

On Ubuntu, Eigen can be obtained by installing the “libeigen3-dev” deb package (https://packages.debian.org/jessie/libeigen3-dev).

2.1.2. Supplementary prerequisites

While not necessary to use the benchmark per se, supplemental objects including tools for visualizing and reviewing results and example solutions are provided. These have additional dependencies besides those that are required for the benchmark. In particular, plotp.py and tdstat.py 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:

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

2.2. Tutorial

In the below code, $FMRBENCHMARK is the absolute path to a copy of the fmrbenchmark repository on your machine.

2.2.1. Demonstrations of components

To build the “standalone” (i.e., independent of ROS) examples demonstrating various parts of this benchmark, go to the dynamaestro directory ($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 $FMRBENCHMARK/domains/integrator_chains/dynamaestro/examples/standalone/genproblem.cpp. The output is a problem instance in JSON. To visualize it, try

dynamaestro/build/genproblem | analysis/plotp.py -

from the directory $FMRBENCHMARK/domains/integrator_chains/.

2.2.2. Controller examples

Note that the example controller lqr.py requires the Python Control System Library (control) and a standard scientific Python stack including NumPy. Obtaining these is described above in the Section Preparations.

Create a catkin workspace.

mkdir -p integrators_workspace/src
cd integrators_workspace/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/integrator_chains_msgs
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

source install/setup.zsh

where the source command assumes that you are using the Z shell; try setup.bash if you use Bash. To initiate the performance of a collection of trials defined by the configuration file mc-small-out3-order3.json in the ROS package sci_concrete_examples of example controllers,

python $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 trial-runner.py -h.

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 state and 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 time.

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 check if the trajectory for trial 0 satisfies the corresponding reach-avoid specification:

$FMRBENCHMARK/domains/integrator_chains/analysis/tdstat.py -t 0 --checksat mydata.json

To get a description of options, try tdstat.py -h.