publish can data
(self, sensor_id, data)
| 313 | self.publisher_map[sensor_id].publish(msg) |
| 314 | |
| 315 | def publish_can(self, sensor_id, data): |
| 316 | """ |
| 317 | publish can data |
| 318 | """ |
| 319 | if not self.vehicle_info_publisher: |
| 320 | self.vehicle_info_publisher = rospy.Publisher( |
| 321 | '/carla/ego_vehicle/vehicle_info', CarlaEgoVehicleInfo, queue_size=1, latch=True) |
| 322 | info_msg = CarlaEgoVehicleInfo() |
| 323 | for wheel in data['wheels']: |
| 324 | wheel_info = CarlaEgoVehicleInfoWheel() |
| 325 | wheel_info.tire_friction = wheel['tire_friction'] |
| 326 | wheel_info.damping_rate = wheel['damping_rate'] |
| 327 | wheel_info.steer_angle = wheel['steer_angle'] |
| 328 | wheel_info.disable_steering = wheel['disable_steering'] |
| 329 | info_msg.wheels.append(wheel_info) |
| 330 | info_msg.max_rpm = data['max_rpm'] |
| 331 | info_msg.moi = data['moi'] |
| 332 | info_msg.damping_rate_full_throttle = data['damping_rate_full_throttle'] |
| 333 | info_msg.damping_rate_zero_throttle_clutch_disengaged = data['damping_rate_zero_throttle_clutch_disengaged'] |
| 334 | info_msg.use_gear_autobox = data['use_gear_autobox'] |
| 335 | info_msg.clutch_strength = data['clutch_strength'] |
| 336 | info_msg.mass = data['mass'] |
| 337 | info_msg.drag_coefficient = data['drag_coefficient'] |
| 338 | info_msg.center_of_mass.x = data['center_of_mass']['x'] |
| 339 | info_msg.center_of_mass.y = data['center_of_mass']['y'] |
| 340 | info_msg.center_of_mass.z = data['center_of_mass']['z'] |
| 341 | self.vehicle_info_publisher.publish(info_msg) |
| 342 | msg = CarlaEgoVehicleStatus() |
| 343 | msg.header = self.get_header() |
| 344 | msg.velocity = data['speed'] |
| 345 | self.speed = data['speed'] |
| 346 | # todo msg.acceleration |
| 347 | msg.control.throttle = self.current_control.throttle |
| 348 | msg.control.steer = self.current_control.steer |
| 349 | msg.control.brake = self.current_control.brake |
| 350 | msg.control.hand_brake = self.current_control.hand_brake |
| 351 | msg.control.reverse = self.current_control.reverse |
| 352 | msg.control.gear = self.current_control.gear |
| 353 | msg.control.manual_gear_shift = self.current_control.manual_gear_shift |
| 354 | |
| 355 | self.vehicle_status_publisher.publish(msg) |
| 356 | |
| 357 | def publish_hd_map(self, sensor_id, data): |
| 358 | """ |