25 template <
typename AttributesT>
27 for (
auto &&attribute : attributes) {
29 if (attribute.GetId() ==
"sticky_control") {
30 return attribute.template As<bool>();
75 GetEpisode().
Lock()->ApplyAckermannControlToVehicle(*
this, control);
85 GetEpisode().
Lock()->ApplyAckermannControllerSettings(*
this, settings);
90 GetEpisode().
Lock()->ApplyPhysicsControlToVehicle(*
this, physics_control);
110 GetEpisode().
Lock()->SetWheelSteerDirection(*
this, wheel_location, angle_in_deg);
115 return GetEpisode().
Lock()->GetWheelSteerAngle(*
this, wheel_location);
120 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.control;
130 return GetEpisode().
Lock()->GetVehicleLightState(*this).GetLightStateEnum();
135 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.speed_limit;
140 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.traffic_light_state;
145 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.has_traffic_light;
150 auto id =
GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.traffic_light_id;
151 return boost::static_pointer_cast<TrafficLight>(
GetWorld().GetActor(
id));
167 uint64_t MaxSubsteps,
168 float MaxSubstepDeltaTime,
169 std::string VehicleJSON,
170 std::string PowertrainJSON,
171 std::string TireJSON,
172 std::string BaseJSONPath) {
189 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.failure_state;
用于初始化 Actor 类。只有 ActorFactory 可以创建此对象,因此只有 ActorFactory 可以创建 Actor。
void SetWheelSteerDirection(WheelLocation wheel_location, float angle_in_deg)
给车辆轮子一个 旋转 (影响汽车的骨骼框架,而不是物理)
TelemetryData GetTelemetryData() const
返回车辆的遥测数据.
void ApplyControl(const Control &control)
应用 控制此车辆.
PhysicsControl GetPhysicsControl() const
返回车辆最后应用的物理控制.
float GetWheelSteerAngle(WheelLocation wheel_location)
从车辆轮子返回一个 旋转
void CloseDoor(const VehicleDoor door_idx)
在车中关门
Vehicle(ActorInitializer init)
LightState GetLightState() const
返回当前车辆的打开灯(LightState).
bool IsAtTrafficLight()
返回交通灯是否正在影响该车辆.
void EnableCarSim(std::string simfile_path)
如果可用,启用CarSim模拟
rpc::TrafficLightState GetTrafficLightState() const
返回当前影响该车辆的交通灯的状态.
void ApplyAckermannControl(const AckermannControl &control)
应用 控制此车辆.
void ApplyPhysicsControl(const PhysicsControl &physics_control)
给此车辆应用物理控制.
rpc::AckermannControllerSettings GetAckermannControllerSettings() const
返回最后应用于车辆的 Ackermann controller 设置.
float GetSpeedLimit() const
返回当前影响该车辆的速度限制.
SharedPtr< TrafficLight > GetTrafficLight() const
检索当前影响该车辆的交通灯.
Control GetControl() const
返回最后应用于车辆的控制.
void UseCarSimRoad(bool enabled)
允许使用CarSim内部道路定义,而不是虚幻引擎的
void ApplyAckermannControllerSettings(const rpc::AckermannControllerSettings &settings)
应用 Ackermann 控制设置给此车辆
void OpenDoor(const VehicleDoor door_idx)
在车中开门
void EnableChronoPhysics(uint64_t MaxSubsteps, float MaxSubstepDeltaTime, std::string VehicleJSON="", std::string PowertrainJSON="", std::string TireJSON="", std::string BaseJSONPath="")
void SetLightState(const LightState &light_state)
给车辆设置一个 LightState.
rpc::VehicleFailureState GetFailureState() const
返回车辆的故障状态
void RestorePhysXPhysics()
const bool _is_control_sticky
void SetAutopilot(bool enabled=true, uint16_t tm_port=TM_DEFAULT_PORT)
开关车辆的自动驾驶仪.
void ShowDebugTelemetry(bool enabled=true)
开关车辆的自动驾驶仪.
EpisodeProxy & GetEpisode()
SharedPtrType Lock() const
与 TryLock 相同,但永远不会返回 nullptr。
该类通过使用消息传递机制,将交通管理器的各个阶段恰当地整合在一起
void UnregisterVehicles(const std::vector< ActorPtr > &actor_list)
从交通管理器注销车辆。
void RegisterVehicles(const std::vector< ActorPtr > &actor_list)
向交通管理器注册车辆。
static bool GetControlIsSticky(const AttributesT &attributes)
boost::shared_ptr< T > SharedPtr
使用这个SharedPtr(boost::shared_ptr)以保持与boost::python的兼容性, 但未来如果可能的话,我们希望能为std::shared_ptr制作一个Python适配器。