Insights / Top Packages for Behavior Development in ROS

Top Packages for Behavior Development in ROS

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
Fig. 1: Groot in action.

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):

Project (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.

Fig. 2: FlexBe interface example for robotic arm motion.

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. 


When to use it: You need human in the loop collaboration where the operator can change behavior execution during runtime. 

Executive Smach
Fig. 3: smach_viewer package showing a graphical view for a state transition.

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. 


When to use: You are using ROS1 and want to develop finite state machines in Python.

Fig. 4: Batman behavior tree created in 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.


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.

Fig. 5: Simulated Fetch robot working with SMACC.

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. 


When to use: You want an efficient way to develop finite state machines for ROS2 in C++.

Fig. 6: An overview of the PlanSys2 Architecture.

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. 


When to use: You want to create planning systems for complex systems using PDDL (Planning Domain Definition Language).

PyTrees (ROS)
Fig. 7: An overview of the PlanSys2 Architecture.

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. 


When to use: You want to create Behavior Trees for ROS2 in Python.

Bonus: ROS2Swarm
Fig. 8: Visualized dispersion pattern for 5 robots operating in a swarm.

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. 


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.

Latest Posts

State of the Art in 2D Real-Time Object Detection
Object detection is the ability to determine “what” an object...
Top Packages for Behavior Development in ROS
There comes a time in every robot development project where...
An Introduction to Behavior Trees
If you read our previous articles, you might have noticed...
The Future of Robotics is Now and it’s Open-Source
If you are anything like us, you probably have this...