Skip to content

gssi-robotics/co-sleec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Operationalising Normative Rules in Autonomous Robotic Systems through Context-Oriented Programming

This is the replication paper for the paper Operationalising Normative Rules in Autonomous Robotic Systems through Context-Oriented Programming accepted at IJCAI 2026.

Reproducibility: This repository includes a dedicated reproducibility summary in REPRODUCIBILITY.md, following the IJCAI 2026 reproducibility guidelines.

DOI

Authors

This study has been designed, developed, and reported by the following investigators:

  • Roberto Casadei (University of Bologna, Italy)
  • Martina De Sanctis (Gran Sasso Science Institute, Italy)
  • Gianluca Filippone (Gran Sasso Science Institute, Italy)
  • Sara Pettinari (Gran Sasso Science Institute, Italy)
  • Gian Luca Scoccia (Gran Sasso Science Institute, Italy)
  • Nicolas Troquard (Gran Sasso Science Institute, Italy)

Cite this work

Casadei, R., De Sanctis M., Filippone, G., Pettinari S., Scoccia, G. L., & Troquard N. (2026). Operationalising Normative Rules in Autonomous Robotic Systems Through Context-Oriented Programming. 35th International Joint Conference on Artificial Intelligence.
@inproceedings{co-sleec,
    title = {Operationalising Normative Rules in Autonomous Robotic Systems Through Context-Oriented Programming},
    author = {Roberto Casadei and Martina De Sanctis and Gianluca Filippone and Sara Pettinari and Gian Luca Scoccia and Nicolas Troquard},
    booktitle = {35th International Joint Conference on Artificial Intelligence},
    year = {2026},
    doi = {}
}

Repository structure

towards-uncertainty-aware-bts
|   appendix.pdf                            # Appendix reporting formal aspects of the approach
|   README.md                               # This file
|   Dockerfile                              # Dockerfiler for running CO-SLEEC and experiments over Docker deployment
├---experiments                             # Folder containing experiment facilities and results
|   |   run_test.sh                         # Test cases runner
|   |   test_cases_generator.py             # Test cases generator
|   ├---results
|   |   |   analysis.ibynb                      # Jupyter Notebook for the experiment results analyis
|   |   |   c0_trigger_dataset_build.ipynb      # Jupyter Notebook for the trigger dataset build
|   |   |   complete_dataset_build.ipynb        # Jupyter Notebook for the complete dataset build
|   |   |   executed_obligation_dataset_build.ipynb        # Jupyter Notebook for the executed obligation dataset build
|   |   ├---codebase_data                       # Codebase metrics data
|   |   ├---extracted_dataset                   # Elaborated datasets from raw logs collected during experimentation
|   |   └---raw_logs                            # Raw logs collected from experiments
|   └---test_cases                          # Folder containing test cases
├---libraries
|   ├---pysleec                             # pysleec library implementation
|   └---sleec4ros                           # sleec4ros library implementation
├---ros_ws                                  # ROS 2 workspace with RobEthiChor
|   └---src
|       ├---co_sleec                        # CO-SLEEC ROS 2 implementation
|       ├---cs_libs                         # CS-libs system variant implementation from the ablation study
|       ├---cs_libs_cm                      # CS-libs-CM system variant implementation from the ablation study
|       └---test_runner                     # Test runner ROS 2 module
└---scripts                                 # Folder containing scripts for robot interaction

Running CO-SLEEC

On Docker

Build and run the system

docker build -t cop-ros .
docker run -it --rm --name cop-ros cop-ros

Note

To run the system on a different variant implementation, launch the system passing the i environment value, e.g.:

docker run -it -e i=cs_libs --rm --name cop-ros cop-ros

or

docker run -it -e i=cs_libs_cm --rm --name cop-ros cop-ros

Note

To configure the agent to consider domain-related SLEEC rules, launch the system passing the domain parameter, e.g.:

docker run -it -e domain=hospital --rm --name cop-ros cop-ros

or

docker run -it -e domain=house --rm --name cop-ros cop-ros

Interact:

On a new terminal:

docker exec -it cop-ros bash

Sending open curtain command:

./open_curtains.sh

Sending human fallen alert:

./human_fallen.sh

Updating conditions:

./condition_update.sh <condition> <value> [<condition> <value>]

Updating domain:

./domain_update.sh <domain-name>

Or run the interactive mission manager:

source /opt/ros/humble/setup.bash
. install/setup.bash
ros2 run co_sleec interactive_mission_node

On a ROS2 environment

Note

This running setting requires ROS2 Humble. Follow the guide for installation and requirements info.

Build and run the system

Note

contextpy3 is required to run the application. Install through pip using pip install contextpy3

Install pysleec and sleec4roslibraries:

pip install libraries/pysleec/
pip install libraries/sleec4ros/

Build the ROS2 packages

cd ros2_ws
colcon build
. install/setup.bash
ros2 launch co_sleec co_sleec_launch.py

Note

To preconfigure the agent to consider domain-related SLEEC rules, launch the system passing the domain parameter, e.g.:

ros2 launch co_sleec co_sleec_launch.py domain:=house

or

ros2 launch co_sleec co_sleec_launch.py domain:=hospital

Note

To run the system over a variant of CO-SLEEC, a different launch file:

ros2 launch cs_libs cs_libs_launch.py [domain:=<house/hospital]

or

ros2 launch cs_libs_cm cs_libs_cm_launch.py [domain:=<house/hospital>]

Interact

On a new terminal:

cd scripts
chmod +x *.sh

Sending open curtain command:

./open_curtains.sh

Sending human fallen alert:

./human_fallen.sh

Updating conditions:

./condition_update.sh <condition> <value>

Updating domain:

./domain_update.sh <domain-name>

Or run the interactive mission manager:

. install/setup.bash
ros2 run co_sleec interactive_mission_node

Running the experiments

General instructions

  1. Generate the tast cases by running the test case generator: python3 test_cases_generator <test-name> (optional)
  2. Build and run the system as described in the previous sections
  3. On a new terminal, launch the test_runnernode: If on Docker:
docker exec -it cop-ros bash
source /opt/ros/humble/setup.bash
. install/setup.bash
cd experiments
./run_tests.sh <test-name>

If on ROS environment:

cd experiments
chmod +x run_tests.sh
./run_tests.sh <test-name>

Note

The test cases launched for the results discussed in the paper are in the ijcai_100.json file. To replicate the results, launch them with ./run_tests.sh ijcai_100 command.

  1. Collect the logs from the ./ros/log folder and place in the raw_logs folder, by naming them in the following format: <deployment_name>_deployment.log for the log files from the system, <experiment_name>_deployment_publisher.log for the log files from the test runner. <deployment_name> has to encode the name of the deployment/variant selected for the experiment (e.g., co_sleec, cs-libs, cs-libs_cm).

Note

Copy the logs from Docker or a robot running CO-SLEEC to a local machine.

  1. Run the Python notebooks to elaborate data, in the following order:
    1. c0_trigger_dataset_build.ipynb: it will geneerate the c0_trigger_dataset.csv file inside the extracted_datasets folder, containing the timestamp of the trigger occurence and the expected obligation;
    2. executed_obligations_dataset_build.ipynb: it will generate the executed_obligations_dataset.csv inside the extracted_datasets folder, containing the timestamp of the obligations occurrences;
    3. complete_dataset_build.ipynb: it will generate the complete_results_dataset.csv inside the extracted_datasets folder, containing the data of the full execution of the experiment;
    4. analysis.ipynb: it analyses the dataset and outputs all the computed statistics (see the results analysis section for details).

Replicating paper experiments

The following schema reports the experimentation setting used in the paper:

experimentation-setting

The results were obtained by running the ijcai_100 test case on the three system varians contained in this replication package.

The Test Runner node was deployed on a Dell Precision workstation equipped with an Intel Xeon W5 and running Ubuntu 22.04 running Ubuntu 22.04 and ROS2 Humble, while, co_sleec, cs-libs, and cs-libs-cm was run over a Turtlebot 4.

Step-by-step guide

  1. Download or clone the repository on a local computer equipped with ROS2 Humble
  2. Copy the ros2_ws folder on the Turtlebot's Raspberry Pi
  3. Install pysleec and sleec4roslibraries (ssh to the Turtlebot's Raspberry if needed):
    pip install libraries/pysleec/
    pip install libraries/sleec4ros/
    
  4. Build the ROS2 packages
    cd ros2_ws
    colcon build
    . install/setup.bash
    
  5. Run CO-SLEEC:
    ros2 launch co_sleec co_sleec_launch.py
    

Important

The steps 5-8 must be repeated three times according to the ablation study's system variants.

To run the system variants, run ros2 launch cs_libs cs_libs_launch.py for CS-libs, or ros2 launch cs_libs_cm cs_libs_cm_launch.py for CS-libs-CM

  1. Run the Test Runner over a local computer equipped with ROS2 Humble and connected to the same Turtlebot network:

    cd experiments
    chmod +x run_tests.sh
    ./run_tests.sh ijcai_100
    
  2. Collect the results from both the Turltebot's and the computer's .ros/logs folders:

    1. From the Turtlebot, rename into <co_sleec/cs-libs/cs-libs_cm>_deployment.log and place into the raw_logs folder
    2. From the computer running the Test Runner, rename into <co_sleec/cs-libs/cs-libs_cm>_deployment_publisher.log and place into the raw_logs folder
  3. Run the notebooks as in the general instructions.

Experiment results

The file analysis.ipynb contains the results of the experiments.

Note

The output of the performed experiments is already in the file. There is no need to run it again to see them (as long as new datasets are acquired by running again the experiments).

It features:

  • Comparison of the overhead across CO-SLEEC and the two system variants

    Overhead per deployment type (data in ms)

    Deployment count mean std. dev. min 25% 50% 75% max
    CO-SLEEC 800.0 4.807696 1.008411 3.194094 4.100323 4.598498 5.302668 11.947155
    CS-libs 800.0 4.687979 0.962291 3.106594 4.009664 4.503369 5.128801 10.370493
    CS-libs-CM 792.0 4.630744 0.897613 3.074408 3.975868 4.485369 5.070746 10.803699

    overhead

  • MahnMann-Whitney values for comparison of the results across CO-SLEEC and the two variants

    Compared deployment U statistic p-value
    CS-libs 342679.5 0.01411563670595782
    CS-libs-CM 346855.0 0.001048932213188354
  • Cliff's Delta values for comparison of the results across CO-SLEEC and the two variants

    Compared deployment Cliff's Delta effect size
    CS-libs 0.0708734375 negligible
    CS-libs-CM 0.0948705808 negligible
  • Analysis of the codebases data across the three variants.

    Metric CO-SLEEC CS-libs CS-libs-CM
    Total python codelines 481 524 508
    Lines per sleec implementation 4 11 11
    Files involved into sleec implementation 1 2 1
    Lines per sleec update (hedge clause update) 0 4 6

    codelines

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors