perception_interfaces 1.0.0
Loading...
Searching...
No Matches
Functions | Variables
utils.h File Reference

Object state utility functions. More...

#include <cmath>
#include <perception_msgs_utils/impl/constants.h>

Go to the source code of this file.

Functions

int perception_msgs::object_access::getContinuousStateSize (const ObjectState &state)
 Get the continuous state size for a given object state.
 
template<typename T >
int perception_msgs::object_access::getContinuousStateSize (const T &obj)
 Get the continuous state size for a given template object that contains an object state.
 
int perception_msgs::object_access::getContinuousStateSize (const unsigned char &model_id)
 Get the continuous state size for a given model-id.
 
int perception_msgs::object_access::getDiscreteStateSize (const ObjectState &state)
 Get the discrete state size for a given object state.
 
template<typename T >
int perception_msgs::object_access::getDiscreteStateSize (const T &obj)
 Get the discrete state size for a given template object that contains an object state.
 
int perception_msgs::object_access::getDiscreteStateSize (const unsigned char &model_id)
 Get the discrete state size for a given model-id.
 
int perception_msgs::object_access::getContinuousStateCovarianceSize (const ObjectState &state)
 Get the continuous state covariance size for a given object state.
 
template<typename T >
int perception_msgs::object_access::getContinuousStateCovarianceSize (const T &obj)
 Get the continuous state covariance size for a given template object that contains an object state.
 
int perception_msgs::object_access::getContinuousStateCovarianceSize (const unsigned char &model_id)
 Get the continuous state covariance size for a given model-id.
 
void perception_msgs::object_access::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.
 

Variables

const std::string perception_msgs::object_access::kExceptionUnknownModel = "Unknown model ID: "
 

Detailed Description

Object state utility functions.

============================================================================ MIT License

Copyright (c) 2025 Institute for Automotive Engineering (ika), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

SOFTWARE.

Definition in file utils.h.

Function Documentation

◆ getContinuousStateCovarianceSize() [1/3]

int perception_msgs::object_access::getContinuousStateCovarianceSize ( const ObjectState &  state)
inline

Get the continuous state covariance size for a given object state.

Parameters
state
Returns
int

Definition at line 141 of file utils.h.

141 {
142 return state.continuous_state_covariance.size();
143 }

◆ getContinuousStateCovarianceSize() [2/3]

template<typename T >
int perception_msgs::object_access::getContinuousStateCovarianceSize ( const T &  obj)
inline

Get the continuous state covariance size for a given template object that contains an object state.

Template Parameters
T
Parameters
obj
Returns
int

Definition at line 153 of file utils.h.

153 {
154 return getContinuousStateCovarianceSize(obj.state);
155 }
int getContinuousStateCovarianceSize(const ObjectState &state)
Get the continuous state covariance size for a given object state.
Definition utils.h:141

◆ getContinuousStateCovarianceSize() [3/3]

int perception_msgs::object_access::getContinuousStateCovarianceSize ( const unsigned char &  model_id)
inline

Get the continuous state covariance size for a given model-id.

Parameters
model_id
Returns
int

Definition at line 163 of file utils.h.

163 {
164 return std::pow(getContinuousStateSize(model_id), 2);
165 }
int getContinuousStateSize(const ObjectState &state)
Get the continuous state size for a given object state.
Definition utils.h:51

◆ getContinuousStateSize() [1/3]

int perception_msgs::object_access::getContinuousStateSize ( const ObjectState &  state)
inline

Get the continuous state size for a given object state.

Parameters
state
Returns
int

Definition at line 51 of file utils.h.

51 {
52 return state.continuous_state.size();
53 }

◆ getContinuousStateSize() [2/3]

template<typename T >
int perception_msgs::object_access::getContinuousStateSize ( const T &  obj)
inline

Get the continuous state size for a given template object that contains an object state.

Template Parameters
T
Parameters
obj
Returns
int

Definition at line 63 of file utils.h.

63 {
64 return getContinuousStateSize(obj.state);
65 }

◆ getContinuousStateSize() [3/3]

int perception_msgs::object_access::getContinuousStateSize ( const unsigned char &  model_id)
inline

Get the continuous state size for a given model-id.

Parameters
model_id
Returns
int

Definition at line 73 of file utils.h.

73 {
74 switch(model_id) {
75 case EGO::MODEL_ID:
76 return EGO::CONTINUOUS_STATE_SIZE;
77 case EGORWS::MODEL_ID:
78 return EGORWS::CONTINUOUS_STATE_SIZE;
79 case ISCACTR::MODEL_ID:
80 return ISCACTR::CONTINUOUS_STATE_SIZE;
81 case HEXAMOTION::MODEL_ID:
82 return HEXAMOTION::CONTINUOUS_STATE_SIZE;
83 case TRAFFICLIGHT::MODEL_ID:
84 return TRAFFICLIGHT::CONTINUOUS_STATE_SIZE;
85 default:
86 throw std::invalid_argument(kExceptionUnknownModel + std::to_string(model_id));
87 }
88 }

◆ getDiscreteStateSize() [1/3]

int perception_msgs::object_access::getDiscreteStateSize ( const ObjectState &  state)
inline

Get the discrete state size for a given object state.

Parameters
state
Returns
int

Definition at line 96 of file utils.h.

96 {
97 return state.discrete_state.size();
98 }

◆ getDiscreteStateSize() [2/3]

template<typename T >
int perception_msgs::object_access::getDiscreteStateSize ( const T &  obj)
inline

Get the discrete state size for a given template object that contains an object state.

Template Parameters
T
Parameters
obj
Returns
int

Definition at line 108 of file utils.h.

108 {
109 return getDiscreteStateSize(obj.state);
110 }
int getDiscreteStateSize(const ObjectState &state)
Get the discrete state size for a given object state.
Definition utils.h:96

◆ getDiscreteStateSize() [3/3]

int perception_msgs::object_access::getDiscreteStateSize ( const unsigned char &  model_id)
inline

Get the discrete state size for a given model-id.

Parameters
model_id
Returns
int

Definition at line 118 of file utils.h.

118 {
119 switch(model_id) {
120 case EGO::MODEL_ID:
121 return EGO::DISCRETE_STATE_SIZE;
122 case EGORWS::MODEL_ID:
123 return EGORWS::DISCRETE_STATE_SIZE;
124 case ISCACTR::MODEL_ID:
125 return ISCACTR::DISCRETE_STATE_SIZE;
126 case HEXAMOTION::MODEL_ID:
127 return HEXAMOTION::DISCRETE_STATE_SIZE;
128 case TRAFFICLIGHT::MODEL_ID:
129 return TRAFFICLIGHT::DISCRETE_STATE_SIZE;
130 default:
131 throw std::invalid_argument(kExceptionUnknownModel + std::to_string(model_id));
132 }
133 }

◆ setContinuousStateCovarianceToUnknownAt()

void perception_msgs::object_access::setContinuousStateCovarianceToUnknownAt ( ObjectState &  state,
const unsigned int  i,
const unsigned int  j 
)
inline

Set the continuous state covariance to unknown at (i,j) for a given object state.

Parameters
state
i
j

Definition at line 174 of file utils.h.

174 {
175 const int n = getContinuousStateSize(state);
176 state.continuous_state_covariance[n * i + j] = CONTINUOUS_STATE_COVARIANCE_UNKNOWN;
177 }

Variable Documentation

◆ kExceptionUnknownModel

const std::string perception_msgs::object_access::kExceptionUnknownModel = "Unknown model ID: "

Definition at line 43 of file utils.h.