perception_interfaces 1.1.2
Loading...
Searching...
No Matches
state_getters.h
Go to the documentation of this file.
1// Copyright Institute for Automotive Engineering (ika), RWTH Aachen University
2// SPDX-License-Identifier: MIT
3
9#pragma once
10
13
14
15namespace perception_msgs {
16
17namespace object_access {
24 inline double getX(const ObjectState& state) {
26 return state.continuous_state[indexX(state.model_id)];
27 }
28
29
37 template <typename T>
38 inline double getX(const T& obj) {
39 return getX(obj.state);
40 }
41
48 inline double getY(const ObjectState& state) {
50 return state.continuous_state[indexY(state.model_id)];
51 }
52
60 template <typename T>
61 inline double getY(const T& obj) {
62 return getY(obj.state);
63 }
64
71 inline double getZ(const ObjectState& state) {
73 return state.continuous_state[indexZ(state.model_id)];
74 }
75
83 template <typename T>
84 inline double getZ(const T& obj) {
85 return getZ(obj.state);
86 }
87
94 inline double getVelLon(const ObjectState& state) {
96 return state.continuous_state[indexVelLon(state.model_id)];
97 }
98
106 template <typename T>
107 inline double getVelLon(const T& obj) {
108 return getVelLon(obj.state);
109 }
110
117 inline double getVelLat(const ObjectState& state) {
119 return state.continuous_state[indexVelLat(state.model_id)];
120 }
121
129 template <typename T>
130 inline double getVelLat(const T& obj) {
131 return getVelLat(obj.state);
132 }
133
140 inline double getAccLon(const ObjectState& state) {
142 return state.continuous_state[indexAccLon(state.model_id)];
143 }
144
152 template <typename T>
153 inline double getAccLon(const T& obj) {
154 return getAccLon(obj.state);
155 }
156
163 inline double getAccLat(const ObjectState& state) {
165 return state.continuous_state[indexAccLat(state.model_id)];
166 }
167
175 template <typename T>
176 inline double getAccLat(const T& obj) {
177 return getAccLat(obj.state);
178 }
179
186 inline double getRoll(const ObjectState& state) {
188 return state.continuous_state[indexRoll(state.model_id)];
189 }
190
198 template <typename T>
199 inline double getRoll(const T& obj) {
200 return getRoll(obj.state);
201 }
202
209 inline double getRollRate(const ObjectState& state) {
211 return state.continuous_state[indexRollRate(state.model_id)];
212 }
213
221 template <typename T>
222 inline double getRollRate(const T& obj) {
223 return getRollRate(obj.state);
224 }
225
232 inline double getPitch(const ObjectState& state) {
234 return state.continuous_state[indexPitch(state.model_id)];
235 }
236
244 template <typename T>
245 inline double getPitch(const T& obj) {
246 return getPitch(obj.state);
247 }
248
255 inline double getPitchRate(const ObjectState& state) {
257 return state.continuous_state[indexPitchRate(state.model_id)];
258 }
259
267 template <typename T>
268 inline double getPitchRate(const T& obj) {
269 return getPitchRate(obj.state);
270 }
271
278 inline double getYaw(const ObjectState& state) {
280 return state.continuous_state[indexYaw(state.model_id)];
281 }
282
290 template <typename T>
291 inline double getYaw(const T& obj) {
292 return getYaw(obj.state);
293 }
294
301 inline double getYawRate(const ObjectState& state) {
303 return state.continuous_state[indexYawRate(state.model_id)];
304 }
305
313 template <typename T>
314 inline double getYawRate(const T& obj) {
315 return getYawRate(obj.state);
316 }
317
324 inline double getSteeringAngleAck(const ObjectState& state) {
326 return state.continuous_state[indexSteeringAngleAck(state.model_id)];
327 }
328
336 template <typename T>
337 inline double getSteeringAngleAck(const T& obj) {
338 return getSteeringAngleAck(obj.state);
339 }
340
347 inline double getSteeringAngleRateAck(const ObjectState& state) {
349 return state.continuous_state[indexSteeringAngleRateAck(state.model_id)];
350 }
351
359 template <typename T>
360 inline double getSteeringAngleRateAck(const T& obj) {
361 return getSteeringAngleRateAck(obj.state);
362 }
363
370 inline double getSteeringAngleFront(const ObjectState& state) {
372 return state.continuous_state[indexSteeringAngleFront(state.model_id)];
373 }
374
382 template <typename T>
383 inline double getSteeringAngleFront(const T& obj) {
384 return getSteeringAngleFront(obj.state);
385 }
386
393 inline double getSteeringAngleRear(const ObjectState& state) {
395 return state.continuous_state[indexSteeringAngleRear(state.model_id)];
396 }
397
405 template <typename T>
406 inline double getSteeringAngleRear(const T& obj) {
407 return getSteeringAngleRear(obj.state);
408 }
409
416 inline double getWidth(const ObjectState& state) {
418 return state.continuous_state[indexWidth(state.model_id)];
419 }
420
428 template <typename T>
429 inline double getWidth(const T& obj) {
430 return getWidth(obj.state);
431 }
432
439 inline double getLength(const ObjectState& state) {
441 return state.continuous_state[indexLength(state.model_id)];
442 }
443
451 template <typename T>
452 inline double getLength(const T& obj) {
453 return getLength(obj.state);
454 }
455
462 inline double getHeight(const ObjectState& state) {
464 return state.continuous_state[indexHeight(state.model_id)];
465 }
466
474 template <typename T>
475 inline double getHeight(const T& obj) {
476 return getHeight(obj.state);
477 }
478
486 inline bool getStandstill(const ObjectState& state) {
488 return state.discrete_state[indexStandstill(state.model_id)];
489 }
490
499 template <typename T>
500 inline bool getStandstill(const T& obj) {
501 return getStandstill(obj.state);
502 }
503
510 inline uint8_t getTurnIndicator(const ObjectState& state) {
512 return state.discrete_state[indexTurnIndicator(state.model_id)];
513 }
514
522 template <typename T>
523 inline uint8_t getTurnIndicator(const T& obj) {
524 return getTurnIndicator(obj.state);
525 }
526
533 inline uint8_t getBrakeLight(const ObjectState& state) {
535 return state.discrete_state[indexBrakeLight(state.model_id)];
536 }
537
545 template <typename T>
546 inline uint8_t getBrakeLight(const T& obj) {
547 return getBrakeLight(obj.state);
548 }
549
556 inline uint8_t getReverseLight(const ObjectState& state) {
558 return state.discrete_state[indexReverseLight(state.model_id)];
559 }
560
568 template <typename T>
569 inline uint8_t getReverseLight(const T& obj) {
570 return getReverseLight(obj.state);
571 }
572
580 inline uint8_t getTrafficLightState(const ObjectState& state) {
582 return state.discrete_state[indexTrafficLightState(state.model_id)];
583 }
584
594 template <typename T>
595 inline uint8_t getTrafficLightState(const T& obj) {
596 return getTrafficLightState(obj.state);
597 }
598
606 inline uint8_t getTrafficLightType(const ObjectState& state) {
608 return state.discrete_state[indexTrafficLightType(state.model_id)];
609 }
610
620 template <typename T>
621 inline uint8_t getTrafficLightType(const T& obj) {
622 return getTrafficLightType(obj.state);
623 }
624
625} // namespace object_access
626
627} // namespace perception_msgs
Object state sanity checks.
void sanityCheckContinuousState(const ObjectState &state)
Perform sanity check on continuous state of given object state.
Definition checks.h:63
void sanityCheckDiscreteState(const ObjectState &state)
Perform sanity check on discrete state of given object state.
Definition checks.h:83
double getSteeringAngleAck(const ObjectState &state)
Get the ackermann steering angle for a given object state.
double getZ(const ObjectState &state)
Get the z-position for a given object state.
double getHeight(const ObjectState &state)
Get the height for a given object state.
double getRoll(const ObjectState &state)
Get the roll for a given object state.
double getYawRate(const ObjectState &state)
Get the yaw-rate for a given object state.
double getVelLon(const ObjectState &state)
Get the longitudinal velocity for a given object state.
uint8_t getTurnIndicator(const ObjectState &state)
Get the turn indicator state for a given object state.
uint8_t getBrakeLight(const ObjectState &state)
Get the brake light state for a given object state.
double getSteeringAngleRear(const ObjectState &state)
Get the rear wheel angle for a given object state.
uint8_t getTrafficLightState(const ObjectState &state)
Get the traffic light state for a given object state.
double getAccLon(const ObjectState &state)
Get the longitudinal acceleration for a given object state.
double getRollRate(const ObjectState &state)
Get the roll-rate for a given object state.
double getSteeringAngleFront(const ObjectState &state)
Get the front wheel angle for a given object state.
double getPitchRate(const ObjectState &state)
Get the pitch-rate for a given object state.
double getPitch(const ObjectState &state)
Get the pitch for a given object state.
double getYaw(const ObjectState &state)
Get the yaw for a given object state.
uint8_t getReverseLight(const ObjectState &state)
Get the reverse light state for a given object state.
double getAccLat(const ObjectState &state)
Get the lateral acceleration for a given object state.
double getY(const ObjectState &state)
Get the y-position for a given object state.
bool getStandstill(const ObjectState &state)
Get standstill indication for a given object state.
double getSteeringAngleRateAck(const ObjectState &state)
Get the steering angle rate for a given object state.
double getWidth(const ObjectState &state)
Get the width for a given object state.
double getX(const ObjectState &state)
Get the x-position for a given object state.
double getLength(const ObjectState &state)
Get the length for a given object state.
uint8_t getTrafficLightType(const ObjectState &state)
Get the traffic light type for a given object state.
double getVelLat(const ObjectState &state)
Get the longitudinal velocity for a given object state.
Object state vector indices based on state model.
int indexBrakeLight(const unsigned char &model_id)
Get the vector-index that stores the brake light state for a given model-id.
int indexRollRate(const unsigned char &model_id)
Get the vector-index that stores the roll rate for a given model-id.
int indexVelLon(const unsigned char &model_id)
Get the vector-index that stores the longitudinal velocity for a given model-id.
Definition state_index.h:93
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.
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.
int indexYawRate(const unsigned char &model_id)
Get the vector-index that stores the yaw-rate for a given model-id.
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.
int indexTurnIndicator(const unsigned char &model_id)
Get the vector-index that stores the turn indicator state for a given model-id.
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:47
int indexSteeringAngleFront(const unsigned char &model_id)
Get the vector-index that stores the front wheel angle for a given model-id.
int indexSteeringAngleRear(const unsigned char &model_id)
Get the vector-index that stores the rear wheel angle for a given model-id.
int indexReverseLight(const unsigned char &model_id)
Get the vector-index that stores the reverse light state for a given model-id.
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:70
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.
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.
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:24
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.