Repository Summary
Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
VCS Type | git |
VCS Version | humble |
Last Updated | 2024-09-28 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
README
SMACC2
SMACC2 is an event-driven, asynchronous, behavioral state machine library for real-time ROS 2 (Robotic Operating System) applications written in C++, designed to allow programmers to build robot control applications for multicomponent robots, in an intuitive and systematic manner.
SMACC was inspired by Harel’s statecharts and the SMACH ROS package. SMACC is built on top of the Boost StateChart library.
Repository Status, Packages and Documentation
ROS 2 Distro | Branch | Build status | Documentation | Released packages |
---|---|---|---|---|
Foxy | foxy |
|
Generated Doc |
SMACC2 |
Galactic | galactic |
|
Generated Doc |
SMACC2 |
Humble | humble |
|
Generated Doc |
SMACC2 |
Rolling | rolling |
|
Generated Doc |
NOTE: There are three build stages checking current and future compatibility of the package.
-
Binary builds - against released packages (main and testing) in ROS distributions. Shows that direct local build is possible.
Uses repos file:
src/SMACC2/.github/SMACC2-not-released.<ros-distro>.repos
-
Semi-binary builds - against released core ROS packages (main and testing), but the immediate dependencies are pulled from source. Shows that local build with dependencies is possible and if fails there we can expect that after the next package sync we will not be able to build.
Uses repos file:
src/SMACC2/.github/SMACC2.repos
-
Source build - also core ROS packages are build from source. It shows potential issues in the mid future.
Getting started - ROS Humble
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/humble_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/humble_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Humble branch:
cd ~/workspace/humble_ws/src/SMACC2
git checkout humble
- Navigate to the workspace:
cd ~/workspace/humble_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/humble/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/.github/SMACC2.humble.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Galactic
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/galactic_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/galactic_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Galactic branch:
cd ~/workspace/galactic_ws/src/SMACC2
git checkout galactic
- Navigate to the workspace:
cd ~/workspace/galactic_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/galactic/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/.github/SMACC2.galactic.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Foxy
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/foxy_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/foxy_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Foxy branch:
cd ~/workspace/foxy_ws/src/SMACC2
git checkout foxy
- Navigate to the workspace:
cd ~/workspace/foxy_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/foxy/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/.github/SMACC2.foxy.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Rolling
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/rolling_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/rolling_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Navigate to the workspace:
cd ~/workspace/rolling_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/rolling/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2-not-released.rolling.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Features
- Powered by ROS 2: SMACC2 has been developed specifically to work with ROS 2. It supports ROS 2 topics, services and actions, right out of the box.
- Written in C++: Until now, ROS 2 has lacked a library to develop task-level behavioral state machines in C++. Although libraries have been developed in scripting languages such as python, these are unsuitable for real-world industrial environments where real-time requirements are demanded.
- Orthogonals: Originally conceived by David Harel in 1987, orthogonality is absolutely crucial to developing state machines for complex robotic systems. This is because complex robots are always a collection of hardware devices which require communication protocols, start-up determinism, etc. With orthogonals, it is an intuitive and relatively straight forward exercise (at least conceptually;) to code a state machine for a robot comprising a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, for instance.
- Static State Machine Checking: One of the features that SMACC2 inherits from Boost Statechart is that you get compile time validation checking. This benefits developers in that the amount of runtime testing necessary to ship quality software that is both stable and safe is dramatically reduced. Our philosophy is “Wherever possible, let the compiler do it”.
- State Machine Reference Library: With a constantly growing library of out-of-the-box reference state machines, (found in the folder sm_reference_library) guaranteed to compile and run, you can jumpstart your development efforts by choosing a reference machine that is closest to your needs, and then customize and extend to meet the specific requirements of your robotic application. All the while knowing that the library supports advanced functionalities that are practically universal among actual working robots.
- SMACC2 Client Library: SMACC2 also features a constantly growing library of clients that support ROS 2 Action Servers, Service Servers and other nodes right out-of-the box. The clients within the SMACC2 Client library have been built utilizing a component based architecture that allows for developer to build powerful clients of their own. Current clients of note include MoveBaseZ, a full featured Action Client built to integrate with Nav2, the ros_timer_client, the multi_role_sensor_client, and a keyboard_client used extensively for state machine drafting & debugging.
- Extensive Documentation: Although many ROS users are familiar with doxygen, our development team has spent a lot of time researching the more advanced features of doxygen such as uml style class diagrams and call graphs, and we’ve used them to document the SMACC2 library. Have a look to our doxygen sites and we think you’ll be blown away at what Doxygen looks like when it’s done right and it becomes a powerful tool to research a codebase.
- SMACC2 Runtime Analyzer: The SMACC2 library works out of the box with the SMACC2 RTA. This allows developers to visualize and runtime debug the state machines they are working on. The SMACC2 RTA is closed source, but is free for individual and academic use. It can be found here.
Repository Structure
-
smacc2
- core library of SMACC2. -
smacc2_client_library
- client libraries for SMACC2, e.g., Navigation2 (nav2z_client
), MoveIt2 (moveit2z_client
). -
smacc2_event_generators
- … -
smacc2_msgs
- ROS 2 messages for SMACC2 framework. -
smacc2_sm_reference_library
- libraries with reference implementations of state-machines used for demonstaration and testing of functionalities. -
↓smacc2_state_reactor_library
- … -
smacc2_performance_tools
- …
SMACC2 applications
From it’s inception, SMACC2 was written to support the programming of multi-component, complex robots. If your project involves small, solar-powered insect robots, that simply navigate towards a light source, then SMACC2 might not be the right choice for you. But if you are trying to program a robot with a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, then you’ve come to the right place.
Run a State Machine
The easiest way to get started is by selecting one of the state machines in our reference library, and then hacking it to meet your needs.
Each state machine in the reference library comes with it’s own README.md file, which contains the appropriate operating instructions, so that all you have to do is simply copy & paste some commands into your terminal.
-
If you are looking for a minimal example, we recommend sm_atomic.
-
If you are looking for a minimal example but with a looping superstate, try sm_three_some.
-
If you want to get started with the ROS Navigation stack right away, try sm_dance_bot.
-
If you want to get started with ROS Navigation and exploring the orthogonal read-write cycle, then try sm_dance_bot_strikes_back.
Operating instructions can be found in each reference state machines readme file.
Writing your State Machines
There is a state machine generator in the reference library.
To use it go to the src
folder of your ROS 2 workspace and execute:
smacc2/smacc2_sm_reference_library/create-sm-package.bash <name_of_state_machine>
After than compile your workspace and source it to set paths of the new package.
Check README.md
in new package about instructions to start newly created state machine.
Happy Coding!
Support
If you are interested in getting involved or need a little support, feel free to contact us by emailing techsupport@robosoft.ai
CONTRIBUTING
Contributing Guidelines
Thank you for your interest in contributing to smacc2
.
Whether it’s a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn’t already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
- A reproducible test case or series of steps
- The version of our code being used
- Any modifications you’ve made relevant to the bug
- Anything unusual about your environment or deployment
Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
- Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
- Give your PR a descriptive title. Add a short summary, if required.
- Make sure the pipeline is green.
- Don’t be afraid to request reviews from maintainers.
- New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.
To send us a pull request, please:
- Fork the repository.
- Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
- Ensure local tests pass. (
colcon test
andpre-commit run -a
(requires you to install pre-commit bypip3 install pre-commit
) - Commit to your fork using clear commit messages.
- Send a pull request, answering any default questions in the pull request interface.
- Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional documentation on forking a repository and creating a pull request.
Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As this project, by default, uses the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ‘help wanted’ issues is a great place to start.
Licensing
Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
Repository Summary
Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2022-11-28 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
README
SMACC2
SMACC2 is an event-driven, asynchronous, behavioral state machine library for real-time ROS2 (Robotic Operating System) applications written in C++, designed to allow programmers to build robot control applications for multicomponent robots, in an intuitive and systematic manner.
SMACC was inspired by Harel’s statecharts and the SMACH ROS package. SMACC is built on top of the Boost StateChart library.
Repository Status, Packages and Documentation
ROS2 Distro | Branch | Build status | Documentation | Released packages |
---|---|---|---|---|
Foxy | foxy |
|
Generated Doc |
SMACC2 |
Galactic | galactic |
|
Generated Doc |
SMACC2 |
Rolling | rolling |
|
Generated Doc |
SMACC2 |
NOTE: There are three build stages checking current and future compatibility of the package.
-
Binary builds - against released packages (main and testing) in ROS distributions. Shows that direct local build is possible.
Uses repos file:
src/SMACC2/SMACC2-not-released.<ros-distro>.repos
-
Semi-binary builds - against released core ROS packages (main and testing), but the immediate dependencies are pulled from source. Shows that local build with dependencies is possible and if fails there we can expect that after the next package sync we will not be able to build.
Uses repos file:
src/SMACC2/SMACC2.repos
-
Source build - also core ROS packages are build from source. It shows potential issues in the mid future.
Getting started - ROS Rolling + Ubuntu 20.04 (Focal)
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/rolling_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/rolling_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Navigate to the workspace:
cd ~/workspace/rolling_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/rolling/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2-not-released.rolling.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Galactic
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/galactic_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/galactic_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Galactic branch:
cd ~/workspace/galactic_ws/src/SMACC2
git checkout galactic
- Navigate to the workspace:
cd ~/workspace/galactic_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/galactic/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2.galactic.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Foxy
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/foxy_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/foxy_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Foxy branch:
cd ~/workspace/foxy_ws/src/SMACC2
git checkout foxy
- Navigate to the workspace:
cd ~/workspace/foxy_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/foxy/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2.foxy.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Features
- Powered by ROS2: SMACC2 has been developed specifically to work with ROS2. It supports ROS2 topics, services and actions, right out of the box.
- Written in C++: Until now, ROS2 has lacked a library to develop task-level behavioral state machines in C++. Although libraries have been developed in scripting languages such as python, these are unsuitable for real-world industrial environments where real-time requirements are demanded.
- Orthogonals: Originally conceived by David Harel in 1987, orthogonality is absolutely crucial to developing state machines for complex robotic systems. This is because complex robots are always a collection of hardware devices which require communication protocols, start-up determinism, etc. With orthogonals, it is an intuitive and relatively straight forward exercise (at least conceptually;) to code a state machine for a robot comprising a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, for instance.
- Static State Machine Checking: One of the features that SMACC2 inherits from Boost Statechart is that you get compile time validation checking. This benefits developers in that the amount of runtime testing necessary to ship quality software that is both stable and safe is dramatically reduced. Our philosophy is “Wherever possible, let the compiler do it”.
- State Machine Reference Library: With a constantly growing library of out-of-the-box reference state machines, (found in the folder sm_reference_library) guaranteed to compile and run, you can jumpstart your development efforts by choosing a reference machine that is closest to your needs, and then customize and extend to meet the specific requirements of your robotic application. All the while knowing that the library supports advanced functionalities that are practically universal among actual working robots.
- SMACC2 Client Library: SMACC2 also features a constantly growing library of clients that support ROS2 Action Servers, Service Servers and other nodes right out-of-the box. The clients within the SMACC2 Client library have been built utilizing a component based architecture that allows for developer to build powerful clients of their own. Current clients of note include MoveBaseZ, a full featured Action Client built to integrate with Nav2, the ros_timer_client, the multi_role_sensor_client, and a keyboard_client used extensively for state machine drafting & debugging.
- Extensive Documentation: Although many ROS users are familiar with doxygen, our development team has spent a lot of time researching the more advanced features of doxygen such as uml style class diagrams and call graphs, and we’ve used them to document the SMACC2 library. Have a look to our doxygen sites and we think you’ll be blown away at what Doxygen looks like when it’s done right and it becomes a powerful tool to research a codebase.
- SMACC2 Runtime Analyzer: The SMACC2 library works out of the box with the SMACC2 RTA. This allows developers to visualize and runtime debug the state machines they are working on. The SMACC2 RTA is closed source, but is free for individual and academic use. It can be found here.
Repository Structure
-
smacc2
- core library of SMACC2. -
smacc2_ci
- … -
smacc2_client_library
- client libraries for SMACC2, e.g., Navigation2 (nav2z_client
), MoveIt2 (move_group_interface_client
). -
smacc2_event_generators
- … -
smacc2_msgs
- ROS2 messages for SMACC2 framework. -
smacc2_sm_reference_library
- libraries with reference implementations of state-machines used for demonstaration and testing of functionalities. -
↓smacc2_state_reactor_library
- … -
smacc2_performance_tools
- …
SMACC2 applications
From it’s inception, SMACC2 was written to support the programming of multi-component, complex robots. If your project involves small, solar-powered insect robots, that simply navigate towards a light source, then SMACC2 might not be the right choice for you. But if you are trying to program a robot with a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, then you’ve come to the right place.
Run a State Machine
The easiest way to get started is by selecting one of the state machines in our reference library, and then hacking it to meet your needs.
Each state machine in the reference library comes with it’s own README.md file, which contains the appropriate operating instructions, so that all you have to do is simply copy & paste some commands into your terminal.
-
If you are looking for a minimal example, we recommend sm_atomic.
-
If you are looking for a minimal example but with a looping superstate, try sm_three_some.
-
If you want to get started with the ROS Navigation stack right away, try sm_dance_bot.
-
If you want to get started with ROS Navigation and exploring the orthogonal read-write cycle, then try sm_dance_bot_strikes_back.
Operating instructions can be found in each reference state machines readme file.
Writing your State Machines
There is a state machine generator in the reference library.
To use it go to the src
folder of your ROS2 workspace and execute:
smacc2/smacc2_sm_reference_library/create-sm-package.bash <name_of_state_machine>
After than compile your workspace and source it to set paths of the new package.
Check README.md
in new package about instructions to start newly created state machine.
Happy Coding!
Support
If you are interested in getting involved or need a little support, feel free to contact us by emailing techsupport@robosoft.ai
CONTRIBUTING
Contributing Guidelines
Thank you for your interest in contributing to smacc
.
Whether it’s a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn’t already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
- A reproducible test case or series of steps
- The version of our code being used
- Any modifications you’ve made relevant to the bug
- Anything unusual about your environment or deployment
Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
- Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
- Give your PR a descriptive title. Add a short summary, if required.
- Make sure the pipeline is green.
- Don’t be afraid to request reviews from maintainers.
- New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.
To send us a pull request, please:
- Fork the repository.
- Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
- Ensure local tests pass. (
colcon test
andpre-commit run
(requires you to install pre-commit bypip3 install pre-commit
) - Commit to your fork using clear commit messages.
- Send a pull request, answering any default questions in the pull request interface.
- Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional documentation on forking a repository and creating a pull request.
Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As this project, by default, uses the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ‘help wanted’ issues is a great place to start.
Licensing
Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
Repository Summary
Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2022-11-28 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
README
SMACC2
SMACC2 is an event-driven, asynchronous, behavioral state machine library for real-time ROS2 (Robotic Operating System) applications written in C++, designed to allow programmers to build robot control applications for multicomponent robots, in an intuitive and systematic manner.
SMACC was inspired by Harel’s statecharts and the SMACH ROS package. SMACC is built on top of the Boost StateChart library.
Repository Status, Packages and Documentation
ROS2 Distro | Branch | Build status | Documentation | Released packages |
---|---|---|---|---|
Foxy | foxy |
|
Generated Doc |
SMACC2 |
Galactic | galactic |
|
Generated Doc |
SMACC2 |
Rolling | rolling |
|
Generated Doc |
SMACC2 |
NOTE: There are three build stages checking current and future compatibility of the package.
-
Binary builds - against released packages (main and testing) in ROS distributions. Shows that direct local build is possible.
Uses repos file:
src/SMACC2/SMACC2-not-released.<ros-distro>.repos
-
Semi-binary builds - against released core ROS packages (main and testing), but the immediate dependencies are pulled from source. Shows that local build with dependencies is possible and if fails there we can expect that after the next package sync we will not be able to build.
Uses repos file:
src/SMACC2/SMACC2.repos
-
Source build - also core ROS packages are build from source. It shows potential issues in the mid future.
Getting started - ROS Rolling + Ubuntu 20.04 (Focal)
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/rolling_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/rolling_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Navigate to the workspace:
cd ~/workspace/rolling_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/rolling/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2-not-released.rolling.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Galactic
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/galactic_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/galactic_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Galactic branch:
cd ~/workspace/galactic_ws/src/SMACC2
git checkout galactic
- Navigate to the workspace:
cd ~/workspace/galactic_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/galactic/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2.galactic.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Foxy
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/foxy_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/foxy_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Foxy branch:
cd ~/workspace/foxy_ws/src/SMACC2
git checkout foxy
- Navigate to the workspace:
cd ~/workspace/foxy_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/foxy/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2.foxy.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Features
- Powered by ROS2: SMACC2 has been developed specifically to work with ROS2. It supports ROS2 topics, services and actions, right out of the box.
- Written in C++: Until now, ROS2 has lacked a library to develop task-level behavioral state machines in C++. Although libraries have been developed in scripting languages such as python, these are unsuitable for real-world industrial environments where real-time requirements are demanded.
- Orthogonals: Originally conceived by David Harel in 1987, orthogonality is absolutely crucial to developing state machines for complex robotic systems. This is because complex robots are always a collection of hardware devices which require communication protocols, start-up determinism, etc. With orthogonals, it is an intuitive and relatively straight forward exercise (at least conceptually;) to code a state machine for a robot comprising a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, for instance.
- Static State Machine Checking: One of the features that SMACC2 inherits from Boost Statechart is that you get compile time validation checking. This benefits developers in that the amount of runtime testing necessary to ship quality software that is both stable and safe is dramatically reduced. Our philosophy is “Wherever possible, let the compiler do it”.
- State Machine Reference Library: With a constantly growing library of out-of-the-box reference state machines, (found in the folder sm_reference_library) guaranteed to compile and run, you can jumpstart your development efforts by choosing a reference machine that is closest to your needs, and then customize and extend to meet the specific requirements of your robotic application. All the while knowing that the library supports advanced functionalities that are practically universal among actual working robots.
- SMACC2 Client Library: SMACC2 also features a constantly growing library of clients that support ROS2 Action Servers, Service Servers and other nodes right out-of-the box. The clients within the SMACC2 Client library have been built utilizing a component based architecture that allows for developer to build powerful clients of their own. Current clients of note include MoveBaseZ, a full featured Action Client built to integrate with Nav2, the ros_timer_client, the multi_role_sensor_client, and a keyboard_client used extensively for state machine drafting & debugging.
- Extensive Documentation: Although many ROS users are familiar with doxygen, our development team has spent a lot of time researching the more advanced features of doxygen such as uml style class diagrams and call graphs, and we’ve used them to document the SMACC2 library. Have a look to our doxygen sites and we think you’ll be blown away at what Doxygen looks like when it’s done right and it becomes a powerful tool to research a codebase.
- SMACC2 Runtime Analyzer: The SMACC2 library works out of the box with the SMACC2 RTA. This allows developers to visualize and runtime debug the state machines they are working on. The SMACC2 RTA is closed source, but is free for individual and academic use. It can be found here.
Repository Structure
-
smacc2
- core library of SMACC2. -
smacc2_ci
- … -
smacc2_client_library
- client libraries for SMACC2, e.g., Navigation2 (nav2z_client
), MoveIt2 (move_group_interface_client
). -
smacc2_event_generators
- … -
smacc2_msgs
- ROS2 messages for SMACC2 framework. -
smacc2_sm_reference_library
- libraries with reference implementations of state-machines used for demonstaration and testing of functionalities. -
↓smacc2_state_reactor_library
- … -
smacc2_performance_tools
- …
SMACC2 applications
From it’s inception, SMACC2 was written to support the programming of multi-component, complex robots. If your project involves small, solar-powered insect robots, that simply navigate towards a light source, then SMACC2 might not be the right choice for you. But if you are trying to program a robot with a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, then you’ve come to the right place.
Run a State Machine
The easiest way to get started is by selecting one of the state machines in our reference library, and then hacking it to meet your needs.
Each state machine in the reference library comes with it’s own README.md file, which contains the appropriate operating instructions, so that all you have to do is simply copy & paste some commands into your terminal.
-
If you are looking for a minimal example, we recommend sm_atomic.
-
If you are looking for a minimal example but with a looping superstate, try sm_three_some.
-
If you want to get started with the ROS Navigation stack right away, try sm_dance_bot.
-
If you want to get started with ROS Navigation and exploring the orthogonal read-write cycle, then try sm_dance_bot_strikes_back.
Operating instructions can be found in each reference state machines readme file.
Writing your State Machines
There is a state machine generator in the reference library.
To use it go to the src
folder of your ROS2 workspace and execute:
smacc2/smacc2_sm_reference_library/create-sm-package.bash <name_of_state_machine>
After than compile your workspace and source it to set paths of the new package.
Check README.md
in new package about instructions to start newly created state machine.
Happy Coding!
Support
If you are interested in getting involved or need a little support, feel free to contact us by emailing techsupport@robosoft.ai
CONTRIBUTING
Contributing Guidelines
Thank you for your interest in contributing to smacc
.
Whether it’s a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn’t already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
- A reproducible test case or series of steps
- The version of our code being used
- Any modifications you’ve made relevant to the bug
- Anything unusual about your environment or deployment
Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
- Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
- Give your PR a descriptive title. Add a short summary, if required.
- Make sure the pipeline is green.
- Don’t be afraid to request reviews from maintainers.
- New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.
To send us a pull request, please:
- Fork the repository.
- Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
- Ensure local tests pass. (
colcon test
andpre-commit run
(requires you to install pre-commit bypip3 install pre-commit
) - Commit to your fork using clear commit messages.
- Send a pull request, answering any default questions in the pull request interface.
- Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional documentation on forking a repository and creating a pull request.
Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As this project, by default, uses the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ‘help wanted’ issues is a great place to start.
Licensing
Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
Repository Summary
Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2022-11-28 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
README
SMACC2
SMACC2 is an event-driven, asynchronous, behavioral state machine library for real-time ROS2 (Robotic Operating System) applications written in C++, designed to allow programmers to build robot control applications for multicomponent robots, in an intuitive and systematic manner.
SMACC was inspired by Harel’s statecharts and the SMACH ROS package. SMACC is built on top of the Boost StateChart library.
Repository Status, Packages and Documentation
ROS2 Distro | Branch | Build status | Documentation | Released packages |
---|---|---|---|---|
Foxy | foxy |
|
Generated Doc |
SMACC2 |
Galactic | galactic |
|
Generated Doc |
SMACC2 |
Rolling | rolling |
|
Generated Doc |
SMACC2 |
NOTE: There are three build stages checking current and future compatibility of the package.
-
Binary builds - against released packages (main and testing) in ROS distributions. Shows that direct local build is possible.
Uses repos file:
src/SMACC2/SMACC2-not-released.<ros-distro>.repos
-
Semi-binary builds - against released core ROS packages (main and testing), but the immediate dependencies are pulled from source. Shows that local build with dependencies is possible and if fails there we can expect that after the next package sync we will not be able to build.
Uses repos file:
src/SMACC2/SMACC2.repos
-
Source build - also core ROS packages are build from source. It shows potential issues in the mid future.
Getting started - ROS Rolling + Ubuntu 20.04 (Focal)
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/rolling_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/rolling_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Navigate to the workspace:
cd ~/workspace/rolling_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/rolling/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2-not-released.rolling.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Galactic
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/galactic_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/galactic_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Galactic branch:
cd ~/workspace/galactic_ws/src/SMACC2
git checkout galactic
- Navigate to the workspace:
cd ~/workspace/galactic_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/galactic/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2.galactic.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Foxy
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS2 workspace if necessary:
export COLCON_WS=~/workspace/foxy_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/foxy_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Foxy branch:
cd ~/workspace/foxy_ws/src/SMACC2
git checkout foxy
- Navigate to the workspace:
cd ~/workspace/foxy_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/foxy/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2.foxy.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Features
- Powered by ROS2: SMACC2 has been developed specifically to work with ROS2. It supports ROS2 topics, services and actions, right out of the box.
- Written in C++: Until now, ROS2 has lacked a library to develop task-level behavioral state machines in C++. Although libraries have been developed in scripting languages such as python, these are unsuitable for real-world industrial environments where real-time requirements are demanded.
- Orthogonals: Originally conceived by David Harel in 1987, orthogonality is absolutely crucial to developing state machines for complex robotic systems. This is because complex robots are always a collection of hardware devices which require communication protocols, start-up determinism, etc. With orthogonals, it is an intuitive and relatively straight forward exercise (at least conceptually;) to code a state machine for a robot comprising a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, for instance.
- Static State Machine Checking: One of the features that SMACC2 inherits from Boost Statechart is that you get compile time validation checking. This benefits developers in that the amount of runtime testing necessary to ship quality software that is both stable and safe is dramatically reduced. Our philosophy is “Wherever possible, let the compiler do it”.
- State Machine Reference Library: With a constantly growing library of out-of-the-box reference state machines, (found in the folder sm_reference_library) guaranteed to compile and run, you can jumpstart your development efforts by choosing a reference machine that is closest to your needs, and then customize and extend to meet the specific requirements of your robotic application. All the while knowing that the library supports advanced functionalities that are practically universal among actual working robots.
- SMACC2 Client Library: SMACC2 also features a constantly growing library of clients that support ROS2 Action Servers, Service Servers and other nodes right out-of-the box. The clients within the SMACC2 Client library have been built utilizing a component based architecture that allows for developer to build powerful clients of their own. Current clients of note include MoveBaseZ, a full featured Action Client built to integrate with Nav2, the ros_timer_client, the multi_role_sensor_client, and a keyboard_client used extensively for state machine drafting & debugging.
- Extensive Documentation: Although many ROS users are familiar with doxygen, our development team has spent a lot of time researching the more advanced features of doxygen such as uml style class diagrams and call graphs, and we’ve used them to document the SMACC2 library. Have a look to our doxygen sites and we think you’ll be blown away at what Doxygen looks like when it’s done right and it becomes a powerful tool to research a codebase.
- SMACC2 Runtime Analyzer: The SMACC2 library works out of the box with the SMACC2 RTA. This allows developers to visualize and runtime debug the state machines they are working on. The SMACC2 RTA is closed source, but is free for individual and academic use. It can be found here.
Repository Structure
-
smacc2
- core library of SMACC2. -
smacc2_ci
- … -
smacc2_client_library
- client libraries for SMACC2, e.g., Navigation2 (nav2z_client
), MoveIt2 (move_group_interface_client
). -
smacc2_event_generators
- … -
smacc2_msgs
- ROS2 messages for SMACC2 framework. -
smacc2_sm_reference_library
- libraries with reference implementations of state-machines used for demonstaration and testing of functionalities. -
↓smacc2_state_reactor_library
- … -
smacc2_performance_tools
- …
SMACC2 applications
From it’s inception, SMACC2 was written to support the programming of multi-component, complex robots. If your project involves small, solar-powered insect robots, that simply navigate towards a light source, then SMACC2 might not be the right choice for you. But if you are trying to program a robot with a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, then you’ve come to the right place.
Run a State Machine
The easiest way to get started is by selecting one of the state machines in our reference library, and then hacking it to meet your needs.
Each state machine in the reference library comes with it’s own README.md file, which contains the appropriate operating instructions, so that all you have to do is simply copy & paste some commands into your terminal.
-
If you are looking for a minimal example, we recommend sm_atomic.
-
If you are looking for a minimal example but with a looping superstate, try sm_three_some.
-
If you want to get started with the ROS Navigation stack right away, try sm_dance_bot.
-
If you want to get started with ROS Navigation and exploring the orthogonal read-write cycle, then try sm_dance_bot_strikes_back.
Operating instructions can be found in each reference state machines readme file.
Writing your State Machines
There is a state machine generator in the reference library.
To use it go to the src
folder of your ROS2 workspace and execute:
smacc2/smacc2_sm_reference_library/create-sm-package.bash <name_of_state_machine>
After than compile your workspace and source it to set paths of the new package.
Check README.md
in new package about instructions to start newly created state machine.
Happy Coding!
Support
If you are interested in getting involved or need a little support, feel free to contact us by emailing techsupport@robosoft.ai
CONTRIBUTING
Contributing Guidelines
Thank you for your interest in contributing to smacc
.
Whether it’s a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn’t already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
- A reproducible test case or series of steps
- The version of our code being used
- Any modifications you’ve made relevant to the bug
- Anything unusual about your environment or deployment
Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
- Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
- Give your PR a descriptive title. Add a short summary, if required.
- Make sure the pipeline is green.
- Don’t be afraid to request reviews from maintainers.
- New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.
To send us a pull request, please:
- Fork the repository.
- Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
- Ensure local tests pass. (
colcon test
andpre-commit run
(requires you to install pre-commit bypip3 install pre-commit
) - Commit to your fork using clear commit messages.
- Send a pull request, answering any default questions in the pull request interface.
- Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional documentation on forking a repository and creating a pull request.
Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As this project, by default, uses the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ‘help wanted’ issues is a great place to start.
Licensing
Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
Repository Summary
Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
VCS Type | git |
VCS Version | galactic |
Last Updated | 2023-06-09 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
README
SMACC2
SMACC2 is an event-driven, asynchronous, behavioral state machine library for real-time ROS 2 (Robotic Operating System) applications written in C++, designed to allow programmers to build robot control applications for multicomponent robots, in an intuitive and systematic manner.
SMACC was inspired by Harel’s statecharts and the SMACH ROS package. SMACC is built on top of the Boost StateChart library.
Repository Status, Packages and Documentation
ROS 2 Distro | Branch | Build status | Documentation | Released packages |
---|---|---|---|---|
Foxy | foxy |
|
Generated Doc |
SMACC2 |
Galactic | galactic |
|
Generated Doc |
SMACC2 |
Humble | humble |
|
Generated Doc |
SMACC2 |
Rolling | rolling |
|
Generated Doc |
NOTE: There are three build stages checking current and future compatibility of the package.
-
Binary builds - against released packages (main and testing) in ROS distributions. Shows that direct local build is possible.
Uses repos file:
src/SMACC2/.github/SMACC2-not-released.<ros-distro>.repos
-
Semi-binary builds - against released core ROS packages (main and testing), but the immediate dependencies are pulled from source. Shows that local build with dependencies is possible and if fails there we can expect that after the next package sync we will not be able to build.
Uses repos file:
src/SMACC2/.github/SMACC2.repos
-
Source build - also core ROS packages are build from source. It shows potential issues in the mid future.
Getting started - ROS Galactic
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/galactic_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/galactic_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Galactic branch:
cd ~/workspace/galactic_ws/src/SMACC2
git checkout galactic
- Navigate to the workspace:
cd ~/workspace/galactic_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/galactic/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/.github/SMACC2.galactic.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Foxy
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/foxy_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/foxy_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Foxy branch:
cd ~/workspace/foxy_ws/src/SMACC2
git checkout foxy
- Navigate to the workspace:
cd ~/workspace/foxy_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/foxy/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/.github/SMACC2.foxy.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Rolling + Ubuntu 20.04 (Focal)
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/rolling_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/rolling_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Navigate to the workspace:
cd ~/workspace/rolling_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/rolling/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/SMACC2-not-released.rolling.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Features
- Powered by ROS 2: SMACC2 has been developed specifically to work with ROS 2. It supports ROS 2 topics, services and actions, right out of the box.
- Written in C++: Until now, ROS 2 has lacked a library to develop task-level behavioral state machines in C++. Although libraries have been developed in scripting languages such as python, these are unsuitable for real-world industrial environments where real-time requirements are demanded.
- Orthogonals: Originally conceived by David Harel in 1987, orthogonality is absolutely crucial to developing state machines for complex robotic systems. This is because complex robots are always a collection of hardware devices which require communication protocols, start-up determinism, etc. With orthogonals, it is an intuitive and relatively straight forward exercise (at least conceptually;) to code a state machine for a robot comprising a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, for instance.
- Static State Machine Checking: One of the features that SMACC2 inherits from Boost Statechart is that you get compile time validation checking. This benefits developers in that the amount of runtime testing necessary to ship quality software that is both stable and safe is dramatically reduced. Our philosophy is “Wherever possible, let the compiler do it”.
- State Machine Reference Library: With a constantly growing library of out-of-the-box reference state machines, (found in the folder sm_reference_library) guaranteed to compile and run, you can jumpstart your development efforts by choosing a reference machine that is closest to your needs, and then customize and extend to meet the specific requirements of your robotic application. All the while knowing that the library supports advanced functionalities that are practically universal among actual working robots.
- SMACC2 Client Library: SMACC2 also features a constantly growing library of clients that support ROS 2 Action Servers, Service Servers and other nodes right out-of-the box. The clients within the SMACC2 Client library have been built utilizing a component based architecture that allows for developer to build powerful clients of their own. Current clients of note include MoveBaseZ, a full featured Action Client built to integrate with Nav2, the ros_timer_client, the multi_role_sensor_client, and a keyboard_client used extensively for state machine drafting & debugging.
- Extensive Documentation: Although many ROS users are familiar with doxygen, our development team has spent a lot of time researching the more advanced features of doxygen such as uml style class diagrams and call graphs, and we’ve used them to document the SMACC2 library. Have a look to our doxygen sites and we think you’ll be blown away at what Doxygen looks like when it’s done right and it becomes a powerful tool to research a codebase.
- SMACC2 Runtime Analyzer: The SMACC2 library works out of the box with the SMACC2 RTA. This allows developers to visualize and runtime debug the state machines they are working on. The SMACC2 RTA is closed source, but is free for individual and academic use. It can be found here.
Repository Structure
-
smacc2
- core library of SMACC2. -
smacc2_client_library
- client libraries for SMACC2, e.g., Navigation2 (nav2z_client
), MoveIt2 (move_group_interface_client
). -
smacc2_event_generators
- … -
smacc2_msgs
- ROS 2 messages for SMACC2 framework. -
smacc2_sm_reference_library
- libraries with reference implementations of state-machines used for demonstaration and testing of functionalities. -
↓smacc2_state_reactor_library
- … -
smacc2_performance_tools
- …
SMACC2 applications
From it’s inception, SMACC2 was written to support the programming of multi-component, complex robots. If your project involves small, solar-powered insect robots, that simply navigate towards a light source, then SMACC2 might not be the right choice for you. But if you are trying to program a robot with a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, then you’ve come to the right place.
Run a State Machine
The easiest way to get started is by selecting one of the state machines in our reference library, and then hacking it to meet your needs.
Each state machine in the reference library comes with it’s own README.md file, which contains the appropriate operating instructions, so that all you have to do is simply copy & paste some commands into your terminal.
-
If you are looking for a minimal example, we recommend sm_atomic.
-
If you are looking for a minimal example but with a looping superstate, try sm_three_some.
-
If you want to get started with the ROS Navigation stack right away, try sm_dance_bot.
-
If you want to get started with ROS Navigation and exploring the orthogonal read-write cycle, then try sm_dance_bot_strikes_back.
Operating instructions can be found in each reference state machines readme file.
Writing your State Machines
There is a state machine generator in the reference library.
To use it go to the src
folder of your ROS 2 workspace and execute:
smacc2/smacc2_sm_reference_library/create-sm-package.bash <name_of_state_machine>
After than compile your workspace and source it to set paths of the new package.
Check README.md
in new package about instructions to start newly created state machine.
Happy Coding!
Support
If you are interested in getting involved or need a little support, feel free to contact us by emailing techsupport@robosoft.ai
CONTRIBUTING
Contributing Guidelines
Thank you for your interest in contributing to smacc
.
Whether it’s a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn’t already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
- A reproducible test case or series of steps
- The version of our code being used
- Any modifications you’ve made relevant to the bug
- Anything unusual about your environment or deployment
Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
- Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
- Give your PR a descriptive title. Add a short summary, if required.
- Make sure the pipeline is green.
- Don’t be afraid to request reviews from maintainers.
- New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.
To send us a pull request, please:
- Fork the repository.
- Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
- Ensure local tests pass. (
colcon test
andpre-commit run
(requires you to install pre-commit bypip3 install pre-commit
) - Commit to your fork using clear commit messages.
- Send a pull request, answering any default questions in the pull request interface.
- Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional documentation on forking a repository and creating a pull request.
Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As this project, by default, uses the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ‘help wanted’ issues is a great place to start.
Licensing
Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
Repository Summary
Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
VCS Type | git |
VCS Version | foxy |
Last Updated | 2023-05-12 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
smacc2 | 2.1.21 |
keyboard_client | 2.1.21 |
multirole_sensor_client | 2.1.21 |
ros_publisher_client | 2.1.21 |
ros_timer_client | 2.1.21 |
eg_conditional_generator | 2.1.21 |
eg_random_generator | 2.1.21 |
smacc2_msgs | 2.1.21 |
sm_atomic_performance_trace_1 | 2.1.21 |
sm_atomic_subscribers_performance_test | 2.1.21 |
sm_coretest_transition_speed_1 | 2.1.21 |
sm_advanced_recovery_1 | 2.1.21 |
sm_atomic | 2.1.21 |
sm_atomic_24hr | 2.1.21 |
sm_atomic_mode_states | 2.1.21 |
sm_branching | 2.1.21 |
sm_multi_stage_1 | 2.1.21 |
sm_pubsub_1 | 2.1.21 |
sm_respira_1 | 2.1.21 |
sm_three_some | 2.1.21 |
sr_all_events_go | 2.1.21 |
sr_conditional | 2.1.21 |
sr_event_countdown | 2.1.21 |
README
SMACC2
SMACC2 is an event-driven, asynchronous, behavioral state machine library for real-time ROS 2 (Robotic Operating System) applications written in C++, designed to allow programmers to build robot control applications for multicomponent robots, in an intuitive and systematic manner.
SMACC was inspired by Harel’s statecharts and the SMACH ROS package. SMACC is built on top of the Boost StateChart library.
Repository Status, Packages and Documentation
ROS 2 Distro | Branch | Build status | Documentation | Released packages |
---|---|---|---|---|
Foxy | foxy |
|
Generated Doc |
SMACC2 |
Galactic | galactic |
|
Generated Doc |
SMACC2 |
Humble | humble |
|
Generated Doc |
SMACC2 |
Rolling | rolling |
|
Generated Doc |
NOTE: There are three build stages checking current and future compatibility of the package.
-
Binary builds - against released packages (main and testing) in ROS distributions. Shows that direct local build is possible.
Uses repos file:
src/SMACC2/.github/SMACC2-not-released.<ros-distro>.repos
-
Semi-binary builds - against released core ROS packages (main and testing), but the immediate dependencies are pulled from source. Shows that local build with dependencies is possible and if fails there we can expect that after the next package sync we will not be able to build.
Uses repos file:
src/SMACC2/.github/SMACC2.repos
-
Source build - also core ROS packages are build from source. It shows potential issues in the mid future.
Getting started - ROS Galactic
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/galactic_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/galactic_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Galactic branch:
cd ~/workspace/galactic_ws/src/SMACC2
git checkout galactic
- Navigate to the workspace:
cd ~/workspace/galactic_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/galactic/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/.github/SMACC2.galactic.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Foxy
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/foxy_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/foxy_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Checkout the Foxy branch:
cd ~/workspace/foxy_ws/src/SMACC2
git checkout foxy
- Navigate to the workspace:
cd ~/workspace/foxy_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/foxy/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/.github/SMACC2.foxy.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Getting started - ROS Rolling + Ubuntu 20.04 (Focal)
-
Make sure that
colcon
, its extensions andvcs
are installed:
sudo apt install python3-colcon-common-extensions python3-vcstool
- Create a new ROS 2 workspace if necessary:
export COLCON_WS=~/workspace/rolling_ws
mkdir -p $COLCON_WS/src
- Or just navigate to your workspace source folder:
cd ~/workspace/rolling_ws/src
- Clone the repo:
git clone https://github.com/robosoft-ai/SMACC2.git
- Navigate to the workspace:
cd ~/workspace/rolling_ws
- Update System:
sudo apt update
sudo apt upgrade
- Source the workspace:
source /opt/ros/rolling/setup.bash
- Update dependencies:
rosdep update
- Pull relevant packages and install dependencies:
vcs import src --skip-existing --input src/SMACC2/.github/SMACC2-not-released.rolling.repos
rosdep install --ignore-src --from-paths src -y -r
- Compile:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Features
- Powered by ROS 2: SMACC2 has been developed specifically to work with ROS 2. It supports ROS 2 topics, services and actions, right out of the box.
- Written in C++: Until now, ROS 2 has lacked a library to develop task-level behavioral state machines in C++. Although libraries have been developed in scripting languages such as python, these are unsuitable for real-world industrial environments where real-time requirements are demanded.
- Orthogonals: Originally conceived by David Harel in 1987, orthogonality is absolutely crucial to developing state machines for complex robotic systems. This is because complex robots are always a collection of hardware devices which require communication protocols, start-up determinism, etc. With orthogonals, it is an intuitive and relatively straight forward exercise (at least conceptually;) to code a state machine for a robot comprising a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, for instance.
- Static State Machine Checking: One of the features that SMACC2 inherits from Boost Statechart is that you get compile time validation checking. This benefits developers in that the amount of runtime testing necessary to ship quality software that is both stable and safe is dramatically reduced. Our philosophy is “Wherever possible, let the compiler do it”.
- State Machine Reference Library: With a constantly growing library of out-of-the-box reference state machines, (found in the folder sm_reference_library) guaranteed to compile and run, you can jumpstart your development efforts by choosing a reference machine that is closest to your needs, and then customize and extend to meet the specific requirements of your robotic application. All the while knowing that the library supports advanced functionalities that are practically universal among actual working robots.
- SMACC2 Client Library: SMACC2 also features a constantly growing library of clients that support ROS 2 Action Servers, Service Servers and other nodes right out-of-the box. The clients within the SMACC2 Client library have been built utilizing a component based architecture that allows for developer to build powerful clients of their own. Current clients of note include MoveBaseZ, a full featured Action Client built to integrate with Nav2, the ros_timer_client, the multi_role_sensor_client, and a keyboard_client used extensively for state machine drafting & debugging.
- Extensive Documentation: Although many ROS users are familiar with doxygen, our development team has spent a lot of time researching the more advanced features of doxygen such as uml style class diagrams and call graphs, and we’ve used them to document the SMACC2 library. Have a look to our doxygen sites and we think you’ll be blown away at what Doxygen looks like when it’s done right and it becomes a powerful tool to research a codebase.
- SMACC2 Runtime Analyzer: The SMACC2 library works out of the box with the SMACC2 RTA. This allows developers to visualize and runtime debug the state machines they are working on. The SMACC2 RTA is closed source, but is free for individual and academic use. It can be found here.
Repository Structure
-
smacc2
- core library of SMACC2. -
smacc2_client_library
- client libraries for SMACC2, e.g., Navigation2 (nav2z_client
), MoveIt2 (move_group_interface_client
). -
smacc2_event_generators
- … -
smacc2_msgs
- ROS 2 messages for SMACC2 framework. -
smacc2_sm_reference_library
- libraries with reference implementations of state-machines used for demonstaration and testing of functionalities. -
↓smacc2_state_reactor_library
- … -
smacc2_performance_tools
- …
SMACC2 applications
From it’s inception, SMACC2 was written to support the programming of multi-component, complex robots. If your project involves small, solar-powered insect robots, that simply navigate towards a light source, then SMACC2 might not be the right choice for you. But if you are trying to program a robot with a mobile base, a robotic arm, a gripper, two lidar sensors, a gps transceiver and an imu, then you’ve come to the right place.
Run a State Machine
The easiest way to get started is by selecting one of the state machines in our reference library, and then hacking it to meet your needs.
Each state machine in the reference library comes with it’s own README.md file, which contains the appropriate operating instructions, so that all you have to do is simply copy & paste some commands into your terminal.
-
If you are looking for a minimal example, we recommend sm_atomic.
-
If you are looking for a minimal example but with a looping superstate, try sm_three_some.
-
If you want to get started with the ROS Navigation stack right away, try sm_dance_bot.
-
If you want to get started with ROS Navigation and exploring the orthogonal read-write cycle, then try sm_dance_bot_strikes_back.
Operating instructions can be found in each reference state machines readme file.
Writing your State Machines
There is a state machine generator in the reference library.
To use it go to the src
folder of your ROS 2 workspace and execute:
smacc2/smacc2_sm_reference_library/create-sm-package.bash <name_of_state_machine>
After than compile your workspace and source it to set paths of the new package.
Check README.md
in new package about instructions to start newly created state machine.
Happy Coding!
Support
If you are interested in getting involved or need a little support, feel free to contact us by emailing techsupport@robosoft.ai
CONTRIBUTING
Contributing Guidelines
Thank you for your interest in contributing to smacc
.
Whether it’s a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn’t already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
- A reproducible test case or series of steps
- The version of our code being used
- Any modifications you’ve made relevant to the bug
- Anything unusual about your environment or deployment
Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
- Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
- Give your PR a descriptive title. Add a short summary, if required.
- Make sure the pipeline is green.
- Don’t be afraid to request reviews from maintainers.
- New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.
To send us a pull request, please:
- Fork the repository.
- Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
- Ensure local tests pass. (
colcon test
andpre-commit run
(requires you to install pre-commit bypip3 install pre-commit
) - Commit to your fork using clear commit messages.
- Send a pull request, answering any default questions in the pull request interface.
- Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional documentation on forking a repository and creating a pull request.
Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As this project, by default, uses the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ‘help wanted’ issues is a great place to start.
Licensing
Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.