Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Latest

* Added workaround for vehicle classification

## CARLA-ROS-Bridge 0.9.12

* Fixed scenario runner node shutdown for foxy
Expand Down
14 changes: 14 additions & 0 deletions carla_ros_bridge/src/carla_ros_bridge/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ def __init__(self, uid, name, parent, node, carla_actor):
self.classification = Object.CLASSIFICATION_TRUCK
elif carla_actor.attributes['object_type'] == 'other':
self.classification = Object.CLASSIFICATION_OTHER_VEHICLE
else:
# object_type seems to be empty all the time, so try to identify at least some of them
if 'number_of_wheels' in carla_actor.attributes and \
carla_actor.attributes['number_of_wheels'] == '2':
motorcycle_keys = [ "yamaha", "kawasaki", "harley-davidson", "vespa" ]
bicycle_keys = [ "crossbike", "gazelle", "diamondback" ]
if any(x in carla_actor.type_id for x in motorcycle_keys):
self.classification = Object.CLASSIFICATION_MOTORCYCLE
elif any(x in carla_actor.type_id for x in bicycle_keys):
self.classification = Object.CLASSIFICATION_BIKE
else:
truck_keys = [ "sprinter", "ambulance", "firetruck", "carlacola" ]
if any(x in carla_actor.type_id for x in truck_keys):
self.classification = Object.CLASSIFICATION_TRUCK

super(Vehicle, self).__init__(uid=uid,
name=name,
Expand Down