From 8a877315a91d1e8891676aaf7c88deba2a652ad6 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Thu, 29 Jul 2021 11:40:25 +0200 Subject: [PATCH] Added missing function --- PythonAPI/carla/agents/navigation/behavior_agent.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/PythonAPI/carla/agents/navigation/behavior_agent.py b/PythonAPI/carla/agents/navigation/behavior_agent.py index c2704e390..d14936c50 100644 --- a/PythonAPI/carla/agents/navigation/behavior_agent.py +++ b/PythonAPI/carla/agents/navigation/behavior_agent.py @@ -406,3 +406,16 @@ class BehaviorAgent(BasicAgent): control = self._local_planner.run_step(debug=debug) return control + + def emergency_stop(self): + """ + Overwrites the throttle a brake values of a control to perform an emergency stop. + The steering is kept the same to avoid going out of the lane when stopping during turns + + :param speed (carl.VehicleControl): control to be modified + """ + control = carla.VehicleControl() + control.throttle = 0.0 + control.brake = self._max_brake + control.hand_brake = False + return control \ No newline at end of file