-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
Description
Find how to compute a PerceivedObject acceleration from the full CPM data.
rust/src/mobility/mobile_perceived_object.rs, line 95:
impl MobilePerceivedObject {
// TODO FGA: check how to keep it private and manage end to end CPMs with natively
// perceived object mobility
pub(crate) fn new(
perceived_object: PerceivedObject,
cpm: &CollectivePerceptionMessage,
) -> Self {
let mobile_id = compute_id(perceived_object.object_id, cpm.station_id);
let cartesian_velocity = &perceived_object
.velocity
.as_ref()
.and_then(|v| v.cartesian_velocity.as_ref())
.map_or(CartesianVelocity::default(), |v| v.clone());
let speed = speed_from_yaw_angle(
cartesian_velocity.x_velocity.value,
cartesian_velocity.y_velocity.value,
);
let (position, heading) = match &cpm.originating_vehicle_container {
Some(_) => {
let cpm_heading = cpm.heading().unwrap_or_default();
// If the CPM has an originating vehicle container, we compute the heading
// from the perceived object and the vehicle's heading.
(
compute_position_from_mobile(
perceived_object.position.x_coordinate.value,
perceived_object.position.y_coordinate.value,
&cpm.position(),
cpm_heading,
),
compute_heading_from_mobile(
cartesian_velocity.x_velocity.value,
cartesian_velocity.y_velocity.value,
cpm_heading,
),
)
}
None => {
// If there is no originating vehicle container, we compute from the RSU
(
enu_destination(
&cpm.position(),
perceived_object.position.x_coordinate.value as f64 / 100.,
perceived_object.position.y_coordinate.value as f64 / 100.,
perceived_object
.position
.z_coordinate
.unwrap_or_default()
.value as f64
/ 100.,
),
compute_heading_from_rsu(
cartesian_velocity.x_velocity.value,
cartesian_velocity.y_velocity.value,
),
)
}
};
// FIXME compute acceleration from perceived object velocity. See https://github.com/Orange-OpenSource/its-client/issues/416
let acceleration = 0.0;
Self {
perceived_object,
mobile_id,
position,
speed,
heading,
acceleration,
}
}
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status