Skip to content

Commit

Permalink
feat: no ACC when emergency
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelkuehnel committed Dec 17, 2023
1 parent 7f9c51f commit c17713e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion code/planning/local_planner/src/ACC.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from carla_msgs.msg import CarlaSpeedometer # , CarlaWorldInfo
from nav_msgs.msg import Path
# from std_msgs.msg import String
from std_msgs.msg import Float32MultiArray, Float32
from std_msgs.msg import Float32MultiArray, Float32, Bool
from collision_check import CollisionCheck


Expand Down Expand Up @@ -55,6 +55,12 @@ def __init__(self):
# Get current position to determine current speed limit
self.current_pos_sub: Subscriber = self.new_subscription(
msg_type=PoseStamped,
topic="/paf/" + self.role_name + "/emergency",
callback=self.emergency_callback,
qos_profile=1)

self.emergency_sub: Subscriber = self.new_subscription(
msg_type=Bool,
topic="/paf/" + self.role_name + "/current_pos",
callback=self.__current_position_callback,
qos_profile=1)
Expand All @@ -80,6 +86,16 @@ def __init__(self):
# Current speed limit
self.speed_limit: float = None # m/s

def emergency_callback(self, data: Bool):
"""Callback for emergency stop
Turn of ACC when emergency stop is triggered
Args:
data (Bool): Emergency stop
"""
if data.data is True:
self.collision_ahead = True

def __get_collision(self, data: Float32MultiArray):
"""Check if collision is ahead
Expand Down

0 comments on commit c17713e

Please sign in to comment.