We want to develop a module in ROS that enables vehicle to vehicle communication via ROS. Our project consists of two cars: The lead car and the follower car. If the lead car should crash, it shall send a message to the follower car which causes it to stop. This should prevent that the follower car crashes into the same obstacle. For sensing the crash, we use an accelerometer (IMU) in the lead car. If a specific threshold in deceleration is met, the car should publish a message over ROS communication. If the follower car receives this specific message, it should cause an immediate stop.
You can find the GitHub repository to our code here: In summary, we added a talker node on the lead car, a listener node on the follower car and the according launch files. In the talker node, we implemented a module to read the output of the IMU, filter it for the axis of acceleration that was interesting for us (frontal deceleration) and publish a message if the threshold was met. In the listener node we implemented a module that, if a specific message was received, called a function in the lane_guidance_node. In the Lane_guidance_node, we had to implement the function that could be called from the listener node and which stopped the car.