Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
25d1f48
updated runners in all packages in capabilities2_runner, capabilties2…
KalanaRatnayake Oct 4, 2024
73fa26b
Merge branch 'capabilities2-server-fabric' of https://github.com/AIRe…
KalanaRatnayake Oct 4, 2024
2ebac9e
added progress so sar
KalanaRatnayake Oct 7, 2024
8f74fc5
updated executor and runners
KalanaRatnayake Oct 17, 2024
9257b16
updated capabilities_server basic functionality
KalanaRatnayake Oct 22, 2024
6f7e8ea
completed updating capabilities server
KalanaRatnayake Oct 23, 2024
a1c2db5
added topic runner and service runner
KalanaRatnayake Oct 24, 2024
96480d3
added robotpose_runner and occupancygrid_runner
KalanaRatnayake Oct 25, 2024
e96802c
added yaml files for capabilities2_runner_nav2 package
KalanaRatnayake Oct 28, 2024
9c9c11e
started working on the capabilities2_runner_prompt
KalanaRatnayake Oct 28, 2024
b253767
added eleborated yaml and tinyxml snippetes
KalanaRatnayake Oct 28, 2024
3221221
minorfixes
KalanaRatnayake Oct 29, 2024
ff884f7
merged develop and resloved conflicts
KalanaRatnayake Oct 29, 2024
c33a2fd
fixed sql safety issue
KalanaRatnayake Oct 29, 2024
de45b17
tested sql safety complete
KalanaRatnayake Oct 29, 2024
3d8c35a
updated interface files
KalanaRatnayake Oct 29, 2024
23e41cd
added launch runners that start respective stacks
KalanaRatnayake Oct 29, 2024
15eb224
renamed launch runners
KalanaRatnayake Oct 30, 2024
a53df36
refactored code
KalanaRatnayake Nov 4, 2024
0270905
added and modifiled prompt_plan_x_runners
KalanaRatnayake Nov 6, 2024
281c3b5
improved interface descriptions
KalanaRatnayake Nov 7, 2024
699f371
minor corrections and modifications to capabilities2_executor with la…
KalanaRatnayake Nov 7, 2024
fb4adfb
launch issue fixed on capabilities2_executor
KalanaRatnayake Nov 10, 2024
4311aaf
moved capabilities2_fabric functionality to a seperate package with t…
KalanaRatnayake Nov 11, 2024
00a832a
improved documentation
KalanaRatnayake Nov 11, 2024
e6a3a45
improved the capability discovery via package.xml not have specific p…
KalanaRatnayake Nov 11, 2024
a6bd1b3
minor fix
KalanaRatnayake Nov 11, 2024
7ace6bc
work-in-progress commit. rewrote fabric to work asynchronously but mu…
KalanaRatnayake Nov 13, 2024
d929917
updated provider names and ffixes to fabric
KalanaRatnayake Nov 13, 2024
d12f37d
bug fixing complete on capabilities2_fabric
KalanaRatnayake Nov 13, 2024
43f2b42
updated lambda functions of runners in capabilities2_runner package. …
KalanaRatnayake Nov 13, 2024
301d29e
minor modifications
KalanaRatnayake Nov 14, 2024
a50ea25
rollback
KalanaRatnayake Nov 14, 2024
528dd17
minor fix
KalanaRatnayake Nov 15, 2024
713373e
worksssss without launch proxy
KalanaRatnayake Nov 15, 2024
02c3fa4
added standalone launch_runner inheriting from runner_base
KalanaRatnayake Nov 17, 2024
34cdf98
added docker image
KalanaRatnayake Nov 18, 2024
01faad9
added docker file
KalanaRatnayake Nov 18, 2024
c982eec
Update setup.md
KalanaRatnayake Nov 19, 2024
3f56fe8
Update CMakeLists.txt
KalanaRatnayake Nov 19, 2024
74dd472
Update CMakeLists.txt
KalanaRatnayake Nov 19, 2024
b47de03
Update CMakeLists.txt
KalanaRatnayake Nov 19, 2024
e2ad7df
Update CMakeLists.txt
KalanaRatnayake Nov 19, 2024
bc46b27
Update CMakeLists.txt
KalanaRatnayake Nov 19, 2024
b6945ac
Update CMakeLists.txt
KalanaRatnayake Nov 19, 2024
315c04d
fixed race conditions in capabilities2_fabric
KalanaRatnayake Nov 19, 2024
4363822
updated launch runner
KalanaRatnayake Nov 19, 2024
14fe880
added seperate launch for launch files
KalanaRatnayake Nov 19, 2024
e9777ea
added launch package in python
KalanaRatnayake Nov 19, 2024
89f87e8
minor change
KalanaRatnayake Nov 19, 2024
03e6ca2
added user name and password
KalanaRatnayake Nov 20, 2024
b4c980b
added user name and password
KalanaRatnayake Nov 20, 2024
cf81a02
added user name and password
KalanaRatnayake Nov 20, 2024
1fd3d17
minor fix
KalanaRatnayake Nov 20, 2024
72b6893
minor fix
KalanaRatnayake Nov 20, 2024
954c163
minor fix
KalanaRatnayake Nov 21, 2024
3e96884
added navstack launch to the main launch file as launching from launc…
KalanaRatnayake Nov 29, 2024
dfe616a
minor fixes
KalanaRatnayake Nov 29, 2024
e9b1acd
added gdb and xterm
KalanaRatnayake Nov 29, 2024
6694d25
Update setup_with_dev.md
KalanaRatnayake Dec 1, 2024
07c0489
Update setup_with_dev.md
KalanaRatnayake Dec 1, 2024
4df5be5
minor fixes
KalanaRatnayake Dec 2, 2024
ae16ac7
Merge branch 'capabilities2-server-fabric' of https://github.com/Coll…
KalanaRatnayake Dec 2, 2024
bf457f3
work in progress
KalanaRatnayake Dec 8, 2024
f28eb69
work-in-progress
KalanaRatnayake Jan 1, 2025
d02a4ab
updated codebase for review. still in progress
KalanaRatnayake Jan 7, 2025
7b197a0
updated plans
KalanaRatnayake Jan 7, 2025
ebca92d
minor fixes
KalanaRatnayake Jan 7, 2025
225db11
minor fixes
KalanaRatnayake Jan 8, 2025
5e97907
added succeed action server component to fabric
KalanaRatnayake Jan 9, 2025
330a7e5
added feedback to information
KalanaRatnayake Jan 9, 2025
2d4db85
added con-composable node
KalanaRatnayake Jan 10, 2025
07acc1f
fixed statetransition error
KalanaRatnayake Jan 12, 2025
28fac04
refactored the fabric code
KalanaRatnayake Jan 13, 2025
7278cee
Merge pull request #8 from CollaborativeRoboticsLab/remove-container
KalanaRatnayake Jan 13, 2025
6297a73
minor fixes
KalanaRatnayake Jan 14, 2025
3bd2e9d
completed threading implementation and tested sequential triggering
KalanaRatnayake Jan 15, 2025
541895b
completed testing of thread based fabric triggering using nav2 stack
KalanaRatnayake Jan 16, 2025
5af3992
resolved the issues
KalanaRatnayake Jan 16, 2025
a6627f3
Merge pull request #9 from CollaborativeRoboticsLab/adding-threads-to…
KalanaRatnayake Jan 16, 2025
375c30f
added lauunch proxy issue as a to-do taks
KalanaRatnayake Jan 16, 2025
4f759e4
refactored code
KalanaRatnayake Jan 26, 2025
588051f
refactored code and added status publishing
KalanaRatnayake Jan 27, 2025
cb7aeb1
added server interface for interacting with capabilities2_fabric via …
KalanaRatnayake Jan 27, 2025
c534de9
Added composable launch to capabilities2 fabric
KalanaRatnayake Jan 27, 2025
85f3791
started improving the events publishing system of capabilities2 server
KalanaRatnayake Jan 28, 2025
0fed03e
improved event publishing structure of capabilities2 server
KalanaRatnayake Feb 3, 2025
20bb080
Merge pull request #10 from CollaborativeRoboticsLab/adding-server-in…
KalanaRatnayake Feb 3, 2025
ae618e8
added capabilities_runners. integration not finished
KalanaRatnayake Feb 3, 2025
d5882fb
restored fabric to original and modified fabric client with completio…
KalanaRatnayake Feb 4, 2025
3749b53
fixed issues in the recursive functions used for extracting connectio…
KalanaRatnayake Feb 5, 2025
43bf4fa
added more runner for capabilities
KalanaRatnayake Feb 8, 2025
76e3f8f
updated various capabilities
KalanaRatnayake Feb 10, 2025
52c14df
completed prompt tools runner implementations
KalanaRatnayake Feb 10, 2025
944c90d
added new examples and sample cases for prompting
KalanaRatnayake Feb 10, 2025
819bf90
removed streaming option from prompt_runner commands as prompt_tools …
KalanaRatnayake Feb 11, 2025
24d178e
updated incorrect plugin.xml files
KalanaRatnayake Feb 12, 2025
10c5809
minor update to xml commands
KalanaRatnayake Feb 15, 2025
de0ac6c
successfully tested prompt_2.xml
KalanaRatnayake Feb 17, 2025
dbf7637
modified topic runner
KalanaRatnayake Feb 18, 2025
932fb51
added tf2 listnenr instead of subscribing to pose topic in robotpose_…
KalanaRatnayake Feb 18, 2025
89e7872
tested the robotpose_runner
KalanaRatnayake Feb 19, 2025
306153a
minor changes to plan generation
KalanaRatnayake Feb 25, 2025
5e83c88
updated prompt_runners to match prompt_tools modifications
KalanaRatnayake Feb 25, 2025
d782d51
minor modifications
KalanaRatnayake Feb 26, 2025
41a5a43
Merge pull request #12 from CollaborativeRoboticsLab/prompt-tools-tes…
KalanaRatnayake Feb 28, 2025
d7369ab
completed prompt-testing
KalanaRatnayake Mar 9, 2025
b9cee74
Merge pull request #13 from CollaborativeRoboticsLab/capabilities2-se…
KalanaRatnayake Mar 9, 2025
c0bed5f
Update readme.md
KalanaRatnayake Mar 28, 2025
5fa7fd0
added paper citation
KalanaRatnayake Apr 23, 2025
032da52
resolved tinyxml2 to use ros-provided version using tinyxml2-vendor p…
KalanaRatnayake Apr 28, 2025
4f4d080
Merge pull request #21 from CollaborativeRoboticsLab/tinyxml2-fix
KalanaRatnayake Apr 29, 2025
973efc2
moved event publishing related functionality to a new package and a h…
KalanaRatnayake Apr 29, 2025
553f4ea
[In progress] revamping event system
KalanaRatnayake Apr 30, 2025
bd8cc73
added event listener for debugging purposes
KalanaRatnayake May 6, 2025
66e7505
updated event msg structure
KalanaRatnayake May 6, 2025
f0a5ea9
completed event system testing
KalanaRatnayake May 7, 2025
bf0b45e
Merge pull request #22 from CollaborativeRoboticsLab/fix-event-publish
KalanaRatnayake May 7, 2025
d562129
moved fabric related functionality to a new repo
KalanaRatnayake May 7, 2025
d90596b
updated documentation
KalanaRatnayake May 7, 2025
0e975f5
tested
KalanaRatnayake May 7, 2025
c01d713
Merge pull request #25 from CollaborativeRoboticsLab/seperate-fabric
KalanaRatnayake May 7, 2025
25f7371
added foxglove dependencies and information
KalanaRatnayake May 7, 2025
9bd6059
minor modifications
KalanaRatnayake May 9, 2025
49d74b6
minor change
KalanaRatnayake May 11, 2025
b7b730f
minor updates to capabilities
KalanaRatnayake May 13, 2025
9226e6f
updated maintainer information
KalanaRatnayake May 15, 2025
adaee64
extended capability event functionality to support graph visualization
KalanaRatnayake Jun 20, 2025
6d48948
moved events into a new independent package for better integration
KalanaRatnayake Jul 3, 2025
ff72cf9
minor fix
KalanaRatnayake Jul 7, 2025
fdd8cfa
minor update
KalanaRatnayake Jul 18, 2025
b99a678
Merge pull request #26 from CollaborativeRoboticsLab/mod/ros-bridge-i…
KalanaRatnayake Aug 6, 2025
f7c804e
updated syntax on fabric xml
KalanaRatnayake Aug 6, 2025
ad29b27
added new multiplexer runners
KalanaRatnayake Aug 12, 2025
23cbb27
updated capabilities2 server backend and refactored runners
KalanaRatnayake Aug 13, 2025
dd7e5d7
minor modifiations after testing
KalanaRatnayake Aug 15, 2025
4657c75
updated event system to be compatible with multiplexing runners used …
KalanaRatnayake Aug 17, 2025
6a44873
redundant parameter cleaning
KalanaRatnayake Aug 17, 2025
8744271
Merge pull request #27 from CollaborativeRoboticsLab/fix/fix-control-…
KalanaRatnayake Aug 17, 2025
730f5f9
moved capability interfaces,providers and semantic interfaces together
KalanaRatnayake Aug 22, 2025
c554ebf
updated documentation
KalanaRatnayake Aug 22, 2025
92662a2
minor fixes
KalanaRatnayake Aug 22, 2025
27893bc
fixes to match code refactoring
KalanaRatnayake Aug 23, 2025
201b905
minor fixes after refactoring
KalanaRatnayake Aug 23, 2025
eed9d1c
Merge pull request #29 from CollaborativeRoboticsLab/fix/restructuting
KalanaRatnayake Aug 24, 2025
4e1f8eb
minor readme fix
KalanaRatnayake Sep 15, 2025
e09cfa0
clean up older docs, remove some fanout, WIP
mik-p Sep 23, 2025
086c066
revert launch naming convention for server
mik-p Sep 23, 2025
116baac
re-implement event system messages, upgraded for cap-connection feature
mik-p Sep 23, 2025
2008f3c
small fix to provider, docs for models, and model feature roadmap in …
mik-p Sep 23, 2025
47de0f1
bump cmake in msg
mik-p Sep 23, 2025
32d334c
bump cmake in meta
mik-p Sep 23, 2025
f5ef8b4
update main readme
mik-p Sep 23, 2025
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
2dfa4f8
added humble devcontainer alongside jazzy
KalanaRatnayake Nov 18, 2025
39c93a2
added humble devcontainer alongside jazzy
KalanaRatnayake Nov 18, 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
e531ed1
merge develop divergence, add humble devcontainers
mik-p Feb 10, 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
c528f21
a bit of refactoring to reduce the name length
KalanaRatnayake Feb 11, 2026
f7d114d
minor updates
KalanaRatnayake Feb 11, 2026
d548a4d
minor fix
KalanaRatnayake Feb 11, 2026
7215b29
minor fix
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
30da9b7
Merge pull request #33 from CollaborativeRoboticsLab/refactor/events/v1
mik-p Feb 20, 2026
15986f9
removed redundant package. THis was merged into capabilties2_runner p…
KalanaRatnayake Feb 20, 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
@@ -1,17 +1,10 @@
{
"name": "jazzy base",
"name": "capabilities2 jazzy base",
"dockerFile": "Dockerfile",
"remoteUser": "ubuntu",
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}"
},
"runArgs": [
"--privileged",
"--network=host"
],
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/colcon_ws/src/${localWorkspaceFolderBasename},type=bind",
"workspaceFolder": "/home/ubuntu/colcon_ws",
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.bash_history,target=/home/ubuntu/.bash_history,type=bind"
]
"workspaceFolder": "/home/ubuntu/colcon_ws"
}
30 changes: 30 additions & 0 deletions .devcontainer/humble/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM ros:humble

# Add vscode user with same UID and GID as your host system
# (modified from https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user)
# ubuntu now has a 1000 user ubuntu
ARG USERNAME=ubuntu
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME

RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y \
sudo \
git \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# Switch from root to user
USER $USERNAME

# Rosdep update
RUN rosdep update

# Source the ROS setup file
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc

# make sure folders exist
RUN mkdir -p ~/colcon_ws/src
17 changes: 17 additions & 0 deletions .devcontainer/humble/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "humble base",
"dockerFile": "Dockerfile",
"remoteUser": "ubuntu",
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}"
},
"runArgs": [
"--privileged",
"--network=host"
],
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/colcon_ws/src/${localWorkspaceFolderBasename},type=bind",
"workspaceFolder": "/home/ubuntu/colcon_ws",
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.bash_history,target=/home/ubuntu/.bash_history,type=bind"
]
}
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Michael Pritchard
Thomas Muller-dardelin
Kalana Rathnayake
Buddhi Gamage
Buddhi Gamage
26 changes: 22 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,32 @@

- [x] names need to be in package/name format everywhere
- [x] better docs
- [ ] BUG: escape db function variables
- [x] BUG: handle "'" in db queries
- [x] BUG: escape db function variables
- [ ] close or change communication to launch proxy so that it can't be accessed from ros network
- [ ] BUG: handle "'" in db queries
- [ ] 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

- [x] try using ros package to find exports automatically
- [x] improve the event system
- [ ] implement provider definition handling in runner
- [ ] try using ros package to find exports automatically
- [ ] improve the event system
- [ ] 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
2 changes: 1 addition & 1 deletion capabilities2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.16)
project(capabilities2)
find_package(ament_cmake REQUIRED)
ament_package()
13 changes: 7 additions & 6 deletions capabilities2/package.xml
Original file line number Diff line number Diff line change
@@ -1,24 +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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(capabilities2_runner_audio)
cmake_minimum_required(VERSION 3.16)
project(capabilities2_events)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
Expand All @@ -13,50 +13,42 @@ endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(pluginlib REQUIRED)
find_package(hri_audio_msgs REQUIRED)
find_package(capabilities2_msgs REQUIRED)
find_package(capabilities2_runner REQUIRED)

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

include_directories(include
${TINYXML2_INCLUDE_DIRS}
)
include_directories(include ${UUID_INCLUDE_DIRS})

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

target_link_libraries(${PROJECT_NAME}
${TINYXML2_LIBRARIES}
)
target_link_libraries(${PROJECT_NAME} ${UUID_LIBRARIES})

ament_target_dependencies(${PROJECT_NAME}
rclcpp
rclcpp_action
pluginlib
hri_audio_msgs
capabilities2_msgs
capabilities2_runner
TINYXML2
UUID
)

pluginlib_export_plugin_description_file(${PROJECT_NAME} plugins.xml)
# install headers
install(DIRECTORY include/
DESTINATION include
)

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

install(DIRECTORY include/
DESTINATION include
)

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