LibCarla: Added vehicle open/close doors
This commit is contained in:
parent
9a81ecf045
commit
d03632c006
|
@ -59,6 +59,14 @@ namespace client {
|
|||
GetEpisode().Lock()->ApplyPhysicsControlToVehicle(*this, physics_control);
|
||||
}
|
||||
|
||||
void Vehicle::OpenDoor(const VehicleDoor door_idx) {
|
||||
GetEpisode().Lock()->OpenVehicleDoor(*this, rpc::VehicleDoor(door_idx));
|
||||
}
|
||||
|
||||
void Vehicle::CloseDoor(const VehicleDoor door_idx) {
|
||||
GetEpisode().Lock()->CloseVehicleDoor(*this, rpc::VehicleDoor(door_idx));
|
||||
}
|
||||
|
||||
void Vehicle::SetLightState(const LightState &light_state) {
|
||||
GetEpisode().Lock()->SetLightStateToVehicle(*this, rpc::VehicleLightState(light_state));
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
|
||||
#include "carla/client/Actor.h"
|
||||
#include "carla/rpc/TrafficLightState.h"
|
||||
#include "carla/rpc/VehicleLightState.h"
|
||||
#include "carla/rpc/VehicleControl.h"
|
||||
#include "carla/rpc/VehicleDoor.h"
|
||||
#include "carla/rpc/VehicleLightState.h"
|
||||
#include "carla/rpc/VehiclePhysicsControl.h"
|
||||
#include "carla/rpc/VehicleWheels.h"
|
||||
#include "carla/trafficmanager/TrafficManager.h"
|
||||
|
@ -33,6 +34,7 @@ namespace client {
|
|||
using PhysicsControl = rpc::VehiclePhysicsControl;
|
||||
using LightState = rpc::VehicleLightState::LightState;
|
||||
using TM = traffic_manager::TrafficManager;
|
||||
using VehicleDoor = rpc::VehicleDoor;
|
||||
using WheelLocation = carla::rpc::VehicleWheelLocation;
|
||||
|
||||
|
||||
|
@ -50,6 +52,12 @@ namespace client {
|
|||
/// Apply physics control to this vehicle.
|
||||
void ApplyPhysicsControl(const PhysicsControl &physics_control);
|
||||
|
||||
/// Open a door in this vehicle
|
||||
void OpenDoor(const VehicleDoor door_idx);
|
||||
|
||||
/// Close a door in this vehicle
|
||||
void CloseDoor(const VehicleDoor door_idx);
|
||||
|
||||
/// Sets a @a LightState to this vehicle.
|
||||
void SetLightState(const LightState &light_state);
|
||||
|
||||
|
|
|
@ -274,6 +274,18 @@ namespace detail {
|
|||
return _pimpl->AsyncCall("set_vehicle_light_state", vehicle, light_state);
|
||||
}
|
||||
|
||||
void Client::OpenVehicleDoor(
|
||||
rpc::ActorId vehicle,
|
||||
const rpc::VehicleDoor door_idx) {
|
||||
return _pimpl->AsyncCall("open_vehicle_door", vehicle, door_idx);
|
||||
}
|
||||
|
||||
void Client::CloseVehicleDoor(
|
||||
rpc::ActorId vehicle,
|
||||
const rpc::VehicleDoor door_idx) {
|
||||
return _pimpl->AsyncCall("close_vehicle_door", vehicle, door_idx);
|
||||
}
|
||||
|
||||
void Client::SetWheelSteerDirection(
|
||||
rpc::ActorId vehicle,
|
||||
rpc::VehicleWheelLocation vehicle_wheel,
|
||||
|
|
|
@ -16,20 +16,21 @@
|
|||
#include "carla/rpc/AttachmentType.h"
|
||||
#include "carla/rpc/Command.h"
|
||||
#include "carla/rpc/CommandResponse.h"
|
||||
#include "carla/rpc/EnvironmentObject.h"
|
||||
#include "carla/rpc/EpisodeInfo.h"
|
||||
#include "carla/rpc/EpisodeSettings.h"
|
||||
#include "carla/rpc/LabelledPoint.h"
|
||||
#include "carla/rpc/LightState.h"
|
||||
#include "carla/rpc/MapInfo.h"
|
||||
#include "carla/rpc/MapLayer.h"
|
||||
#include "carla/rpc/EnvironmentObject.h"
|
||||
#include "carla/rpc/TrafficLightState.h"
|
||||
#include "carla/rpc/VehiclePhysicsControl.h"
|
||||
#include "carla/rpc/VehicleLightState.h"
|
||||
#include "carla/rpc/WeatherParameters.h"
|
||||
#include "carla/rpc/OpendriveGenerationParameters.h"
|
||||
#include "carla/rpc/TrafficLightState.h"
|
||||
#include "carla/rpc/VehicleDoor.h"
|
||||
#include "carla/rpc/VehicleLightStateList.h"
|
||||
#include "carla/rpc/VehicleLightState.h"
|
||||
#include "carla/rpc/VehiclePhysicsControl.h"
|
||||
#include "carla/rpc/VehicleWheels.h"
|
||||
#include "carla/rpc/WeatherParameters.h"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
@ -145,6 +146,14 @@ namespace detail {
|
|||
rpc::ActorId vehicle,
|
||||
const rpc::VehicleLightState &light_state);
|
||||
|
||||
void OpenVehicleDoor(
|
||||
rpc::ActorId vehicle,
|
||||
const rpc::VehicleDoor door_idx);
|
||||
|
||||
void CloseVehicleDoor(
|
||||
rpc::ActorId vehicle,
|
||||
const rpc::VehicleDoor door_idx);
|
||||
|
||||
rpc::Actor SpawnActor(
|
||||
const rpc::ActorDescription &description,
|
||||
const geom::Transform &transform);
|
||||
|
|
|
@ -469,6 +469,14 @@ namespace detail {
|
|||
_client.SetLightStateToVehicle(vehicle.GetId(), light_state);
|
||||
}
|
||||
|
||||
void OpenVehicleDoor(Vehicle &vehicle, const rpc::VehicleDoor door_idx) {
|
||||
_client.OpenVehicleDoor(vehicle.GetId(), door_idx);
|
||||
}
|
||||
|
||||
void CloseVehicleDoor(Vehicle &vehicle, const rpc::VehicleDoor door_idx) {
|
||||
_client.CloseVehicleDoor(vehicle.GetId(), door_idx);
|
||||
}
|
||||
|
||||
void SetWheelSteerDirection(Vehicle &vehicle, rpc::VehicleWheelLocation wheel_location, float angle_in_deg) {
|
||||
_client.SetWheelSteerDirection(vehicle.GetId(), wheel_location, angle_in_deg);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue