Get the confidence of the acceleration component.
562 {
563
565
575
582inline TimestampIts
getReferenceTime(
const CollectivePerceptionMessage &cpm) {
583 return cpm.payload.management_container.reference_time;
584}
585
593
600inline double getLatitude(
const CollectivePerceptionMessage &cpm) {
601 return getLatitude(cpm.payload.management_container.reference_position.latitude);
602}
603
610inline double getLongitude(
const CollectivePerceptionMessage &cpm) {
611 return getLongitude(cpm.payload.management_container.reference_position.longitude);
612}
613
620inline double getAltitude(
const CollectivePerceptionMessage &cpm) {
621 return getAltitude(cpm.payload.management_container.reference_position.altitude);
622}
623
635inline gm::PointStamped
getUTMPosition(
const CollectivePerceptionMessage &cpm,
int &zone,
bool &northp) {
636 return getUTMPosition(cpm.payload.management_container.reference_position, zone, northp);
637}
638
648inline gm::PointStamped
getUTMPosition(
const CollectivePerceptionMessage &cpm) {
649 int zone;
650 bool northp;
652}
653
663inline std::vector<uint8_t>
getCpmContainerIds(
const CollectivePerceptionMessage &cpm) {
664 std::vector<uint8_t> container_ids;
665 for (int i = 0; i < cpm.payload.cpm_containers.value.array.size(); i++) {
666 container_ids.push_back(cpm.payload.cpm_containers.value.array[i].container_id.value);
667 }
668 return container_ids;
669}
670
679inline WrappedCpmContainer
getCpmContainer(
const CollectivePerceptionMessage &cpm,
const uint8_t container_id) {
680 for (int i = 0; i < cpm.payload.cpm_containers.value.array.size(); i++) {
681 if (cpm.payload.cpm_containers.value.array[i].container_id.value == container_id) {
682 return cpm.payload.cpm_containers.value.array[i];
683 }
684 }
685 throw std::invalid_argument("No Container with ID " + std::to_string(container_id) + " found in CPM");
686}
687
697 return getCpmContainer(cpm, WrappedCpmContainer::CHOICE_CONTAINER_DATA_PERCEIVED_OBJECT_CONTAINER);
698}
699
708 if (container.container_id.value != WrappedCpmContainer::CHOICE_CONTAINER_DATA_PERCEIVED_OBJECT_CONTAINER) {
709 throw std::invalid_argument("Container is not a PerceivedObjectContainer");
710 }
711 uint8_t number = container.container_data_perceived_object_container.number_of_perceived_objects.value;
712 return number;
713}
714
723}
724
728
737inline PerceivedObject
getPerceivedObject(
const WrappedCpmContainer &container,
const uint8_t i) {
739 throw std::invalid_argument("Index out of range");
740 }
741 return container.container_data_perceived_object_container.perceived_objects.array[i];
742}
743
753
761 return coordinate.value.value;
762}
763
771 return coordinate.confidence.value;
772}
773
781 gm::Point point;
784 if (object.position.z_coordinate_is_present) {
786 }
787 return point;
788}
789
796inline uint16_t
getCartesianAngle(
const CartesianAngle &angle) {
return angle.value.value; }
797
805
817 if (!object.angles_is_present) throw std::invalid_argument("No angles present in PerceivedObject");
818 tf2::Quaternion q;
819 double roll{0}, pitch{0}, yaw{0};
820
821 if (object.angles.x_angle_is_present) {
822 roll = (((double(
getCartesianAngle(
object.angles.x_angle)) / 10.0) - 180.0) / 180.0) *
823 M_PI;
824 }
825 if (object.angles.y_angle_is_present) {
826 pitch = (((double(
getCartesianAngle(
object.angles.y_angle)) / 10.0) - 180.0) / 180.0) *
827 M_PI;
828 }
829 yaw = (((double(
getCartesianAngle(
object.angles.z_angle)) / 10.0) - 180.0) / 180.0) *
830 M_PI;
831 q.setRPY(roll, pitch, yaw);
832
833 return tf2::toMsg(q);
834}
835
844 tf2::Quaternion q(orientation.x, orientation.y, orientation.z, orientation.w);
845 double roll, pitch, yaw;
846 tf2::Matrix3x3(q).getRPY(roll, pitch, yaw);
847 return yaw;
848}
849
857 gm::Pose pose;
860 return pose;
861}
862
871 if (!object.z_angular_velocity_is_present) throw std::invalid_argument("No yaw rate present in PerceivedObject");
872 return object.z_angular_velocity.value.value;
873}
874
881inline double getVelocityComponent(
const VelocityComponent &velocity) {
return double(velocity.value.value) / 100.0; }
882
890 return double(velocity.confidence.value) / 100.0;
891}
892
901 if (!object.velocity_is_present) throw std::invalid_argument("No velocity present in PerceivedObject");
902 if (object.velocity.choice != Velocity3dWithConfidence::CHOICE_CARTESIAN_VELOCITY) {
903 throw std::invalid_argument("Velocity is not Cartesian");
904 }
905 gm::Vector3 velocity;
908 if (object.velocity.cartesian_velocity.z_velocity_is_present) {
910 }
911 return velocity;
912}
913
921 return double(acceleration.value.value) / 10.0;
922}
923
931 return double(acceleration.confidence.value) / 10.0;
932}
933
942 if (!object.acceleration_is_present) throw std::invalid_argument("No acceleration present in PerceivedObject");
943 if (object.acceleration.choice != Acceleration3dWithConfidence::CHOICE_CARTESIAN_ACCELERATION) {
944 throw std::invalid_argument("Acceleration is not Cartesian");
945 }
946 gm::Vector3 acceleration;
949 if (object.acceleration.cartesian_acceleration.z_acceleration_is_present) {
951 }
952 return acceleration;
953}
954
967 if (!object.object_dimension_x_is_present) throw std::invalid_argument("No x-dimension present in PerceivedObject");
968 return object.object_dimension_x.value.value;
969}
970
983 if (!object.object_dimension_y_is_present) throw std::invalid_argument("No y-dimension present in PerceivedObject");
984 return object.object_dimension_y.value.value;
985}
986
999 if (!object.object_dimension_z_is_present) throw std::invalid_argument("No z-dimension present in PerceivedObject");
1000 return object.object_dimension_z.value.value;
1001}
1002
1013 gm::Vector3 dimensions;
1017 return dimensions;
1018}
1019
1031 const PerceivedObject &object) {
1032 gm::PointStamped utm_position;
1035
1036 utm_position.header.frame_id = reference_position.header.frame_id;
1037 utm_position.point.x = reference_position.point.x + relative_position.x;
1038 utm_position.point.y = reference_position.point.y + relative_position.y;
1039 utm_position.point.z = reference_position.point.z + relative_position.z;
1040
1041 return utm_position;
1042}
1043
1044}
double getLongitude(const CAM &cam)
Get the Longitude value of CAM.
gm::PointStamped getUTMPosition(const CAM &cam, int &zone, bool &northp)
Get the UTM Position defined within the BasicContainer of the CAM.
uint32_t getStationID(const CAM &cam)
Get the Station ID object.
double getLatitude(const CAM &cam)
Get the Latitude value of CAM.
double getAltitude(const CAM &cam)
Get the Altitude value of CAM.
Getter functions for the ETSI ITS Common Data Dictionary (CDD) v2.1.1.
int32_t getCartesianCoordinate(const CartesianCoordinateWithConfidence &coordinate)
Retrieves the Cartesian coordinate value from a CartesianCoordinateWithConfidence object.
uint16_t getZDimensionOfPerceivedObject(const PerceivedObject &object)
Retrieves the z-dimension of a perceived object.
uint8_t getNumberOfPerceivedObjects(const WrappedCpmContainer &container)
gm::Point getPositionOfPerceivedObject(const PerceivedObject &object)
uint64_t getReferenceTimeValue(const CollectivePerceptionMessage &cpm)
Get the ReferenceTime-Value.
uint16_t getCartesianCoordinateConfidence(const CartesianCoordinateWithConfidence &coordinate)
Retrieves the confidence value from a CartesianCoordinateWithConfidence object.
uint8_t getCartesianAngleConfidence(const CartesianAngle &angle)
Get the confidence of the Cartesian angle.
uint16_t getYDimensionOfPerceivedObject(const PerceivedObject &object)
Retrieves the y-dimension of a perceived object.
double getVelocityComponent(const VelocityComponent &velocity)
Get the velocity component of the PerceivedObject.
WrappedCpmContainer getPerceivedObjectContainer(const CollectivePerceptionMessage &cpm)
Retrieves the perceived object container from a CPM.
gm::Vector3 getDimensionsOfPerceivedObject(const PerceivedObject &object)
Retrieves the dimensions of a perceived object.
gm::Pose getPoseOfPerceivedObject(const PerceivedObject &object)
Get the pose of the PerceivedObject.
int16_t getYawRateOfPerceivedObject(const PerceivedObject &object)
Get the yaw rate of the PerceivedObject.
double getYawOfPerceivedObject(const PerceivedObject &object)
Get the yaw of the PerceivedObject.
gm::PointStamped getUTMPositionOfPerceivedObject(const CollectivePerceptionMessage &cpm, const PerceivedObject &object)
Calculates the UTM position of a perceived object based on the CPMs referencep position.
uint16_t getCartesianAngle(const CartesianAngle &angle)
Get the Cartesian angle of the PerceivedObject.
double getVelocityComponentConfidence(const VelocityComponent &velocity)
Get the confidence of the velocity component.
uint16_t getIdOfPerceivedObject(const PerceivedObject &object)
Retrieves the ID of a perceived object.
gm::Vector3 getCartesianVelocityOfPerceivedObject(const PerceivedObject &object)
Get the Cartesian velocity of the PerceivedObject.
uint16_t getXDimensionOfPerceivedObject(const PerceivedObject &object)
Gets the x-dimension of a perceived object.
TimestampIts getReferenceTime(const CollectivePerceptionMessage &cpm)
Get the Reference Time object.
std::vector< uint8_t > getCpmContainerIds(const CollectivePerceptionMessage &cpm)
Retrieves the container IDs from a CPM.
double getAccelerationComponentConfidence(const AccelerationComponent &acceleration)
Get the confidence of the acceleration component.
WrappedCpmContainer getCpmContainer(const CollectivePerceptionMessage &cpm, const uint8_t container_id)
PerceivedObject getPerceivedObject(const WrappedCpmContainer &container, const uint8_t i)
Retrieves the PerceivedObject at the specified index from the given WrappedCpmContainer.
gm::Vector3 getCartesianAccelerationOfPerceivedObject(const PerceivedObject &object)
Get the Cartesian acceleration of the PerceivedObject.
double getAccelerationComponent(const AccelerationComponent &acceleration)
Get the acceleration component of the PerceivedObject.
gm::Quaternion getOrientationOfPerceivedObject(const PerceivedObject &object)
Calculates the orientation of a perceived object.