This is the replication package of the paper TITLE on the reconfiguration of ROS 2 packages for energy efficiency.
Here is where we develop customized ROS 2 package (reconfros2) for orchestration and profiling.
For building the package, we use a Docker container:
docker-compose -f docker/compose/compose-ros-humble-nav2.yml up reconfros2
docker exec -it reconfros2_container bash
cd /ros-ws
source /opt/ros/humble/setup.bash
colcon buildYou can also simply push the changes to GitHub, which automatically builds the package. Then, you must pull the changes locally.
TBA -- GitHub Action
Setup a virtual environment for Python:
python3 -m venv ./venv
source .venv/bin/activateThen, install the dependencies:
pip3 install -r requirements.txtAnd generate the configurations from the list of possible parameter values (ONLY FIRST TIME):
cd config/
python3 gen_pairwise_confs.pyThen, the yaml files can be generated (ONLY FIRST TIME):
TBAAll the computation runs on Docker containers. Please, install Docker and Docker Compose. It is also important that you set you user to run docker rootless commands.
We keep services in separate compose files in the docker/compose folder. The *.yml files use the environment variable RL4GreenROS_PATH and GAZEBO_MODEL_PATH to build the project. It must be set in the .env file prior to starting the containers.
Make sure the paths exist fist. Then add your path to the variables like this: (You can find an example in the preconfigured file)
RL4GreenROS_PATH=<path_to_projectfolder>
GAZEBO_MODEL_PATH=<path_to_projectfolder>/models
Last, Rviz requires you to add X11-access for docker. You can do that with the following command:
$ xhost +local:root
$ xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f ~/.docker.xauth nmerge -
$ ls -l ~/.docker.xauth
$ xhost +local:rootTo run a specific service:
$ docker-compose -f <file.yml> up SERVICEExample of a complete run (run in three separate terminals):
Gazebo:
$ docker-compose -f docker/compose/compose-gazebo.yml up gazeboNav2:
$ docker-compose -f docker/compose/compose-nav2.yml up nav2RVIZ:
$ docker-compose -f docker/compose/compose-rviz.yml up rvizThis is a work around that helps you to run GUI from Docker containers. From Ubuntu 19, Xorg does not allow TCP connections by default, so we must enable it. Another point, when logging in, be sure to choose Xorg as window manager.
Then, follow the next steps:
- Edit the
/etc/X11/Xwrapper.configas the following:
#allowed_users=console
allowed_users=anybody
- In the
/usr/bin/Xorgfile, Xwrapper every commands should be like this:
exec "$basedir"/Xorg.wrap "$@" -listen tcp
- Restart Xorg:
sudo systemctl restart gdm- Allow any host to connect to Xorg (you can disable after experiments):
xhost +
xhost +si:localuser:rootNow, you can start GUI apps from your Docker containers. This is important to visually check everything is working accordingly. For the experiments, we set GUI mode off.
For running the experiments, you must have the robot-runner repository clonned and set the environment variable:
export RR_PATH='../robot-runner'We have some customized plugins in ...
The configurations are generated in folder config as YAML files.
All the experiment is set on the RR configuration file: ./exp-orchestration/RR-ReconfROS.py. The results are saved in the exp-orchestration/data folder.'
For this, run the following command:
...TBA