From 814af5ce28878a8f1b4f4877d484efeb432ddd61 Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Fri, 5 Apr 2019 15:20:17 +0200 Subject: [PATCH] Add info text, if manual control override is enabled --- CHANGELOG.md | 1 - .../carla_manual_control/carla_manual_control.py | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b8f7c8..ff8d8773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ ## Latest changed -* send rgb-camera images in 'bgr8' format (instead of 'bgra8') * rename gnss topic from '../gnss' to '../fix' * Add lane invasion sensor * Add collision sensor diff --git a/carla_manual_control/src/carla_manual_control/carla_manual_control.py b/carla_manual_control/src/carla_manual_control/carla_manual_control.py index d7eadd22..bc7e08fa 100755 --- a/carla_manual_control/src/carla_manual_control/carla_manual_control.py +++ b/carla_manual_control/src/carla_manual_control/carla_manual_control.py @@ -277,9 +277,12 @@ def __init__(self, width, height): "/carla/ego_vehicle/vehicle_info", CarlaEgoVehicleInfo, self.vehicle_info_updated) self.latitude = 0 self.longitude = 0 + self.manual_control = False self.gnss_subscriber = rospy.Subscriber( "/carla/ego_vehicle/gnss/gnss1/fix", NavSatFix, self.gnss_updated) self.tf_listener = tf.TransformListener() + self.manual_control_subscriber = rospy.Subscriber( + "/vehicle_control_manual_override", Bool, self.manual_control_override_updated) def __del__(self): self.gnss_subscriber.unregister() @@ -292,6 +295,13 @@ def tick(self, clock): """ self._notifications.tick(clock) + def manual_control_override_updated(self, data): + """ + Callback on vehicle status updates + """ + self.manual_control = data.data + self.update_info_text() + def vehicle_status_updated(self, vehicle_status): """ Callback on vehicle status updates @@ -356,7 +366,9 @@ def update_info_text(self): ('Hand brake:', self.vehicle_status.control.hand_brake), ('Manual:', self.vehicle_status.control.manual_gear_shift), 'Gear: %s' % {-1: 'R', 0: 'N'}.get(self.vehicle_status.control.gear, - self.vehicle_status.control.gear)] + self.vehicle_status.control.gear), + ''] + self._info_text += [('Manual ctrl:', self.manual_control)] def toggle_info(self): """