This repository contains a ROS 2 C++ node that enables Automatic Emergency Braking (AEB) for an autonomous vehicle in the F1TENTH simulator using Time-To-Collision (TTC) logic.
The node monitors:
- LIDAR data from the
/scantopic - Velocity data from
/ego_racecar/odom
It computes the Time-To-Collision (TTC) for each laser beam. If the TTC falls below a defined safety threshold, it publishes a brake message to the /drive topic to stop the car.
For each laser beam:
- Only beams with a forward velocity component (cos(angle) > 0) are considered.
- If any TTC is below the safety threshold (e.g. 1.0 seconds), braking is triggered immediately.
Make sure to use the working launch command you’ve been using:
cd ~/f1tenth_ws
source install/setup.bash
ros2 launch f1tenth_gym_ros gym_bridge_launch.pycd ~/lab2_ws
source install/setup.bash
ros2 run safety_node safety_noderos2 run teleop_twist_keyboard teleop_twist_keyboard