robosoft-ai / SMACC2

An Event-Driven, Asynchronous, Behavioral State Machine Library for ROS2 (Robotic Operating System) applications written in C++
https://smacc.dev
Apache License 2.0
223 stars 36 forks source link
cplusplus cpp mobile-robots mobilerobots moveit2 nav2 ros2 ros2-foxy ros2-galactic ros2-humble ros2-rolling state-machine

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 Foxy Binary Build
Foxy Semi-Binary Build
Doxygen Doc Deployment
Generated Doc
ROS Build Farm
SMACC2
Galactic galactic Galactic Binary Build
Galactic Semi-Binary Build
Doxygen Doc Deployment
Generated Doc
Build Status
SMACC2
Humble humble Humble Binary Build
Humble Semi-Binary Build
Doxygen Deployment
Generated Doc
Build Status
SMACC2
Rolling rolling Rolling Binary Build
Rolling Semi-Binary Build
Doxygen Doc Deployment
Generated Doc
Build Status

NOTE: There are three build stages checking current and future compatibility of the package.

  1. 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

  2. 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

  3. Source build - also core ROS packages are build from source. It shows potential issues in the mid future.

Getting started - ROS Humble

  1. Install ROS 2 Humble.

  2. Make sure that colcon, its extensions and vcs are installed:

    sudo apt install python3-colcon-common-extensions python3-vcstool
  3. Create a new ROS 2 workspace if necessary:

    export COLCON_WS=~/workspace/humble_ws
    mkdir -p $COLCON_WS/src
  4. Or just navigate to your workspace source folder:

    cd ~/workspace/humble_ws/src
  5. Clone the repo:

    git clone https://github.com/robosoft-ai/SMACC2.git
  6. Checkout the Humble branch:

    cd ~/workspace/humble_ws/src/SMACC2
    git checkout humble
  7. Navigate to the workspace:

    cd ~/workspace/humble_ws
  8. Update System:

    sudo apt update
    sudo apt upgrade
  9. Source the workspace:

    source /opt/ros/humble/setup.bash
  10. Update dependencies:

    rosdep update
  11. 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
  12. Compile:

    colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

Getting started - ROS Galactic

  1. Install ROS 2 Galactic.

  2. Make sure that colcon, its extensions and vcs are installed:

    sudo apt install python3-colcon-common-extensions python3-vcstool
  3. Create a new ROS 2 workspace if necessary:

    export COLCON_WS=~/workspace/galactic_ws
    mkdir -p $COLCON_WS/src
  4. Or just navigate to your workspace source folder:

    cd ~/workspace/galactic_ws/src
  5. Clone the repo:

    git clone https://github.com/robosoft-ai/SMACC2.git
  6. Checkout the Galactic branch:

    cd ~/workspace/galactic_ws/src/SMACC2
    git checkout galactic
  7. Navigate to the workspace:

    cd ~/workspace/galactic_ws
  8. Update System:

    sudo apt update
    sudo apt upgrade
  9. Source the workspace:

    source /opt/ros/galactic/setup.bash
  10. Update dependencies:

    rosdep update
  11. 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
  12. Compile:

    colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

Getting started - ROS Foxy

  1. Install ROS 2 Foxy.

  2. Make sure that colcon, its extensions and vcs are installed:

    sudo apt install python3-colcon-common-extensions python3-vcstool
  3. Create a new ROS 2 workspace if necessary:

    export COLCON_WS=~/workspace/foxy_ws
    mkdir -p $COLCON_WS/src
  4. Or just navigate to your workspace source folder:

    cd ~/workspace/foxy_ws/src
  5. Clone the repo:

    git clone https://github.com/robosoft-ai/SMACC2.git
  6. Checkout the Foxy branch:

    cd ~/workspace/foxy_ws/src/SMACC2
    git checkout foxy
  7. Navigate to the workspace:

    cd ~/workspace/foxy_ws
  8. Update System:

    sudo apt update
    sudo apt upgrade
  9. Source the workspace:

    source /opt/ros/foxy/setup.bash
  10. Update dependencies:

    rosdep update
  11. 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
  12. Compile:

    colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

Getting started - ROS Rolling

  1. Install ROS 2 Rolling.

  2. Make sure that colcon, its extensions and vcs are installed:

    sudo apt install python3-colcon-common-extensions python3-vcstool
  3. Create a new ROS 2 workspace if necessary:

    export COLCON_WS=~/workspace/rolling_ws
    mkdir -p $COLCON_WS/src
  4. Or just navigate to your workspace source folder:

    cd ~/workspace/rolling_ws/src
  5. Clone the repo:

    git clone https://github.com/robosoft-ai/SMACC2.git
  6. Navigate to the workspace:

    cd ~/workspace/rolling_ws
  7. Update System:

    sudo apt update
    sudo apt upgrade
  8. Source the workspace:

    source /opt/ros/rolling/setup.bash
  9. Update dependencies:

    rosdep update
  10. 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
  11. Compile:

    colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

Features

Repository Structure

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.

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