Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
74d8663
update changelog
mik-p Sep 23, 2025
7cf923e
merge system and cap level runner plugins into base package
mik-p Sep 23, 2025
69274e8
merge util package function, remove util package
mik-p Sep 23, 2025
be5d500
more doc for bond cache class
mik-p Sep 23, 2025
e2ef538
small fixes, add docs
mik-p Oct 1, 2025
c9d5b47
update msgs, adds connection and event codes
mik-p Oct 1, 2025
67d08f4
adjust message defs to suit event api
mik-p Dec 22, 2025
d2e77d1
doc, boilerplate for events
mik-p Jan 11, 2026
e563cc1
change connect serve to use connection not event message
mik-p Jan 13, 2026
bc4b300
update build with event package, remove external util and log packages
mik-p Jan 14, 2026
07e10fa
implement event system base classes
mik-p Jan 28, 2026
aee2f02
add bond/cap exists method to bond cache
mik-p Jan 28, 2026
0dca70b
add addtional publishable events for server events, fix event class i…
mik-p Jan 30, 2026
dea6c94
add some system event emissions on runner system changes
mik-p Feb 5, 2026
b1bda2f
update logging pattern in cap server, update add connection service e…
mik-p Feb 6, 2026
dfd05ab
update cap api, add connection service function, event subsystem inte…
mik-p Feb 6, 2026
a3e5871
implement updated runner base cache access and runner connection func…
mik-p Feb 6, 2026
3aa7bdf
updating runner base with node inheritance and event emission. fixing…
mik-p Feb 6, 2026
3bbe89c
stop exec in desctructor not duplicate
mik-p Feb 6, 2026
b210da7
fixes to func sigs to compile, add gen uuid function and lib compile …
mik-p Feb 9, 2026
e884f2d
remove wrong gen uuid, use event gen uuid helper
mik-p Feb 9, 2026
80dec2b
testing runner classes, integrate event node semantics, WIP WIP
mik-p Feb 9, 2026
1f34bb5
updated event_node with capability_options
KalanaRatnayake Feb 9, 2026
9c52422
resloved merge conflicts
KalanaRatnayake Feb 9, 2026
2c0246f
removed tinyxml2 from runner dependencies
KalanaRatnayake Feb 9, 2026
e1f9ded
wip
KalanaRatnayake Feb 9, 2026
149b44a
merge develop to refactor branch
mik-p Feb 10, 2026
bedf234
updated capabilities2_event, WIP capabilities2_runner and server
KalanaRatnayake Feb 10, 2026
2b2ac47
freezing work
KalanaRatnayake Feb 11, 2026
893cfdd
minor fix
KalanaRatnayake Feb 12, 2026
0f3c3b8
fixed most compile errors, removed tinyxml2 from runner dependencies …
KalanaRatnayake Feb 12, 2026
b0bfb75
fixed issues with events
KalanaRatnayake Feb 13, 2026
58b5b0a
Merge pull request #31 from CollaborativeRoboticsLab/refactor/testing
KalanaRatnayake Feb 13, 2026
38b883b
Merge pull request #32 from CollaborativeRoboticsLab/refactor/tinyxml/v1
KalanaRatnayake Feb 13, 2026
800997f
added support for unconverted parameters
KalanaRatnayake Feb 14, 2026
1b15a53
fixed runtime errors
KalanaRatnayake Feb 16, 2026
d3f68c3
added debug prints
KalanaRatnayake Feb 17, 2026
7198ab9
fixed issues in instancing capabilities to allow connections of same …
KalanaRatnayake Feb 17, 2026
88eb56f
added target-capability-instance-id to connection id to differentiate…
KalanaRatnayake Feb 17, 2026
e0413bb
tested and updated system runners
KalanaRatnayake Feb 17, 2026
a1649a9
improved the capability instance api
KalanaRatnayake Feb 17, 2026
736a0b3
Merge branch 'develop' into refactor/events/v1
KalanaRatnayake Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ RUN rosdep update
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc

# make sure folders exist
RUN mkdir -p ~/colcon_ws/src
WORKDIR /home/ubuntu/colcon_ws/src

RUN git clone https://github.com/CollaborativeRoboticsLab/capabilities2_test_suite.git
11 changes: 2 additions & 9 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@
"name": "capabilities2 jazzy base",
"dockerFile": "Dockerfile",
"remoteUser": "ubuntu",
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}"
},
"runArgs": [
"--privileged",
"--network=host"
],
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/colcon_ws/${localWorkspaceFolderBasename},type=bind",
"workspaceFolder": "/home/ubuntu/colcon_ws",
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.bash_history,target=/home/ubuntu/.bash_history,type=bind"
]
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/colcon_ws/src/${localWorkspaceFolderBasename},type=bind",
"workspaceFolder": "/home/ubuntu/colcon_ws"
}
18 changes: 17 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
- [x] BUG: escape db function variables
- [ ] close or change communication to launch proxy so that it can't be accessed from ros network
- [ ] BUG: fix issue with connecting to services and actions started using launch proxy

- [ ] Launch proxy does not work, maybe remove and note as future work, or suggest alternatives
- [x] add descriptions to packages with TODO in package.xml
- [ ] standardise trigger prototype
- [x] bump cmake min version to 3.16
- [ ] check thread safety for runner execution threads
- [ ] add note on threaded execution in base trigger function

## Features

Expand All @@ -17,3 +22,14 @@
- [ ] implement provider definition handling in runner
- [ ] move to established db handler lib
- [ ] better bt runner impl
- [ ] db traits: identifiable, modifiable, soft_deleteable, header, remappable, predicateable

## Refactoring

- [x] remove fan out project work
- [x] merge various system runners into base runner package
- [ ] custom logger needs to be removed
- [ ] events should be incorporated as core function
- [ ] server, runner base, api have event
- [ ] increment package versions
- [ ] interfaces and providers for cap caps
12 changes: 6 additions & 6 deletions capabilities2/package.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?xml version="1.0"?>
<package format="3">
<name>capabilities2</name>
<version>0.0.1</version>
<version>0.2.0</version>
<description>
meta-package for the capabilities2 interface
meta-package for the capabilities2 framework
</description>

<maintainer email="michael.pritchard@canberra.edu.au">Michael Pritchard</maintainer>
<maintainer email="mppritchard3@hotmail.com">mik-p</maintainer>
<maintainer email="kalana.ratnayakemudiyanselage@canberra.edu.au">Kalana Ratnayake</maintainer>

<author email="michael.pritchard@canberra.edu.au">Michael Pritchard</author>
<author email="kalana.ratnayakemudiyanselage@canberra.edu.au">Kalana Ratnayake</author>

<license>MIT</license>

<url type="repository">https://github.com/AIResearchLab/capabilities2</url>
<url type="repository">https://github.com/CollaborativeRoboticsLab/capabilities2</url>

<exec_depend>capabilities2_msgs</exec_depend>
<exec_depend>capabilities2_server</exec_depend>
<exec_depend>capabilities2_events</exec_depend>
<exec_depend>capabilities2_runner</exec_depend>
<exec_depend>capabilities2_launch_proxy</exec_depend>
<exec_depend>capabilities2_server</exec_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
64 changes: 64 additions & 0 deletions capabilities2_events/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 90
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping: {
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
}
54 changes: 54 additions & 0 deletions capabilities2_events/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.16)
project(capabilities2_events)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(capabilities2_msgs REQUIRED)

# uuid
find_package(PkgConfig)
pkg_check_modules(UUID REQUIRED uuid)

include_directories(include ${UUID_INCLUDE_DIRS})

# build library
add_library(${PROJECT_NAME} SHARED
src/uuid_generator.cpp
)

target_link_libraries(${PROJECT_NAME} ${UUID_LIBRARIES})

ament_target_dependencies(${PROJECT_NAME}
rclcpp
capabilities2_msgs
UUID
)

# install headers
install(DIRECTORY include/
DESTINATION include
)

# install library
install(TARGETS ${PROJECT_NAME}
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

ament_export_include_directories(include)
ament_export_dependencies(rclcpp capabilities2_msgs)
ament_export_libraries(${PROJECT_NAME})

ament_package()
132 changes: 132 additions & 0 deletions capabilities2_events/include/capabilities2_events/event_base.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#pragma once

#include <stdexcept>
#include <string>
#include <functional>

#include <rclcpp/rclcpp.hpp>
#include <capabilities2_events/event_parameters.hpp>
#include <capabilities2_msgs/msg/capability.hpp>
#include <capabilities2_msgs/msg/capability_event.hpp>
#include <capabilities2_msgs/msg/capability_event_code.hpp>

namespace capabilities2_events
{
/**
* @brief event exception
*
* Base class for event exceptions
*
*/
struct event_exception : public std::runtime_error
{
using std::runtime_error::runtime_error;

event_exception(const std::string& what) : std::runtime_error(what)
{
}

virtual const char* what() const noexcept override
{
return std::runtime_error::what();
}
};

/**
* @brief event base class
*
* Represents an event in the capabilities framework.
* An event can be triggered to notify other components
* about changes in running capability (runners) states.
*/
class EventBase
{
public:
typedef std::string capability_str_t;
typedef capabilities2_events::EventParameters parameter_t;
typedef std::string access_id_t;
typedef std::string target_instance_id_t;
typedef std::function<void(const access_id_t&, const capability_str_t&, const target_instance_id_t&, parameter_t)> event_callback_t;

public:
EventBase()
{
}

~EventBase() = default;

/**
* @brief emit an event
*
* an event emission uses a parameterised callback
* which lets loosely-coupled capabilities propogate state changes
* when a source capability emits an event to a target capability
*
* @param connection_id connection identifier (format: "bond_id/trigger_id")
* @param event_code type of event being emitted
* @param source source capability emitting the event
* @param target target capability receiving the event
* @param callback function to trigger target capability with (capability, parameters, bond_id, target_instance_id)
*/
virtual void emit(const std::string& connection_id, const uint8_t& event_code,
const capabilities2_msgs::msg::Capability& source,
const capabilities2_msgs::msg::Capability& target, event_callback_t callback)
{
// extract bond_id from connection_id (format: "bond_id/instance_id/target_instance_id")
size_t first_pos = connection_id.find('/');

std::string bond_id = (first_pos != std::string::npos) ? connection_id.substr(0, first_pos) : connection_id;

// do callback with bond_id for access control
if (callback)
{
callback(bond_id, target.capability, target.instance_id, capabilities2_events::EventParameters(target));
}
}

/**
* @brief on server ready event
*
* @param msg
*/
virtual void on_server_ready(const std::string& msg) = 0;

/**
* @brief on process launched event
*
* @param pid
*/
virtual void on_process_launched(const std::string& pid) = 0;

/**
* @brief on process terminated event
*
* @param pid
*/
virtual void on_process_terminated(const std::string& pid) = 0;

/**
* @brief on triggered event from server
*
* @param trigger_id
*/
virtual void on_triggered(const std::string& trigger_id) = 0;

/**
* @brief on connected event from server
*
* @param source
* @param target
*/
virtual void on_connected(const std::string& source, const std::string& target) = 0;

/**
* @brief on disconnected event from server
*
* @param source
* @param target
*/
virtual void on_disconnected(const std::string& source, const std::string& target) = 0;
};

} // namespace capabilities2_events
Loading