Get the Driving Lane Status in form of bool vector.
656 {
657
659
667
674inline TimestampIts
getReferenceTime(
const DENM& denm) {
return denm.denm.management.reference_time; }
675
683
690inline uint8_t
getStationType(
const DENM& denm) {
return denm.denm.management.station_type.value; }
691
698inline double getLatitude(
const DENM& denm) {
return getLatitude(denm.denm.management.event_position.latitude); }
699
707
714inline double getAltitude(
const DENM& denm) {
return getAltitude(denm.denm.management.event_position.altitude); }
715
724inline double getHeading(
const Heading& heading) {
return ((
double)heading.heading_value.value) * 1e-1; }
725
733 if (denm.denm.location_is_present) {
734 if (denm.denm.location.event_position_heading_is_present) {
735 return getHeading(denm.denm.location.event_position_heading);
736 } else {
737 throw std::invalid_argument("Heading is not present!");
738 }
739 } else {
740 throw std::invalid_argument("LocationContainer is not present!");
741 }
742}
743
751 if (denm.denm.location_is_present) {
752 return denm.denm.location.event_position_heading_is_present;
753 } else {
754 throw std::invalid_argument("LocationContainer is not present!");
755 }
756}
757
764inline double getSpeed(
const DENM& denm) {
765 if (denm.denm.location_is_present) {
766 if (denm.denm.location.event_speed_is_present) {
767 return getSpeed(denm.denm.location.event_speed);
768 } else {
769 throw std::invalid_argument("Speed is not present!");
770 }
771 } else {
772 throw std::invalid_argument("LocationContainer is not present!");
773 }
774}
775
783 if (denm.denm.location_is_present) {
784 return denm.denm.location.event_speed_is_present;
785 } else {
786 throw std::invalid_argument("LocationContainer is not present!");
787 }
788}
789
798inline gm::PointStamped
getUTMPosition(
const DENM& denm,
int& zone,
bool& northp) {
799 return getUTMPosition(denm.denm.management.event_position, zone, northp);
800}
801
809 int zone;
810 bool northp;
811 return getUTMPosition(denm.denm.management.event_position, zone, northp);
812}
813
820inline uint8_t
getCauseCode(
const DENM& denm) {
return denm.denm.situation.event_type.cause_code.value; }
821
828inline uint8_t
getSubCauseCode(
const DENM& denm) {
return denm.denm.situation.event_type.sub_cause_code.value; }
829
839 if (denm.denm.situation_is_present) {
841 std::string cause_code_type = "undefined";
842
843 if (cause_code == CauseCodeType().TRAFFIC_CONDITION)
844 cause_code_type = "traffic condition";
845 else if (cause_code == CauseCodeType().ACCIDENT)
846 cause_code_type = "accident";
847 else if (cause_code == CauseCodeType().ROADWORKS)
848 cause_code_type = "roadworks";
849 else if (cause_code == CauseCodeType().IMPASSABILITY)
850 cause_code_type = "impassibility";
851 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_ADHESION)
852 cause_code_type = "adverse weather condition - adhesion";
853 else if (cause_code == CauseCodeType().AQUAPLANNNING)
854 cause_code_type = "aquaplanning";
855 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_SURFACE_CONDITION)
856 cause_code_type = "hazardous location - surface condition";
857 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_OBSTACLE_ON_THE_ROAD)
858 cause_code_type = "hazardous location - obstacle on the road";
859 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_ANIMAL_ON_THE_ROAD)
860 cause_code_type = "hazardous location - animal on the road";
861 else if (cause_code == CauseCodeType().HUMAN_PRESENCE_ON_THE_ROAD)
862 cause_code_type = "human presence on the road";
863 else if (cause_code == CauseCodeType().WRONG_WAY_DRIVING)
864 cause_code_type = "wrong way driving";
865 else if (cause_code == CauseCodeType().RESCUE_AND_RECOVERY_WORK_IN_PROGRESS)
866 cause_code_type = "rescue and recovery in progress";
867 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_EXTREME_WEATHER_CONDITION)
868 cause_code_type = "adverse weather condition - extreme weather condition";
869 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_VISIBILITY)
870 cause_code_type = "adverse weather condition - visibility";
871 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_PRECIPITATION)
872 cause_code_type = "adverse weather condition - precipitation";
873 else if (cause_code == CauseCodeType().SLOW_VEHICLE)
874 cause_code_type = "slow vehicle";
875 else if (cause_code == CauseCodeType().DANGEROUS_END_OF_QUEUE)
876 cause_code_type = "dangerous end of queue";
877 else if (cause_code == CauseCodeType().VEHICLE_BREAKDOWN)
878 cause_code_type = "vehicle breakdown";
879 else if (cause_code == CauseCodeType().POST_CRASH)
880 cause_code_type = "post crash";
881 else if (cause_code == CauseCodeType().HUMAN_PROBLEM)
882 cause_code_type = "human problem";
883 else if (cause_code == CauseCodeType().STATIONARY_VEHICLE)
884 cause_code_type = "stationary vehicle";
885 else if (cause_code == CauseCodeType().EMERGENCY_VEHICLE_APPROACHING)
886 cause_code_type = "emergency vehicle approaching";
887 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_DANGEROUS_CURVE)
888 cause_code_type = "hazardous location - dangerous curve";
889 else if (cause_code == CauseCodeType().COLLISION_RISK)
890 cause_code_type = "collision risk";
891 else if (cause_code == CauseCodeType().SIGNAL_VIOLATION)
892 cause_code_type = "signal violation";
893 else if (cause_code == CauseCodeType().DANGEROUS_SITUATION)
894 cause_code_type = "dangerous situation";
895
896 return cause_code_type;
897 } else {
898 throw std::invalid_argument("SituationContainer is not present!");
899 }
900}
901
911 if (denm.denm.situation_is_present) {
914 std::string sub_cause_code_type = "undefined";
915 if (cause_code == CauseCodeType().TRAFFIC_CONDITION) {
916 if (sub_cause_code == 0)
917 sub_cause_code_type = "unavailable";
918 else if (sub_cause_code == 1)
919 sub_cause_code_type = "not defined";
920 else if (sub_cause_code == 2)
921 sub_cause_code_type = "traffic jam slowly increasing";
922 else if (sub_cause_code == 3)
923 sub_cause_code_type = "traffic jam increasing";
924 else if (sub_cause_code == 4)
925 sub_cause_code_type = "traffic jam strongly increasing";
926 else if (sub_cause_code == 5)
927 sub_cause_code_type = "traffic stationary";
928 else if (sub_cause_code == 6)
929 sub_cause_code_type = "traffic jam slightly decreasing";
930 else if (sub_cause_code == 7)
931 sub_cause_code_type = "traffic jam decreasing";
932 else if (sub_cause_code == 8)
933 sub_cause_code_type = "traffic jam strongly decreasing";
934 } else if (cause_code == CauseCodeType().ACCIDENT) {
935 if (sub_cause_code == 0)
936 sub_cause_code_type = "unavailable";
937 else if (sub_cause_code >= 1 && sub_cause_code <= 7)
938 sub_cause_code_type = "not defined";
939 else if (sub_cause_code == 8)
940 sub_cause_code_type = "assistance requested (e-Call)";
941 } else if (cause_code == CauseCodeType().ROADWORKS) {
942 if (sub_cause_code == 0)
943 sub_cause_code_type = "unavailable";
944 else if (sub_cause_code >= 1 && sub_cause_code <= 3)
945 sub_cause_code_type = "not defined";
946 else if (sub_cause_code == 4)
947 sub_cause_code_type = "short-term stationary roadworks";
948 else if (sub_cause_code == 5)
949 sub_cause_code_type = "street cleaning";
950 else if (sub_cause_code == 6)
951 sub_cause_code_type = "winter service";
952 } else if (cause_code == CauseCodeType().IMPASSABILITY)
953 sub_cause_code_type = "not defined";
954 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_ADHESION) {
955 if (sub_cause_code == 0)
956 sub_cause_code_type = "unavailable";
957 else if (sub_cause_code >= 1 && sub_cause_code <= 10)
958 sub_cause_code_type = "not defined";
959 } else if (cause_code == CauseCodeType().AQUAPLANNNING)
960 sub_cause_code_type = "not defined";
961 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_SURFACE_CONDITION) {
962 if (sub_cause_code == 0)
963 sub_cause_code_type = "unavailable";
964 else if (sub_cause_code >= 1 && sub_cause_code <= 9)
965 sub_cause_code_type = "not defined";
966 } else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_OBSTACLE_ON_THE_ROAD) {
967 if (sub_cause_code == 0)
968 sub_cause_code_type = "unavailable";
969 else if (sub_cause_code >= 1 && sub_cause_code <= 7)
970 sub_cause_code_type = "not defined";
971 } else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_ANIMAL_ON_THE_ROAD) {
972 if (sub_cause_code == 0)
973 sub_cause_code_type = "unavailable";
974 else if (sub_cause_code >= 1 && sub_cause_code <= 4)
975 sub_cause_code_type = "not defined";
976 } else if (cause_code == CauseCodeType().HUMAN_PRESENCE_ON_THE_ROAD) {
977 if (sub_cause_code == 0)
978 sub_cause_code_type = "unavailable";
979 else if (sub_cause_code >= 1 && sub_cause_code <= 3)
980 sub_cause_code_type = "not defined";
981 } else if (cause_code == CauseCodeType().WRONG_WAY_DRIVING) {
982 if (sub_cause_code == 0)
983 sub_cause_code_type = "unavailable";
984 else if (sub_cause_code == 1)
985 sub_cause_code_type = "vehicle driving in wrong lane";
986 else if (sub_cause_code == 2)
987 sub_cause_code_type = "vehicle driving in wrong driving direction";
988 } else if (cause_code == CauseCodeType().RESCUE_AND_RECOVERY_WORK_IN_PROGRESS) {
989 if (sub_cause_code == 0)
990 sub_cause_code_type = "unavailable";
991 else if (sub_cause_code >= 1 && sub_cause_code <= 5)
992 sub_cause_code_type = "not defined";
993 } else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_EXTREME_WEATHER_CONDITION) {
994 if (sub_cause_code == 0)
995 sub_cause_code_type = "unavailable";
996 else if (sub_cause_code >= 1 && sub_cause_code <= 6)
997 sub_cause_code_type = "not defined";
998 } else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_VISIBILITY) {
999 if (sub_cause_code == 0)
1000 sub_cause_code_type = "unavailable";
1001 else if (sub_cause_code >= 1 && sub_cause_code <= 8)
1002 sub_cause_code_type = "not defined";
1003 } else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_PRECIPITATION) {
1004 if (sub_cause_code == 0)
1005 sub_cause_code_type = "unavailable";
1006 else if (sub_cause_code >= 1 && sub_cause_code <= 3)
1007 sub_cause_code_type = "not defined";
1008 } else if (cause_code == CauseCodeType().SLOW_VEHICLE) {
1009 if (sub_cause_code == 0)
1010 sub_cause_code_type = "unavailable";
1011 else if (sub_cause_code >= 1 && sub_cause_code <= 8)
1012 sub_cause_code_type = "not defined";
1013 } else if (cause_code == CauseCodeType().DANGEROUS_END_OF_QUEUE) {
1014 if (sub_cause_code == 0)
1015 sub_cause_code_type = "unavailable";
1016 else if (sub_cause_code >= 1 && sub_cause_code <= 8)
1017 sub_cause_code_type = "not defined";
1018 } else if (cause_code == CauseCodeType().VEHICLE_BREAKDOWN) {
1019 if (sub_cause_code == 0)
1020 sub_cause_code_type = "unavailable";
1021 else if (sub_cause_code == 1)
1022 sub_cause_code_type = "lack of fuel";
1023 else if (sub_cause_code == 2)
1024 sub_cause_code_type = "lack of battery";
1025 else if (sub_cause_code == 3)
1026 sub_cause_code_type = "engine problem";
1027 else if (sub_cause_code == 4)
1028 sub_cause_code_type = "transmission problem";
1029 else if (sub_cause_code == 5)
1030 sub_cause_code_type = "engine cooling problem";
1031 else if (sub_cause_code == 6)
1032 sub_cause_code_type = "braking system problem";
1033 else if (sub_cause_code == 7)
1034 sub_cause_code_type = "steering problem";
1035 else if (sub_cause_code == 8)
1036 sub_cause_code_type = "tyre puncture";
1037 } else if (cause_code == CauseCodeType().POST_CRASH) {
1038 if (sub_cause_code == 0)
1039 sub_cause_code_type = "unavailable";
1040 else if (sub_cause_code == 1)
1041 sub_cause_code_type = "accident without e-Call triggered";
1042 else if (sub_cause_code == 2)
1043 sub_cause_code_type = "accident with e-Call manually triggered";
1044 else if (sub_cause_code == 3)
1045 sub_cause_code_type = "accident with e-Call automatical triggered";
1046 else if (sub_cause_code == 4)
1047 sub_cause_code_type = "accident with e-Call triggered without a possible access to a cell network";
1048 } else if (cause_code == CauseCodeType().HUMAN_PROBLEM) {
1049 if (sub_cause_code == 0)
1050 sub_cause_code_type = "unavailable";
1051 else if (sub_cause_code == 1)
1052 sub_cause_code_type = "glycaemia problem";
1053 else if (sub_cause_code == 2)
1054 sub_cause_code_type = "heart problem";
1055 } else if (cause_code == CauseCodeType().STATIONARY_VEHICLE) {
1056 if (sub_cause_code == 0)
1057 sub_cause_code_type = "unavailable";
1058 else if (sub_cause_code == 1)
1059 sub_cause_code_type = "human problem";
1060 else if (sub_cause_code == 2)
1061 sub_cause_code_type = "vehicle breakdown";
1062 else if (sub_cause_code == 3)
1063 sub_cause_code_type = "post crash";
1064 else if (sub_cause_code == 4)
1065 sub_cause_code_type = "public transport stop";
1066 else if (sub_cause_code == 5)
1067 sub_cause_code_type = "carrying dangerous goods";
1068 } else if (cause_code == CauseCodeType().EMERGENCY_VEHICLE_APPROACHING) {
1069 if (sub_cause_code == 0)
1070 sub_cause_code_type = "unavailable";
1071 else if (sub_cause_code == 1)
1072 sub_cause_code_type = "emergency vehicle approaching";
1073 else if (sub_cause_code == 2)
1074 sub_cause_code_type = "prioritized vehicle approaching";
1075 } else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_DANGEROUS_CURVE) {
1076 if (sub_cause_code == 0)
1077 sub_cause_code_type = "unavailable";
1078 else if (sub_cause_code == 1)
1079 sub_cause_code_type = "dangerous left turn curve";
1080 else if (sub_cause_code == 2)
1081 sub_cause_code_type = "dangerous right turn curve";
1082 else if (sub_cause_code == 3)
1083 sub_cause_code_type = "multiple curves starting with unknown turning direction";
1084 else if (sub_cause_code == 4)
1085 sub_cause_code_type = "multiple curves starting with left turn";
1086 else if (sub_cause_code == 5)
1087 sub_cause_code_type = "multiple curves starting with right turn";
1088 } else if (cause_code == CauseCodeType().COLLISION_RISK) {
1089 if (sub_cause_code == 0)
1090 sub_cause_code_type = "unavailable";
1091 else if (sub_cause_code == 1)
1092 sub_cause_code_type = "longitudinal collision risk";
1093 else if (sub_cause_code == 2)
1094 sub_cause_code_type = "crossing collision risk";
1095 else if (sub_cause_code == 3)
1096 sub_cause_code_type = "lateral collision risk";
1097 else if (sub_cause_code == 4)
1098 sub_cause_code_type = "collision risk involving vulnerable road user";
1099 } else if (cause_code == CauseCodeType().SIGNAL_VIOLATION) {
1100 if (sub_cause_code == 0)
1101 sub_cause_code_type = "unavailable";
1102 else if (sub_cause_code == 1)
1103 sub_cause_code_type = "stop sign violation";
1104 else if (sub_cause_code == 2)
1105 sub_cause_code_type = "traffic light violation";
1106 else if (sub_cause_code == 3)
1107 sub_cause_code_type = "turning regulation violation";
1108 } else if (cause_code == CauseCodeType().DANGEROUS_SITUATION) {
1109 if (sub_cause_code == 0)
1110 sub_cause_code_type = "unavailable";
1111 else if (sub_cause_code == 1)
1112 sub_cause_code_type = "emergency electronic break lights";
1113 else if (sub_cause_code == 2)
1114 sub_cause_code_type = "pre-crash system activated";
1115 else if (sub_cause_code == 3)
1116 sub_cause_code_type = "ESP (electronic stability program) activated";
1117 else if (sub_cause_code == 4)
1118 sub_cause_code_type = "ABS (anti-lock breaking system) activated";
1119 else if (sub_cause_code == 5)
1120 sub_cause_code_type = "AEB (automatic emergency breaking) activated";
1121 else if (sub_cause_code == 6)
1122 sub_cause_code_type = "break warning activated";
1123 else if (sub_cause_code == 7)
1124 sub_cause_code_type = "collision risk warning activated";
1125 }
1126 return sub_cause_code_type;
1127 } else {
1128 throw std::invalid_argument("SituationContainer is not present!");
1129 }
1130}
1131
1139 return getBitString(driving_lane_status.value, driving_lane_status.bits_unused);
1140}
1141
1149 return getBitString(light_bar_siren_in_use.value, light_bar_siren_in_use.bits_unused);
1150}
1151
1152}
double getLongitude(const CAM &cam)
Get the Longitude value of CAM.
std::vector< bool > getLightBarSirenInUse(const LightBarSirenInUse &light_bar_siren_in_use)
Get the Lightbar Siren In Use in form of bool vector.
gm::PointStamped getUTMPosition(const CAM &cam, int &zone, bool &northp)
Get the UTM Position defined within the BasicContainer of the CAM.
uint8_t getStationType(const CAM &cam)
Get the stationType object.
uint32_t getStationID(const CAM &cam)
Get the Station ID object.
double getLatitude(const CAM &cam)
Get the Latitude value of CAM.
double getSpeed(const CAM &cam)
Get the vehicle speed.
std::vector< bool > getDrivingLaneStatus(const DrivingLaneStatus &driving_lane_status)
Get the Driving Lane Status in form of bool vector.
std::vector< bool > getBitString(const std::vector< uint8_t > &buffer, const int bits_unused)
Get a Bit String in form of bool vector.
Getter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1.
uint64_t getReferenceTimeValue(const CollectivePerceptionMessage &cpm)
Get the ReferenceTime-Value.
TimestampIts getReferenceTime(const CollectivePerceptionMessage &cpm)
Get the Reference Time object.
std::string getCauseCodeType(const DENM &denm)
Get the Cause Code Type object.
uint8_t getSubCauseCode(const DENM &denm)
Get the Sub Cause Code object.
bool getIsSpeedPresent(const DENM &denm)
Get the IsSpeedPresent object.
std::string getSubCauseCodeType(const DENM &denm)
Get the Sub Cause Code Type object.
uint8_t getCauseCode(const DENM &denm)
Get the Cause Code object.
bool getIsHeadingPresent(const DENM &denm)
Get the IsHeadingPresent object.