-
Notifications
You must be signed in to change notification settings - Fork 7
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.
- Linux (tested on Ubuntu, any version)
- NVIDIA graphics card (tested on dedicated graphics card)
- Install Docker, stop at ``Setting up NVIDIA Container Toolkit'' (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html\#docker)
- Install proprietary graphics card driver only if you don't already have one, you can check in the Software & Updates under the Additional Drivers tab (https://www.nvidia.com/Download/index.aspx?lang=en-us)
- Install Docker NVIDIA, make sure the test at the end works (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html\#setting-up-nvidia-container-toolkit)
- Open a terminal and run:
docker run angeloferrando/rosmonitoring-tutorial
- Download the script run.sh (https://drive.google.com/file/d/1i96qTUfn2bpV330ItALNyhmqwbyAJc6R/view?usp=sharing)
- Change permission:
chmod +x run.sh
- Run the script with
./run.sh
, if it works you should be inside the container's terminal, otherwise if it is taking too long, cancel (ctrl+c) and try the command again
- Open a terminal and navigate to this repository
- Build the docker image:
sudo ./build.sh
(if scripts are not runnable:chmod +x script.sh
) - Run the docker image:
sudo ./run.sh
- 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) - 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
- Move inside ROSMonitoring folder:
cd /catkin_ws/ROSMonitoring/
- Test the instrumentation process works:
cd generator/
./generator --config_file tutorial.yaml
- 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/
- Copy the entire monitor folder into the catkin workspace:
cp -r /catkin_ws/ROSMonitoring/monitor/ /catkin_ws/src/
- Compile the catkin workspace:
cd /catkin_ws/
catkin_make
- Now both beginners_tutorial and monitor repositories are compiled and ready to be run
- Type
docker ps
and copy the id (will be a bunch of random numbers/characters) - Open another terminal, and type:
docker exec -it <container> bash
(with<container>
the image id of the container running rosmon-tutorial) - In the new terminal, type:
cd ROSMonitoring/oracle/TLOracle/
geany safety_distance_property.py
- 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
- Run the oracle with the property just created:
python3 oracle.py --online --discrete --port 8080 --property safety_distance_property
- Open another terminal, and type:
docker exec -it <container> bash
(with<container>
the image id of the container running rosmon-tutorial) - Inside the new terminal, type:
source devel/setup.bash
chmod +x /catkin_ws/src/monitor/src/*.py
roslaunch monitor run.launch
- Open another terminal, and type:
docker exec -it <container> bash
(with<container>
the image id of the container running rosmon-tutorial) - On the new terminal, type:
source devel/setup.bash
rostopic echo /safety_distance/monitor_verdict