Skip to content

feat: publish collision string message during emergency stop (Resolves #159)#160

Open
yenode wants to merge 1 commit intoopen-rmf:mainfrom
yenode:main
Open

feat: publish collision string message during emergency stop (Resolves #159)#160
yenode wants to merge 1 commit intoopen-rmf:mainfrom
yenode:main

Conversation

@yenode
Copy link

@yenode yenode commented Mar 14, 2026

New feature implementation

Implemented feature

This PR introduces a ROS 2 publisher to broadcast collision events, enabling automated CI and QA scripts to detect when simulated robots enter an emergency stop state.
Resolves: #159

Implementation description

To allow external testing scripts (such as those needed for rmf_ros2#504) to detect simulation level collisions, the following approach was taken:

In slotcar_common.cpp, modified the emergency_stop() method. When need_to_stop evaluates to true (indicating the robot is too close to an obstacle based on stop_distance and stop_radius), the node publishes a string containing the _model_name. This ensures test scripts can identify exactly which robot triggered the collision state.

GenAI Use

We follow OSRA's policy on GenAI tools

  • I used a GenAI tool in this PR.
  • I did not use GenAI

Generated-by: Gemini AI (Used exclusively for drafting and formatting this PR description text. All C++ code was written manually).

Copy link
Member

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great start. I'm wondering if we should add a custom message.

Also, we should find a way to stop gazebo and terminate rmf in such instances.

@luca-della-vedova, would love your input on this as well.

#include <tf2_ros/transform_broadcaster.h>

#include <geometry_msgs/msg/transform_stamped.hpp>
#include <std_msgs/msg/string.hpp>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! Do you think that we should use string or some other custom message?

@arjo129
Copy link
Member

arjo129 commented Mar 16, 2026

Also can you follow the instructions for DCO: https://github.com/open-rmf/rmf_simulation/pull/160/checks?check_run_id=67082126337

…open-rmf#159)

Signed-off-by: Aditya Pachauri <adi.pachauri.444@gmail.com>
@yenode
Copy link
Author

yenode commented Mar 16, 2026

Thanks for the review and the feedback!

I agree with moving to a custom message.

Publishing the current _model_name, the timestamp, and the [x, y, z] coordinates should be more than enough for the CI script to fail the test and log the location of the collision.

Can I define a new RobotCollision.msg in the rmf_fleet_msgs package?

Regarding terminating Gazebo and RMF: Once the collision is published, do you prefer we attempt a ROS 2 lifecycle shutdown from within the simulation plugin itself, or should the Python CI test script listen for the custom message and broadcast a SIGINT to terminate the entire launch tree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

[Feature request]: Publish some type of message when robots collide.

2 participants