Rename get_vehicle_control to get_control to be consistent with walkers

This commit is contained in:
nsubiron 2019-01-16 14:32:07 +01:00
parent 656aba71ec
commit aeecd3d6eb
7 changed files with 9 additions and 8 deletions

View File

@ -5,6 +5,7 @@
* Added "sensor_tick" attribute to sensors (cameras and lidars) to specify the capture rate in seconds * Added "sensor_tick" attribute to sensors (cameras and lidars) to specify the capture rate in seconds
* Added "get_forward_vector()" to rotation and transform, retrieves the unit vector on the rotation's X-axis * Added "get_forward_vector()" to rotation and transform, retrieves the unit vector on the rotation's X-axis
* Added support for Deepin in PythonAPI's setup.py * Added support for Deepin in PythonAPI's setup.py
* Rename vehicle.get_vehicle_control() to vehicle.get_control() to be consistent with walkers
## CARLA 0.9.2 ## CARLA 0.9.2

View File

@ -106,7 +106,7 @@
- `bounding_box` - `bounding_box`
- `apply_control(vehicle_control)` - `apply_control(vehicle_control)`
- `get_vehicle_control()` - `get_control()`
- `set_autopilot(enabled=True)` - `set_autopilot(enabled=True)`
## `carla.TrafficLight(carla.Actor)` ## `carla.TrafficLight(carla.Actor)`

View File

@ -22,7 +22,7 @@ namespace client {
} }
} }
Vehicle::Control Vehicle::GetVehicleControl() const { Vehicle::Control Vehicle::GetControl() const {
return GetEpisode().Lock()->GetActorDynamicState(*this).state.vehicle_control; return GetEpisode().Lock()->GetActorDynamicState(*this).state.vehicle_control;
} }

View File

@ -29,7 +29,7 @@ namespace client {
/// ///
/// @note This function does not call the simulator, it returns the Control /// @note This function does not call the simulator, it returns the Control
/// received in the last tick. /// received in the last tick.
Control GetVehicleControl() const; Control GetControl() const;
private: private:

View File

@ -216,7 +216,7 @@ class KeyboardControl(object):
self._control.gear = 1 if self._control.reverse else -1 self._control.gear = 1 if self._control.reverse else -1
elif event.key == K_m: elif event.key == K_m:
self._control.manual_gear_shift = not self._control.manual_gear_shift self._control.manual_gear_shift = not self._control.manual_gear_shift
self._control.gear = world.vehicle.get_vehicle_control().gear self._control.gear = world.vehicle.get_control().gear
world.hud.notification( world.hud.notification(
'%s Transmission' % ('Manual' if self._control.manual_gear_shift else 'Automatic')) '%s Transmission' % ('Manual' if self._control.manual_gear_shift else 'Automatic'))
elif self._control.manual_gear_shift and event.key == K_COMMA: elif self._control.manual_gear_shift and event.key == K_COMMA:
@ -284,7 +284,7 @@ class HUD(object):
return return
t = world.vehicle.get_transform() t = world.vehicle.get_transform()
v = world.vehicle.get_velocity() v = world.vehicle.get_velocity()
c = world.vehicle.get_vehicle_control() c = world.vehicle.get_control()
heading = 'N' if abs(t.rotation.yaw) < 89.5 else '' heading = 'N' if abs(t.rotation.yaw) < 89.5 else ''
heading += 'S' if abs(t.rotation.yaw) > 90.5 else '' heading += 'S' if abs(t.rotation.yaw) > 90.5 else ''
heading += 'E' if 179.5 > t.rotation.yaw > 0.5 else '' heading += 'E' if 179.5 > t.rotation.yaw > 0.5 else ''

View File

@ -246,7 +246,7 @@ class KeyboardControl(object):
self._control.gear = 1 if self._control.reverse else -1 self._control.gear = 1 if self._control.reverse else -1
elif event.key == K_m: elif event.key == K_m:
self._control.manual_gear_shift = not self._control.manual_gear_shift self._control.manual_gear_shift = not self._control.manual_gear_shift
self._control.gear = world.vehicle.get_vehicle_control().gear self._control.gear = world.vehicle.get_control().gear
world.hud.notification('%s Transmission' % ('Manual' if self._control.manual_gear_shift else 'Automatic')) world.hud.notification('%s Transmission' % ('Manual' if self._control.manual_gear_shift else 'Automatic'))
elif self._control.manual_gear_shift and event.key == K_COMMA: elif self._control.manual_gear_shift and event.key == K_COMMA:
self._control.gear = max(-1, self._control.gear - 1) self._control.gear = max(-1, self._control.gear - 1)
@ -314,7 +314,7 @@ class HUD(object):
return return
t = world.vehicle.get_transform() t = world.vehicle.get_transform()
v = world.vehicle.get_velocity() v = world.vehicle.get_velocity()
c = world.vehicle.get_vehicle_control() c = world.vehicle.get_control()
heading = 'N' if abs(t.rotation.yaw) < 89.5 else '' heading = 'N' if abs(t.rotation.yaw) < 89.5 else ''
heading += 'S' if abs(t.rotation.yaw) > 90.5 else '' heading += 'S' if abs(t.rotation.yaw) > 90.5 else ''
heading += 'E' if 179.5 > t.rotation.yaw > 0.5 else '' heading += 'E' if 179.5 > t.rotation.yaw > 0.5 else ''

View File

@ -69,7 +69,7 @@ void export_actor() {
class_<cc::Vehicle, bases<cc::Actor>, boost::noncopyable, boost::shared_ptr<cc::Vehicle>>("Vehicle", no_init) class_<cc::Vehicle, bases<cc::Actor>, boost::noncopyable, boost::shared_ptr<cc::Vehicle>>("Vehicle", no_init)
.add_property("bounding_box", CALL_RETURNING_COPY(cc::Vehicle, GetBoundingBox)) .add_property("bounding_box", CALL_RETURNING_COPY(cc::Vehicle, GetBoundingBox))
.def("apply_control", &cc::Vehicle::ApplyControl, (arg("control"))) .def("apply_control", &cc::Vehicle::ApplyControl, (arg("control")))
.def("get_vehicle_control", &cc::Vehicle::GetVehicleControl) .def("get_control", &cc::Vehicle::GetControl)
.def("set_autopilot", &cc::Vehicle::SetAutopilot, (arg("enabled")=true)) .def("set_autopilot", &cc::Vehicle::SetAutopilot, (arg("enabled")=true))
.def(self_ns::str(self_ns::self)) .def(self_ns::str(self_ns::self))
; ;