37namespace perception_msgs {
39namespace object_access {
48 inline void setX(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
50 const int idx =
indexX(state.model_id);
51 state.continuous_state[idx] = val;
64 inline void setX(T& obj,
const double val,
const bool reset_covariance =
true) {
65 setX(obj.state, val, reset_covariance);
75 inline void setY(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
77 const int idx =
indexY(state.model_id);
78 state.continuous_state[idx] = val;
91 inline void setY(T& obj,
const double val,
const bool reset_covariance =
true) {
92 setY(obj.state, val, reset_covariance);
102 inline void setZ(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
104 const int idx =
indexZ(state.model_id);
105 state.continuous_state[idx] = val;
117 template <
typename T>
118 inline void setZ(T& obj,
const double val,
const bool reset_covariance =
true) {
119 setZ(obj.state, val, reset_covariance);
129 inline void setVelLon(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
132 state.continuous_state[idx] = val;
144 template <
typename T>
145 inline void setVelLon(T& obj,
const double val,
const bool reset_covariance =
true) {
146 setVelLon(obj.state, val, reset_covariance);
156 inline void setVelLat(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
159 state.continuous_state[idx] = val;
171 template <
typename T>
172 inline void setVelLat(T& obj,
const double val,
const bool reset_covariance =
true) {
173 setVelLat(obj.state, val, reset_covariance);
183 inline void setAccLon(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
186 state.continuous_state[idx] = val;
198 template <
typename T>
199 inline void setAccLon(T& obj,
const double val,
const bool reset_covariance =
true) {
200 setAccLon(obj.state, val, reset_covariance);
210 inline void setAccLat(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
213 state.continuous_state[idx] = val;
225 template <
typename T>
226 inline void setAccLat(T& obj,
const double val,
const bool reset_covariance =
true) {
227 setAccLat(obj.state, val, reset_covariance);
237 inline void setRoll(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
239 double capped_val = val;
240 while (capped_val > M_PI) capped_val -= 2 * M_PI;
241 while (capped_val < -M_PI) capped_val += 2 * M_PI;
242 const int idx =
indexRoll(state.model_id);
243 state.continuous_state[idx] = capped_val;
255 template <
typename T>
256 inline void setRoll(T& obj,
const double val,
const bool reset_covariance =
true) {
257 setRoll(obj.state, val, reset_covariance);
267 inline void setRollRate(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
270 state.continuous_state[idx] = val;
282 template <
typename T>
283 inline void setRollRate(T& obj,
const double val,
const bool reset_covariance =
true) {
294 inline void setPitch(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
296 double capped_val = val;
297 while (capped_val > M_PI) capped_val -= 2 * M_PI;
298 while (capped_val < -M_PI) capped_val += 2 * M_PI;
300 state.continuous_state[idx] = capped_val;
312 template <
typename T>
313 inline void setPitch(T& obj,
const double val,
const bool reset_covariance =
true) {
314 setPitch(obj.state, val, reset_covariance);
324 inline void setPitchRate(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
327 state.continuous_state[idx] = val;
339 template <
typename T>
340 inline void setPitchRate(T& obj,
const double val,
const bool reset_covariance =
true) {
351 inline void setYaw(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
353 double capped_val = val;
354 while (capped_val > M_PI) capped_val -= 2 * M_PI;
355 while (capped_val < -M_PI) capped_val += 2 * M_PI;
356 const int idx =
indexYaw(state.model_id);
357 state.continuous_state[idx] = capped_val;
369 template <
typename T>
370 inline void setYaw(T& obj,
const double val,
const bool reset_covariance =
true) {
371 setYaw(obj.state, val, reset_covariance);
381 inline void setYawRate(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
384 state.continuous_state[idx] = val;
396 template <
typename T>
397 inline void setYawRate(T& obj,
const double val,
const bool reset_covariance =
true) {
408 inline void setSteeringAngleAck(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
411 state.continuous_state[idx] = val;
423 template <
typename T>
438 state.continuous_state[idx] = val;
450 template <
typename T>
465 state.continuous_state[idx] = val;
477 template <
typename T>
492 state.continuous_state[idx] = val;
504 template <
typename T>
516 inline void setWidth(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
519 state.continuous_state[idx] = val;
531 template <
typename T>
532 inline void setWidth(T& obj,
const double val,
const bool reset_covariance =
true) {
533 setWidth(obj.state, val, reset_covariance);
543 inline void setLength(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
546 state.continuous_state[idx] = val;
558 template <
typename T>
559 inline void setLength(T& obj,
const double val,
const bool reset_covariance =
true) {
560 setLength(obj.state, val, reset_covariance);
570 inline void setHeight(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
573 state.continuous_state[idx] = val;
585 template <
typename T>
586 inline void setHeight(T& obj,
const double val,
const bool reset_covariance =
true) {
587 setHeight(obj.state, val, reset_covariance);
599 state.discrete_state[idx] = val;
609 template <
typename T>
623 state.discrete_state[idx] = val;
634 template <
typename T>
648 state.discrete_state[idx] = val;
659 template <
typename T>
Object state sanity checks.
void sanityCheckContinuousState(const ObjectState &state)
Perform sanity check on continuous state of given object state.
void sanityCheckDiscreteState(const ObjectState &state)
Perform sanity check on discrete state of given object state.
Object state vector indices based on state model.
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.
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 indexY(const unsigned char &model_id)
Get the vector-index that stores the y-position for a given model-id.
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 indexZ(const unsigned char &model_id)
Get the vector-index that stores the z-position for a given model-id.
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.
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.
void setYawRate(ObjectState &state, const double val, const bool reset_covariance=true)
Set the yaw-rate for a given object state.
void setSteeringAngleRear(ObjectState &state, const double val, const bool reset_covariance=true)
Set the rear wheel angle for a given object state.
void setHeight(ObjectState &state, const double val, const bool reset_covariance=true)
Set the height for a given object state.
void setAccLat(ObjectState &state, const double val, const bool reset_covariance=true)
Set the lateral acceleration for a given object state.
void setRollRate(ObjectState &state, const double val, const bool reset_covariance=true)
Set the roll-rate for a given object state.
void setSteeringAngleRateAck(ObjectState &state, const double val, const bool reset_covariance=true)
Set the ackermann steering angle rate for a given object state.
void setWidth(ObjectState &state, const double val, const bool reset_covariance=true)
Set the width for a given object state.
void setTrafficLightType(ObjectState &state, const uint8_t val)
Set the traffic light type for a given object state.
void setAccLon(ObjectState &state, const double val, const bool reset_covariance=true)
Set the longitudinal acceleration for a given object state.
void setVelLon(ObjectState &state, const double val, const bool reset_covariance=true)
Set the longitdunial velocity for a given object state.
void setSteeringAngleAck(ObjectState &state, const double val, const bool reset_covariance=true)
Set the ackermann steering angle for a given object state.
void setX(ObjectState &state, const double val, const bool reset_covariance=true)
Set the x-position for a given object state.
void setY(ObjectState &state, const double val, const bool reset_covariance=true)
Set the y-position for a given object state.
void setVelLat(ObjectState &state, const double val, const bool reset_covariance=true)
Set the lateral velocity for a given object state.
void setYaw(ObjectState &state, const double val, const bool reset_covariance=true)
Set the yaw for a given object state.
void setTrafficLightState(ObjectState &state, const uint8_t val)
Set the traffic light state for a given object state.
void setRoll(ObjectState &state, const double val, const bool reset_covariance=true)
Set the roll for a given object state.
void setLength(ObjectState &state, const double val, const bool reset_covariance=true)
Set the length for a given object state.
void setPitch(ObjectState &state, const double val, const bool reset_covariance=true)
Set the pitch for a given object state.
void setPitchRate(ObjectState &state, const double val, const bool reset_covariance=true)
Set the pitch-rate for a given object state.
void setStandstill(ObjectState &state, const bool val)
Set the standstill indication for a given object state.
void setZ(ObjectState &state, const double val, const bool reset_covariance=true)
Set the z-position for a given object state.
void setSteeringAngleFront(ObjectState &state, const double val, const bool reset_covariance=true)
Set the front wheel angle for a given object state.
Object state utility functions.
void setContinuousStateCovarianceToUnknownAt(ObjectState &state, const unsigned int i, const unsigned int j)
Set the continuous state covariance to unknown at (i,j) for a given object state.