def get_vehicle_kinetic(vehicle: carla.Vehicle): """ todo unfinished Get kinetics of ego vehicle. todo use a class to encapsulate all methods about getting kinetics """ kinetic_dict = {} transform = vehicle.get_transform() vehicle.get_acceleration() vehicle.get_angular_velocity()
def vehicle_to_carla_measurements( vehicle: carla.Vehicle, # pylint: disable=no-member ) -> Mapping[str, Any]: """Wraps all the `get_` calls from the `CARLA` interface.""" control = vehicle.get_control() _transform = vehicle.get_transform() location = _transform.location rotation = _transform.rotation velocity = vehicle.get_velocity() acceleration = vehicle.get_acceleration() orientation = _transform.get_forward_vector() angular_velocity = vehicle.get_angular_velocity() speed_limit = vehicle.get_speed_limit() is_at_traffic_light = vehicle.is_at_traffic_light() traffic_light_state = vehicle.get_traffic_light_state().conjugate() return dict( control=control, location=location, rotation=rotation, velocity=velocity, acceleration=acceleration, orientation=orientation, angular_velocity=angular_velocity, speed_limit=speed_limit, is_at_traffic_light=is_at_traffic_light, traffic_light_state=traffic_light_state, )