# Robot Operating System 2 (ROS2)-Based Frameworks for Increasing Robot Autonomy: A Survey
## Planning Scene Monitor
### Trajectory Re-Planning  
The trajectory re-planning module is responsible for detecting collisions with dynamic obstacles and for modifying the plan to avoid them. It requires more advanced features than  
Figure 11: Example of trajectory planning.  
Figure 10: MoveIt2 architecture.  
the previous module because real-time requirements must also be met. In principle, without these constraints, dynamic obstacles could be handled as static ones, taking advantage of the MoveIt2 functionalities described in Section 4.3. During the execution of the trajectory, initially planned by the previous module, the planning scene is kept up to date by the _Planning Scene Monitor_, and this information is used by the _Collision Detection_ to check for collisions between the updated scene and the first subsequent steps of the planned trajectory. If there is an impending collision, the motion planner is invoked again on the new scene to generate a new trajectory from the current state to the initial goal. This type of approach is inapplicable in practice, unless the obstacles are particularly slow, because scene updating, collision detection, and motion planning are time-consuming operations. Despite this huge limitation, this was the only available re-planning strategy in MoveIt [114] and is still the default in MoveIt2 where, however, a new general approach, _Hybrid Planning_, is being introduced [115]. This is an already well-established approach in the ROS community focused on navigation (existing since ROS Navigation Stack for ROS1) that relies on combining heterogeneous motion planners with different speeds and scopes in order to make the robot responsive to dynamic environments. Specifically, the idea is to rely on a slower global motion planner to generate an initial offline motion plan and on a faster local motion planner to replan when this global solution is invalidated by the appearance of a new obstacle in the robot's surroundings. The global planner works following the standard MoveIt pipeline described in Section 4.3. The novelty concerns the local planner. It is invoked when the scene is updated due to the appearance of dynamic obstacles to modify only the global plan, adjusting it on the fly according to real-time scene information. Because of this, the local planner must meet opposite requirements compared to the global one, such as determinism, real-time, and low computation time, while completeness is not required. As a result, the local planner implements different algorithms, such as potential field planner or model predictive control (MPC). If local re-planning fails, the global motion planner can be triggered again to achieve the desired goal. Thus, the hybrid planning approach also requires an _Hybrid Planning Manager_ to invoke and coordinate the planners based on a customizable event-based logic, as can be seen from the hybrid planning architecture shown in Figure 12. A noteworthy aspect of this architecture is that the local planner implementation is based on two plugins: the _Trajectory Operator Plugin_, which monitors the global reference trajectory and determines the local problem, and the _Solver Plugin_, which solves it based on the local constraints.  
Figure 12: Hybrid planning architecture.  
Like everything else in ROS, this architecture is designed to be highly customizable with each component (i.e., _Planning Logic Plugin_, _Global Planner Plugin_, _Trajectory Operator Plugin_, and _Solver Plugin_) that can be completely replaced by a customized version as long as it offers the required interfaces. At present, both the above-described architecture and an example demo using currently available plugins are implemented in the _moveit_hybrid_planning_ package belonging to the main version of MoveIt2. However, there are not many applications using this new approach that can still be refined. This is therefore one of the modules with the greatest potential for further development.