Skip to content

Running ROSMonitoring in Docker

Rafael Cauê Cardoso edited this page Nov 7, 2021 · 1 revision

The first part of this tutorial includes describes the requirements and instructions on how to obtain Docker and set up our ROSMonitoring image. The second part shows how to run our Docker image as well as applying ROSMonitoring to a case study with the Jackal robot in ROS/Gazebo.

First Part: Installing Docker

Requirements

  • Linux (tested on Ubuntu, any version)
  • NVIDIA graphics card (tested on dedicated graphics card)

Instructions

Second Part: Trying ROSMonitoring

Step by step to run the Jackal simulation with ROSMonitoring:

  1. Open a terminal and navigate to this repository
  2. Build the docker image: sudo ./build.sh (if scripts are not runnable: chmod +x script.sh)
  3. Run the docker image: sudo ./run.sh
  4. Launch the simulation: roslaunch jackal_gazebo jackal_world.launch config:=front_laser (n.b., the first time Gazebo will take a lot of time to prepare the world)
  5. On RViz click Set 2D Nav Goal and click somewhere not close to walls on the RViz map for the Jackal to start moving there
  6. Move inside ROSMonitoring folder: cd /catkin_ws/ROSMonitoring/
  7. Test the instrumentation process works:
    • cd generator/
    • ./generator --config_file tutorial.yaml
  8. If the previous command works, no error message should be printed on the terminal and the safety_distance.py monitor should be present in /catkin_ws/ROSMonitoring/src/
  9. Copy the entire monitor folder into the catkin workspace: cp -r /catkin_ws/ROSMonitoring/monitor/ /catkin_ws/src/
  10. Compile the catkin workspace:
  • cd /catkin_ws/
  • catkin_make
  1. Now both beginners_tutorial and monitor repositories are compiled and ready to be run
  2. Type docker ps and copy the id (will be a bunch of random numbers/characters)
  3. Open another terminal, and type: docker exec -it <container> bash (with <container> the image id of the container running rosmon-tutorial)
  4. In the new terminal, type:
  • cd ROSMonitoring/oracle/TLOracle/
  • geany safety_distance_property.py
  1. Inside gedit, paste the following code and save the file:
import oracle
PROPERTY = "once[0:3]{front_distance}"
predicates = dict(
    time = 0,
    front_distance = False
)
def abstract_message(message):
    if message['ranges'][360] >= 1:
        predicates['front_distance'] = True
    else:
        predicates['front_distance'] = False
    return predicates
  1. Run the oracle with the property just created: python3 oracle.py --online --discrete --port 8080 --property safety_distance_property
  2. Open another terminal, and type: docker exec -it <container> bash (with <container> the image id of the container running rosmon-tutorial)
  3. Inside the new terminal, type:
  • source devel/setup.bash
  • chmod +x /catkin_ws/src/monitor/src/*.py
  • roslaunch monitor run.launch
  1. Open another terminal, and type: docker exec -it <container> bash (with <container> the image id of the container running rosmon-tutorial)
  2. On the new terminal, type:
  • source devel/setup.bash
  • rostopic echo /safety_distance/monitor_verdict