66 return cloe::utility::ActuationLevel::None;
69 virtual void reset(){};
71 virtual cloe::Json to_json()
const = 0;
73 friend void to_json(cloe::Json& j,
const VtdVehicleControl& vc) { j = vc.to_json(); }
93 : LatLongActuator(
"vtd/lat_long_actuator"), task_control_(tc), vehicle_id_(
id) {}
114 old_level_.set_none();
115 LatLongActuator::reset();
116 task_control_->reset();
120 add_driver_control();
122 if (this->has_level_change()) {
123 vtd_logger()->info(
"VtdLatLongActuator: vehicle {} controller state: {}",
id(),
124 level_.to_human_cstr());
133 bool has_level_change() {
return old_level_ != this->level_; }
135 void add_driver_control() {
137 dc.player_id = vehicle_id_;
140 dc.target_acceleration = *acceleration();
141 dc.validity_flags |= RDB_DRIVER_INPUT_VALIDITY_TGT_ACCEL;
145 dc.target_steering = *steering_angle();
146 dc.validity_flags |= RDB_DRIVER_INPUT_VALIDITY_TGT_STEERING;
150 dc.validity_flags |= RDB_DRIVER_INPUT_VALIDITY_ADD_ON;
151 task_control_->add_driver_control(dc);
156 std::shared_ptr<TaskControl> task_control_;
157 uint64_t vehicle_id_;
175 VtdExternalEgoModel(std::shared_ptr<TaskControl> tc, uint64_t
id,
const std::string& veh_name)
176 : VehicleStateModel(
"vtd/ego_state")
179 , vehicle_name_(veh_name) {}
191 add_dyn_object_state();
192 }
else if (sync.
step() > 1) {
199 VehicleStateModel::reset();
200 task_control_->reset();
203 cloe::Json to_json()
const override {
208 void add_dyn_object_state() {
212 assert(
static_cast<uint64_t
>(ego_state->id) == vehicle_id_);
213 os.base_id = ego_state->id;
214 os.base_type = cloe_vtd_obj_class_map.at(ego_state->classification);
215 os.base_name = vehicle_name_;
216 os.base_geo = rdb_geometry_from_object(ego_state.get());
217 os.base_pos = rdb_coord_from_object(ego_state.get());
218 os.ext_speed = rdb_coord_from_vector3d(ego_state->velocity, ego_state->angular_velocity);
219 os.ext_accel = rdb_coord_pos_from_vector3d(ego_state->acceleration);
221 task_control_->add_dyn_object_state(os);
225 std::shared_ptr<TaskControl> task_control_;
226 uint64_t vehicle_id_;
227 std::string vehicle_name_;
Definition: latlong_actuator.hpp:37
virtual bool is_acceleration() const
Definition: latlong_actuator.hpp:57
virtual bool is_steering_angle() const
Definition: latlong_actuator.hpp:75
utility::ActuationLevel actuation_level() const
Definition: latlong_actuator.hpp:82
virtual uint64_t step() const =0
Definition: vehicle_state_model.hpp:35
bool is_vehicle_state()
Definition: vehicle_state_model.hpp:63
const boost::optional< Object > & vehicle_state()
Definition: vehicle_state_model.hpp:51
Definition: actuation_level.hpp:48
Definition: actuator_component.hpp:173
void reset() override
Definition: actuator_component.hpp:198
void step_begin(const cloe::Sync &sync) override
Definition: actuator_component.hpp:189
Definition: actuator_component.hpp:90
void reset() override
Definition: actuator_component.hpp:113
bool update_vehicle_label() override
Definition: actuator_component.hpp:107
void step_begin(const cloe::Sync &) override
Definition: actuator_component.hpp:119
cloe::Duration process(const cloe::Sync &sync) override
Definition: actuator_component.hpp:111
cloe::utility::ActuationLevel get_actuation_level() override
Definition: actuator_component.hpp:109
void step_end(const cloe::Sync &) override
Definition: actuator_component.hpp:128
Definition: actuator_component.hpp:37
virtual void step_end(const cloe::Sync &)
Definition: actuator_component.hpp:55
virtual cloe::utility::ActuationLevel get_actuation_level()
Definition: actuator_component.hpp:65
virtual bool update_vehicle_label()
Definition: actuator_component.hpp:60
virtual void step_begin(const cloe::Sync &sync)=0
std::chrono::nanoseconds Duration
Definition: cloe_fwd.hpp:36