There comes a time in every robot development project where you break something expensive. In the best case no one is hurt and no one’s property is damaged. But if you are building robots for the real-world (not just for yourself), ensuring your system is safe, reliable, and performant must be a top priority or it will be a deal breaker for your robot’s adoption and real-world utility.
Developing an effective behavior system is often critical for robotics projects because well-designed behaviors can enable systems to adapt to changing environments, respond appropriately to a variety of situations, and increase the reliability and predictability of operation.
While the task of developing, validating, and deploying these behaviors can be complex, however, leveraging the right tools can drastically reduce development costs, time to market, and risk.
In this article, we highlight some of our favorite tools for developing behaviors using the robot operating system, ROS. These tools have helped our team design and deploy efficient, robust, and trusted behavior systems for a wide range of applications, and we hope you will find them as valuable as we do for your development process.
BehaviorTrees.CPP with Groot

BehaviorTrees.CPP is our go-to C++ library for creating Behavior Trees, which have with many advantages over state machines. This library is ROS agnostic and is the behavior engine underlying popular ROS packages as Nav2 and Plansys2. The flexible architecture allows for developers to easily script behaviors in XML, implement reactive behaviors, execute actions concurrently, and visualize transitions. Best of all, the project is well documented and provides many tutorials on how to get started.
Groot is a visual Behavior Tree editor that is compatible with BehaviorTree.CPP library. Known as an “IDE for behavior trees,” Groot is one of our all-time favorite tools for visualizing, editing, and monitoring behavior systems in real-time.
Project (BehaviorTree.CPP): https://www.behaviortree.dev/
Project (Groot): https://github.com/BehaviorTree/Groot
When to use: You want to develop Behavior Trees in ROS1 or ROS2 in C++ and display your BejaviorTree.CPP tree in a graphical way.
FlexBe

FlexBe was originally developed for the DARPA Robotics Challenge and provides a high-level behavioral control approach based on hierarchical state machines. Its main advantage is that it integrates well for operators, because they can easily restrict certain transitions, manually trigger actions, and the behavior structure can be modified during runtime.
Project: https://github.com/FlexBE/flexbe_behavior_engine
When to use it: You need human in the loop collaboration where the operator can change behavior execution during runtime.
Executive Smach

executive_smach is a popular Python library for developing state machines in ROS1. As of writing this article, the package was not ported to ROS2, although some forks already exist. Executive Smach is great for prototyping structured behaviors, but falls short when tasks cannot be clearly structured or you are working with low-level systems.
Project: https://github.com/ros/executive_smach
When to use: You are using ROS1 and want to develop finite state machines in Python.
Transitions

With executive_smach not available in ROS2, this Python package for the development of state machines can be a valid alternative. However, because it’s ROS agnostic, you might need to do quite a bit of groundwork to create ROS interfaces for your states.
Project: https://github.com/pytransitions/transitions
When to use: You are using ROS Noetic or ROS2 and want to create finite state machines using Python and are ready to put in a serious effort to integrate the package with ROS.
SMACC2

SMACC2 is a C++ event-driven, asynchronous state machine library. If you want to develop state machines for ROS2, this will probably be the package of choice for you, because ROS2 topics, services, actions will work right out of the box. polo forest The main advantage is that SMACC2 supports very efficient programming because you get compile-time validation checking and access to the state machine reference library which is ready to compile and run. Additionally, the SMACC2 runtime analyzer (RTA) provides the ability to visualize your application during runtime, which drastically improves the development experience.
Project: https://github.com/robosoft-ai/SMACC2
When to use: You want an efficient way to develop finite state machines for ROS2 in C++.
PlanSys2

ROS2 Planning System is a Planning Domain Definition Language (PDDL)-based AI planning system that also makes use of BehaviorTree.CPP. It boasts a more intuitive interface than ROSPlan, support for multiple robot applications, and a core tool called PlanSys2 Terminal that allows you to easily monitor and manage plans, goals, and robot instances.
Project: https://plansys2.github.io/
When to use: You want to create planning systems for complex systems using PDDL (Planning Domain Definition Language).
PyTrees (ROS)

PyTrees is another popular python library for developing Behavior Trees. The package is not as frequently updated as BehaviorTrees.CPP but comes with solid documentation and visualization tools such as the PyTrees ROS Viewer.
Project: https://github.com/splintered-reality/py_trees_ros
When to use: You want to create Behavior Trees for ROS2 in Python.
Bonus: ROS2Swarm

A new kid on the block, this package was created by researchers from the University of Lübeck, Germany, and enables developers to create swarm behaviors for groups of ground robots. seo The package comes with a set of ready-to-use behavior primitives that can be extended and composed to create complex behaviors. The current package includes movement behaviors such as dispersion, attraction, and flocking, as well as voting patterns for collective decision making.
Project: https://gitlab.iti.uni-luebeck.de/ROS2/ros2swarm
When to use: You want to create a robotic swarm aim to digital system using existing mobile robot platforms and could use a project with existing behaviors.
About Adinkra
Adinkra is an R&D engineering firm helping customers create state of the art robotics and AI products while minimizing costs and time to market. We combine a world-class engineering team with a flexible project management framework to offer a one-stop development solution and unlock your product’s full potential for your customers.