16namespace perception_msgs {
18namespace object_access {
27 inline void setX(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
29 const int idx =
indexX(state.model_id);
30 state.continuous_state[idx] = val;
43 inline void setX(T& obj,
const double val,
const bool reset_covariance =
true) {
44 setX(obj.state, val, reset_covariance);
54 inline void setY(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
56 const int idx =
indexY(state.model_id);
57 state.continuous_state[idx] = val;
70 inline void setY(T& obj,
const double val,
const bool reset_covariance =
true) {
71 setY(obj.state, val, reset_covariance);
81 inline void setZ(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
83 const int idx =
indexZ(state.model_id);
84 state.continuous_state[idx] = val;
97 inline void setZ(T& obj,
const double val,
const bool reset_covariance =
true) {
98 setZ(obj.state, val, reset_covariance);
108 inline void setVelLon(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
111 state.continuous_state[idx] = val;
123 template <
typename T>
124 inline void setVelLon(T& obj,
const double val,
const bool reset_covariance =
true) {
125 setVelLon(obj.state, val, reset_covariance);
135 inline void setVelLat(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
138 state.continuous_state[idx] = val;
150 template <
typename T>
151 inline void setVelLat(T& obj,
const double val,
const bool reset_covariance =
true) {
152 setVelLat(obj.state, val, reset_covariance);
162 inline void setAccLon(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
165 state.continuous_state[idx] = val;
177 template <
typename T>
178 inline void setAccLon(T& obj,
const double val,
const bool reset_covariance =
true) {
179 setAccLon(obj.state, val, reset_covariance);
189 inline void setAccLat(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
192 state.continuous_state[idx] = val;
204 template <
typename T>
205 inline void setAccLat(T& obj,
const double val,
const bool reset_covariance =
true) {
206 setAccLat(obj.state, val, reset_covariance);
216 inline void setRoll(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
218 double capped_val = val;
219 capped_val -= 2.0 * M_PI * std::floor((capped_val + M_PI) * (M_1_PI * 0.5));
220 if (capped_val <= -M_PI) capped_val += 2 * M_PI;
221 const int idx =
indexRoll(state.model_id);
222 state.continuous_state[idx] = capped_val;
234 template <
typename T>
235 inline void setRoll(T& obj,
const double val,
const bool reset_covariance =
true) {
236 setRoll(obj.state, val, reset_covariance);
246 inline void setRollRate(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
249 state.continuous_state[idx] = val;
261 template <
typename T>
262 inline void setRollRate(T& obj,
const double val,
const bool reset_covariance =
true) {
273 inline void setPitch(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
275 double capped_val = val;
276 capped_val -= 2.0 * M_PI * std::floor((capped_val + M_PI) * (M_1_PI * 0.5));
277 if (capped_val <= -M_PI) capped_val += 2 * M_PI;
279 state.continuous_state[idx] = capped_val;
291 template <
typename T>
292 inline void setPitch(T& obj,
const double val,
const bool reset_covariance =
true) {
293 setPitch(obj.state, val, reset_covariance);
303 inline void setPitchRate(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
306 state.continuous_state[idx] = val;
318 template <
typename T>
319 inline void setPitchRate(T& obj,
const double val,
const bool reset_covariance =
true) {
330 inline void setYaw(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
332 double capped_val = val;
333 capped_val -= 2.0 * M_PI * std::floor((capped_val + M_PI) * (M_1_PI * 0.5));
334 if (capped_val <= -M_PI) capped_val += 2 * M_PI;
335 const int idx =
indexYaw(state.model_id);
336 state.continuous_state[idx] = capped_val;
348 template <
typename T>
349 inline void setYaw(T& obj,
const double val,
const bool reset_covariance =
true) {
350 setYaw(obj.state, val, reset_covariance);
360 inline void setYawRate(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
363 state.continuous_state[idx] = val;
375 template <
typename T>
376 inline void setYawRate(T& obj,
const double val,
const bool reset_covariance =
true) {
387 inline void setSteeringAngleAck(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
390 state.continuous_state[idx] = val;
402 template <
typename T>
417 state.continuous_state[idx] = val;
429 template <
typename T>
444 state.continuous_state[idx] = val;
456 template <
typename T>
471 state.continuous_state[idx] = val;
483 template <
typename T>
495 inline void setWidth(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
498 state.continuous_state[idx] = val;
510 template <
typename T>
511 inline void setWidth(T& obj,
const double val,
const bool reset_covariance =
true) {
512 setWidth(obj.state, val, reset_covariance);
522 inline void setLength(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
525 state.continuous_state[idx] = val;
537 template <
typename T>
538 inline void setLength(T& obj,
const double val,
const bool reset_covariance =
true) {
539 setLength(obj.state, val, reset_covariance);
549 inline void setHeight(ObjectState& state,
const double val,
const bool reset_covariance =
true) {
552 state.continuous_state[idx] = val;
564 template <
typename T>
565 inline void setHeight(T& obj,
const double val,
const bool reset_covariance =
true) {
566 setHeight(obj.state, val, reset_covariance);
578 state.discrete_state[idx] = val;
588 template <
typename T>
602 state.discrete_state[idx] = val;
612 template <
typename T>
626 state.discrete_state[idx] = val;
636 template <
typename T>
650 state.discrete_state[idx] = val;
660 template <
typename T>
674 state.discrete_state[idx] = val;
685 template <
typename T>
699 state.discrete_state[idx] = val;
710 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 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.
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.
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.
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 setReverseLight(ObjectState &state, const uint8_t val)
Set the reverse light for a given object state.
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 setTurnIndicator(ObjectState &state, const uint8_t val)
Set the turn indicator 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 setBrakeLight(ObjectState &state, const uint8_t val)
Set the brake light 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.