Skip to content

Commit

Permalink
Add info text, if manual control override is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-labs committed Apr 5, 2019
1 parent 80c2761 commit 814af5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit 814af5c

Please sign in to comment.