perception_interfaces 1.0.0
Loading...
Searching...
No Matches
state_index.h
Go to the documentation of this file.
1
30#pragma once
31
32
33namespace perception_msgs {
34
35namespace object_access {
36
37 const std::string kExceptionUnknownStateEntry = "Model with the following ID does not support requested entry: ";
38
45 inline int indexX(const unsigned char& model_id) {
46 switch(model_id) {
47 case EGO::MODEL_ID:
48 return EGO::X;
49 case EGORWS::MODEL_ID:
50 return EGORWS::X;
51 case ISCACTR::MODEL_ID:
52 return ISCACTR::X;
53 case HEXAMOTION::MODEL_ID:
54 return HEXAMOTION::X;
55 case TRAFFICLIGHT::MODEL_ID:
56 return TRAFFICLIGHT::X;
57 default:
58 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "x");
59 }
60 }
61
68 inline int indexY(const unsigned char& model_id) {
69 switch(model_id) {
70 case EGO::MODEL_ID:
71 return EGO::Y;
72 case EGORWS::MODEL_ID:
73 return EGORWS::Y;
74 case ISCACTR::MODEL_ID:
75 return ISCACTR::Y;
76 case HEXAMOTION::MODEL_ID:
77 return HEXAMOTION::Y;
78 case TRAFFICLIGHT::MODEL_ID:
79 return TRAFFICLIGHT::Y;
80 default:
81 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "y");
82 }
83 }
84
91 inline int indexZ(const unsigned char& model_id) {
92 switch(model_id) {
93 case EGO::MODEL_ID:
94 return EGO::Z;
95 case EGORWS::MODEL_ID:
96 return EGORWS::Z;
97 case ISCACTR::MODEL_ID:
98 return ISCACTR::Z;
99 case HEXAMOTION::MODEL_ID:
100 return HEXAMOTION::Z;
101 case TRAFFICLIGHT::MODEL_ID:
102 return TRAFFICLIGHT::Z;
103 default:
104 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "z");
105 }
106 }
107
114 inline int indexVelLon(const unsigned char& model_id) {
115 switch(model_id) {
116 case EGO::MODEL_ID:
117 return EGO::VEL_LON;
118 case EGORWS::MODEL_ID:
119 return EGORWS::VEL_LON;
120 case ISCACTR::MODEL_ID:
121 return ISCACTR::VEL_LON;
122 case HEXAMOTION::MODEL_ID:
123 return HEXAMOTION::VEL_LON;
124 default:
125 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "vel_lon");
126 }
127 }
128
135 inline int indexVelLat(const unsigned char& model_id) {
136 switch(model_id) {
137 case EGO::MODEL_ID:
138 return EGO::VEL_LAT;
139 case EGORWS::MODEL_ID:
140 return EGORWS::VEL_LAT;
141 case ISCACTR::MODEL_ID:
142 return ISCACTR::VEL_LAT;
143 case HEXAMOTION::MODEL_ID:
144 return HEXAMOTION::VEL_LAT;
145 default:
146 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "vel_lat");
147 }
148 }
149
156 inline int indexAccLon(const unsigned char& model_id) {
157 switch(model_id) {
158 case EGO::MODEL_ID:
159 return EGO::ACC_LON;
160 case EGORWS::MODEL_ID:
161 return EGORWS::ACC_LON;
162 case ISCACTR::MODEL_ID:
163 return ISCACTR::ACC_LON;
164 case HEXAMOTION::MODEL_ID:
165 return HEXAMOTION::ACC_LON;
166 default:
167 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "acc_lon");
168 }
169 }
170
177 inline int indexAccLat(const unsigned char& model_id) {
178 switch(model_id) {
179 case EGO::MODEL_ID:
180 return EGO::ACC_LAT;
181 case EGORWS::MODEL_ID:
182 return EGORWS::ACC_LAT;
183 case ISCACTR::MODEL_ID:
184 return ISCACTR::ACC_LAT;
185 case HEXAMOTION::MODEL_ID:
186 return HEXAMOTION::ACC_LAT;
187 default:
188 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "acc_lat");
189 }
190 }
191
198 inline int indexRoll(const unsigned char& model_id) {
199 switch(model_id) {
200 case EGO::MODEL_ID:
201 return EGO::ROLL;
202 case EGORWS::MODEL_ID:
203 return EGORWS::ROLL;
204 case HEXAMOTION::MODEL_ID:
205 return HEXAMOTION::ROLL;
206 default:
207 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "roll");
208 }
209 }
210
217 inline int indexRollRate(const unsigned char& model_id) {
218 switch(model_id) {
219 case HEXAMOTION::MODEL_ID:
220 return HEXAMOTION::ROLL_RATE;
221 default:
222 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "roll_rate");
223 }
224 }
225
232 inline int indexPitch(const unsigned char& model_id) {
233 switch(model_id) {
234 case EGO::MODEL_ID:
235 return EGO::PITCH;
236 case EGORWS::MODEL_ID:
237 return EGORWS::PITCH;
238 case HEXAMOTION::MODEL_ID:
239 return HEXAMOTION::PITCH;
240 default:
241 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "pitch");
242 }
243 }
244
251 inline int indexPitchRate(const unsigned char& model_id) {
252 switch(model_id) {
253 case HEXAMOTION::MODEL_ID:
254 return HEXAMOTION::PITCH_RATE;
255 default:
256 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "pitch_rate");
257 }
258 }
259
266 inline int indexYaw(const unsigned char& model_id) {
267 switch(model_id) {
268 case EGO::MODEL_ID:
269 return EGO::YAW;
270 case EGORWS::MODEL_ID:
271 return EGORWS::YAW;
272 case ISCACTR::MODEL_ID:
273 return ISCACTR::YAW;
274 case HEXAMOTION::MODEL_ID:
275 return HEXAMOTION::YAW;
276 default:
277 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "yaw");
278 }
279 }
280
287 inline int indexYawRate(const unsigned char& model_id) {
288 switch(model_id) {
289 case EGO::MODEL_ID:
290 return EGO::YAW_RATE;
291 case EGORWS::MODEL_ID:
292 return EGORWS::YAW_RATE;
293 case ISCACTR::MODEL_ID:
294 return ISCACTR::YAW_RATE;
295 case HEXAMOTION::MODEL_ID:
296 return HEXAMOTION::YAW_RATE;
297 default:
298 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "yaw_rate");
299 }
300 }
301
308 inline int indexSteeringAngleAck(const unsigned char& model_id) {
309 switch(model_id) {
310 case EGO::MODEL_ID:
311 return EGO::STEERING_ANGLE_ACK;
312 default:
313 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "steering_angle_ack");
314 }
315 }
316
323 inline int indexSteeringAngleRateAck(const unsigned char& model_id) {
324 switch(model_id) {
325 case EGO::MODEL_ID:
326 return EGO::STEERING_ANGLE_RATE_ACK;
327 default:
328 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "steering_angle_rate_ack");
329 }
330 }
331
338 inline int indexSteeringAngleFront(const unsigned char& model_id) {
339 switch(model_id) {
340 case EGORWS::MODEL_ID:
341 return EGORWS::STEERING_ANGLE_FRONT;
342 default:
343 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "steering_angle_front");
344 }
345 }
346
353 inline int indexSteeringAngleRear(const unsigned char& model_id) {
354 switch(model_id) {
355 case EGORWS::MODEL_ID:
356 return EGORWS::STEERING_ANGLE_REAR;
357 default:
358 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "steering_angle_rear");
359 }
360 }
361
368 inline int indexWidth(const unsigned char& model_id) {
369 switch(model_id) {
370 case ISCACTR::MODEL_ID:
371 return ISCACTR::WIDTH;
372 case HEXAMOTION::MODEL_ID:
373 return HEXAMOTION::WIDTH;
374 default:
375 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "width");
376 }
377 }
378
385 inline int indexLength(const unsigned char& model_id) {
386 switch(model_id) {
387 case ISCACTR::MODEL_ID:
388 return ISCACTR::LENGTH;
389 case HEXAMOTION::MODEL_ID:
390 return HEXAMOTION::LENGTH;
391 default:
392 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "length");
393 }
394 }
395
402 inline int indexHeight(const unsigned char& model_id) {
403 switch(model_id) {
404 case ISCACTR::MODEL_ID:
405 return ISCACTR::HEIGHT;
406 case HEXAMOTION::MODEL_ID:
407 return HEXAMOTION::HEIGHT;
408 default:
409 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "height");
410 }
411 }
412
419 inline int indexStandstill(const unsigned char& model_id) {
420 switch(model_id) {
421 case EGO::MODEL_ID:
422 return EGO::STANDSTILL;
423 case EGORWS::MODEL_ID:
424 return EGORWS::STANDSTILL;
425 default:
426 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "standstill");
427 }
428 }
429
437 inline int indexTrafficLightState(const unsigned char& model_id) {
438 switch(model_id) {
439 case TRAFFICLIGHT::MODEL_ID:
440 return TRAFFICLIGHT::STATE;
441 default:
442 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "traffic_light_state");
443 }
444 }
445
453 inline int indexTrafficLightType(const unsigned char& model_id) {
454 switch(model_id) {
455 case TRAFFICLIGHT::MODEL_ID:
456 return TRAFFICLIGHT::TYPE;
457 default:
458 throw std::invalid_argument(kExceptionUnknownStateEntry + std::to_string(model_id) + ", " + "traffic_light_type");
459 }
460 }
461
469 inline bool hasX(const unsigned char& model_id) {
470 switch(model_id) {
471 case EGO::MODEL_ID:
472 return true;
473 case EGORWS::MODEL_ID:
474 return true;
475 case ISCACTR::MODEL_ID:
476 return true;
477 case HEXAMOTION::MODEL_ID:
478 return true;
479 case TRAFFICLIGHT::MODEL_ID:
480 return true;
481 default:
482 return false;
483 }
484 }
485
493 inline bool hasY(const unsigned char& model_id) {
494 switch(model_id) {
495 case EGO::MODEL_ID:
496 return true;
497 case EGORWS::MODEL_ID:
498 return true;
499 case ISCACTR::MODEL_ID:
500 return true;
501 case HEXAMOTION::MODEL_ID:
502 return true;
503 case TRAFFICLIGHT::MODEL_ID:
504 return true;
505 default:
506 return false;
507 }
508 }
509
517 inline bool hasZ(const unsigned char& model_id) {
518 switch(model_id) {
519 case EGO::MODEL_ID:
520 return true;
521 case EGORWS::MODEL_ID:
522 return true;
523 case ISCACTR::MODEL_ID:
524 return true;
525 case HEXAMOTION::MODEL_ID:
526 return true;
527 case TRAFFICLIGHT::MODEL_ID:
528 return true;
529 default:
530 return false;
531 }
532 }
533
541 inline bool hasVelLon(const unsigned char& model_id) {
542 switch(model_id) {
543 case EGO::MODEL_ID:
544 return true;
545 case EGORWS::MODEL_ID:
546 return true;
547 case ISCACTR::MODEL_ID:
548 return true;
549 case HEXAMOTION::MODEL_ID:
550 return true;
551 default:
552 return false;
553 }
554 }
555
563 inline bool hasVelLat(const unsigned char& model_id) {
564 switch(model_id) {
565 case EGO::MODEL_ID:
566 return true;
567 case EGORWS::MODEL_ID:
568 return true;
569 case ISCACTR::MODEL_ID:
570 return true;
571 case HEXAMOTION::MODEL_ID:
572 return true;
573 default:
574 return false;
575 }
576 }
577
585 inline bool hasAccLon(const unsigned char& model_id) {
586 switch(model_id) {
587 case EGO::MODEL_ID:
588 return true;
589 case EGORWS::MODEL_ID:
590 return true;
591 case ISCACTR::MODEL_ID:
592 return true;
593 case HEXAMOTION::MODEL_ID:
594 return true;
595 default:
596 return false;
597 }
598 }
599
607 inline bool hasAccLat(const unsigned char& model_id) {
608 switch(model_id) {
609 case EGO::MODEL_ID:
610 return true;
611 case EGORWS::MODEL_ID:
612 return true;
613 case ISCACTR::MODEL_ID:
614 return true;
615 case HEXAMOTION::MODEL_ID:
616 return true;
617 default:
618 return false;
619 }
620 }
621
629 inline bool hasRoll(const unsigned char& model_id) {
630 switch(model_id) {
631 case EGO::MODEL_ID:
632 return true;
633 case EGORWS::MODEL_ID:
634 return true;
635 case ISCACTR::MODEL_ID:
636 return false;
637 case HEXAMOTION::MODEL_ID:
638 return true;
639 default:
640 return false;
641 }
642 }
643
651 inline bool hasRollRate(const unsigned char& model_id) {
652 switch(model_id) {
653 case EGO::MODEL_ID:
654 return false;
655 case EGORWS::MODEL_ID:
656 return false;
657 case ISCACTR::MODEL_ID:
658 return false;
659 case HEXAMOTION::MODEL_ID:
660 return true;
661 default:
662 return false;
663 }
664 }
665
673 inline bool hasPitch(const unsigned char& model_id) {
674 switch(model_id) {
675 case EGO::MODEL_ID:
676 return true;
677 case EGORWS::MODEL_ID:
678 return true;
679 case ISCACTR::MODEL_ID:
680 return false;
681 case HEXAMOTION::MODEL_ID:
682 return true;
683 default:
684 return false;
685 }
686 }
687
695 inline bool hasPitchRate(const unsigned char& model_id) {
696 switch(model_id) {
697 case EGO::MODEL_ID:
698 return false;
699 case EGORWS::MODEL_ID:
700 return false;
701 case ISCACTR::MODEL_ID:
702 return false;
703 case HEXAMOTION::MODEL_ID:
704 return true;
705 default:
706 return false;
707 }
708 }
709
717 inline bool hasYaw(const unsigned char& model_id) {
718 switch(model_id) {
719 case EGO::MODEL_ID:
720 return true;
721 case EGORWS::MODEL_ID:
722 return true;
723 case ISCACTR::MODEL_ID:
724 return true;
725 case HEXAMOTION::MODEL_ID:
726 return true;
727 default:
728 return false;
729 }
730 }
731
739 inline bool hasYawRate(const unsigned char& model_id) {
740 switch(model_id) {
741 case EGO::MODEL_ID:
742 return true;
743 case EGORWS::MODEL_ID:
744 return true;
745 case ISCACTR::MODEL_ID:
746 return true;
747 case HEXAMOTION::MODEL_ID:
748 return true;
749 default:
750 return false;
751 }
752 }
753
761 inline bool hasSteeringAngleAck(const unsigned char& model_id) {
762 switch(model_id) {
763 case EGO::MODEL_ID:
764 return true;
765 case EGORWS::MODEL_ID:
766 return false;
767 case ISCACTR::MODEL_ID:
768 return false;
769 case HEXAMOTION::MODEL_ID:
770 return false;
771 default:
772 return false;
773 }
774 }
775
783 inline bool hasSteeringAngleRateAck(const unsigned char& model_id) {
784 switch(model_id) {
785 case EGO::MODEL_ID:
786 return true;
787 case EGORWS::MODEL_ID:
788 return false;
789 case ISCACTR::MODEL_ID:
790 return false;
791 case HEXAMOTION::MODEL_ID:
792 return false;
793 default:
794 return false;
795 }
796 }
797
805 inline bool hasSteeringAngleFront(const unsigned char& model_id) {
806 switch(model_id) {
807 case EGORWS::MODEL_ID:
808 return true;
809 default:
810 return false;
811 }
812 }
813
821 inline bool hasSteeringAngleRear(const unsigned char& model_id) {
822 switch(model_id) {
823 case EGORWS::MODEL_ID:
824 return true;
825 default:
826 return false;
827 }
828 }
829
837 inline bool hasWidth(const unsigned char& model_id) {
838 switch(model_id) {
839 case EGO::MODEL_ID:
840 return false;
841 case EGORWS::MODEL_ID:
842 return false;
843 case ISCACTR::MODEL_ID:
844 return true;
845 case HEXAMOTION::MODEL_ID:
846 return true;
847 default:
848 return false;
849 }
850 }
851
859 inline bool hasLength(const unsigned char& model_id) {
860 switch(model_id) {
861 case EGO::MODEL_ID:
862 return false;
863 case EGORWS::MODEL_ID:
864 return false;
865 case ISCACTR::MODEL_ID:
866 return true;
867 case HEXAMOTION::MODEL_ID:
868 return true;
869 default:
870 return false;
871 }
872 }
873
881 inline bool hasHeight(const unsigned char& model_id) {
882 switch(model_id) {
883 case EGO::MODEL_ID:
884 return false;
885 case EGORWS::MODEL_ID:
886 return false;
887 case ISCACTR::MODEL_ID:
888 return true;
889 case HEXAMOTION::MODEL_ID:
890 return true;
891 default:
892 return false;
893 }
894 }
895
903 inline bool hasStandstill(const unsigned char& model_id) {
904 switch(model_id) {
905 case EGO::MODEL_ID:
906 return true;
907 case EGORWS::MODEL_ID:
908 return true;
909 case ISCACTR::MODEL_ID:
910 return false;
911 case HEXAMOTION::MODEL_ID:
912 return false;
913 default:
914 return false;
915 }
916 }
917
926 inline bool hasTrafficLightState(const unsigned char& model_id) {
927 switch(model_id) {
928 case TRAFFICLIGHT::MODEL_ID:
929 return true;
930 default:
931 return false;
932 }
933 }
934
943 inline bool hasTrafficLightType(const unsigned char& model_id) {
944 switch(model_id) {
945 case TRAFFICLIGHT::MODEL_ID:
946 return true;
947 default:
948 return false;
949 }
950 }
951
952} // namespace object_access
953
954} // namespace perception_msgs
bool hasYaw(const unsigned char &model_id)
Indicates if given model contains a yaw.
int indexRollRate(const unsigned char &model_id)
Get the vector-index that stores the roll rate for a given model-id.
bool hasSteeringAngleFront(const unsigned char &model_id)
Indicates if given model contains a front wheel angle.
int indexVelLon(const unsigned char &model_id)
Get the vector-index that stores the longitudinal velocity for a given model-id.
int indexWidth(const unsigned char &model_id)
Get the vector-index that stores the width for a given model-id.
int indexRoll(const unsigned char &model_id)
Get the vector-index that stores the roll for a given model-id.
bool hasTrafficLightType(const unsigned char &model_id)
Indicates if given model contains a traffic light type.
bool hasYawRate(const unsigned char &model_id)
Indicates if given model contains a yaw-rate.
int indexLength(const unsigned char &model_id)
Get the vector-index that stores the length for a given model-id.
int indexPitchRate(const unsigned char &model_id)
Get the vector-index that stores the pitch rate for a given model-id.
bool hasHeight(const unsigned char &model_id)
Indicates if given model contains a height.
bool hasZ(const unsigned char &model_id)
Indicates if given model contains a z-position.
int indexYawRate(const unsigned char &model_id)
Get the vector-index that stores the yaw-rate for a given model-id.
bool hasRollRate(const unsigned char &model_id)
Indicates if given model contains a roll-rate.
bool hasSteeringAngleAck(const unsigned char &model_id)
Indicates if given model contains an ackermann steering angle.
bool hasAccLat(const unsigned char &model_id)
Indicates if given model contains a lateral acceleration.
bool hasVelLat(const unsigned char &model_id)
Indicates if given model contains a lateral velocity.
int indexHeight(const unsigned char &model_id)
Get the vector-index that stores the height for a given model-id.
int indexVelLat(const unsigned char &model_id)
Get the vector-index that stores the lateral velocity for a given model-id.
bool hasSteeringAngleRateAck(const unsigned char &model_id)
Indicates if given model contains an ackermann steering angle rate.
bool hasY(const unsigned char &model_id)
Indicates if given model contains a y-position.
bool hasLength(const unsigned char &model_id)
Indicates if given model contains a length.
bool hasTrafficLightState(const unsigned char &model_id)
Indicates if given model contains a traffic light state.
bool hasSteeringAngleRear(const unsigned char &model_id)
Indicates if given model contains a rear wheel angle.
bool hasRoll(const unsigned char &model_id)
Indicates if given model contains a roll.
int indexY(const unsigned char &model_id)
Get the vector-index that stores the y-position for a given model-id.
Definition state_index.h:68
int indexSteeringAngleFront(const unsigned char &model_id)
Get the vector-index that stores the front wheel angle for a given model-id.
bool hasX(const unsigned char &model_id)
Indicates if given model contains an x-position.
int indexSteeringAngleRear(const unsigned char &model_id)
Get the vector-index that stores the rear wheel angle for a given model-id.
bool hasVelLon(const unsigned char &model_id)
Indicates if given model contains a longitudinal velocity.
int indexZ(const unsigned char &model_id)
Get the vector-index that stores the z-position for a given model-id.
Definition state_index.h:91
bool hasStandstill(const unsigned char &model_id)
Indicates if given model contains a standstill indication.
int indexAccLon(const unsigned char &model_id)
Get the vector-index that stores the longitudinal acceleration for a given model-id.
int indexStandstill(const unsigned char &model_id)
Get the vector-index that stores the standstill indication for a given model-id.
bool hasPitchRate(const unsigned char &model_id)
Indicates if given model contains a pitch-rate.
int indexTrafficLightType(const unsigned char &model_id)
Get the vector-index that stores the traffic light type for a given model-id.
int indexSteeringAngleRateAck(const unsigned char &model_id)
Get the vector-index that stores the steering angle rate for a given model-id.
bool hasPitch(const unsigned char &model_id)
Indicates if given model contains a pitch.
int indexPitch(const unsigned char &model_id)
Get the vector-index that stores the pitch for a given model-id.
int indexAccLat(const unsigned char &model_id)
Get the vector-index that stores the lateral acceleration for a given model-id.
int indexSteeringAngleAck(const unsigned char &model_id)
Get the vector-index that stores the ackermann steering angle for a given model-id.
int indexX(const unsigned char &model_id)
Get the vector-index that stores the x-position for a given model-id.
Definition state_index.h:45
bool hasAccLon(const unsigned char &model_id)
Indicates if given model contains a longitudinal acceleration.
int indexTrafficLightState(const unsigned char &model_id)
Get the vector-index that stores the traffic light state for a given model-id.
int indexYaw(const unsigned char &model_id)
Get the vector-index that stores the yaw for a given model-id.
bool hasWidth(const unsigned char &model_id)
Indicates if given model contains a width.