perception_interfaces 1.1.2
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.

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 120 of file utils.h.

120 {
121 return state.continuous_state_covariance.size();
122 }

◆ 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 132 of file utils.h.

132 {
133 return getContinuousStateCovarianceSize(obj.state);
134 }
int getContinuousStateCovarianceSize(const ObjectState &state)
Get the continuous state covariance size for a given object state.
Definition utils.h:120

◆ 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 142 of file utils.h.

142 {
143 return std::pow(getContinuousStateSize(model_id), 2);
144 }
int getContinuousStateSize(const ObjectState &state)
Get the continuous state size for a given object state.
Definition utils.h:30

◆ 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 30 of file utils.h.

30 {
31 return state.continuous_state.size();
32 }

◆ 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 42 of file utils.h.

42 {
43 return getContinuousStateSize(obj.state);
44 }

◆ 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 52 of file utils.h.

52 {
53 switch(model_id) {
54 case EGO::MODEL_ID:
55 return EGO::CONTINUOUS_STATE_SIZE;
56 case EGORWS::MODEL_ID:
57 return EGORWS::CONTINUOUS_STATE_SIZE;
58 case ISCACTR::MODEL_ID:
59 return ISCACTR::CONTINUOUS_STATE_SIZE;
60 case HEXAMOTION::MODEL_ID:
61 return HEXAMOTION::CONTINUOUS_STATE_SIZE;
62 case TRAFFICLIGHT::MODEL_ID:
63 return TRAFFICLIGHT::CONTINUOUS_STATE_SIZE;
64 default:
65 throw std::invalid_argument(kExceptionUnknownModel + std::to_string(model_id));
66 }
67 }

◆ 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 75 of file utils.h.

75 {
76 return state.discrete_state.size();
77 }

◆ 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 87 of file utils.h.

87 {
88 return getDiscreteStateSize(obj.state);
89 }
int getDiscreteStateSize(const ObjectState &state)
Get the discrete state size for a given object state.
Definition utils.h:75

◆ 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 97 of file utils.h.

97 {
98 switch(model_id) {
99 case EGO::MODEL_ID:
100 return EGO::DISCRETE_STATE_SIZE;
101 case EGORWS::MODEL_ID:
102 return EGORWS::DISCRETE_STATE_SIZE;
103 case ISCACTR::MODEL_ID:
104 return ISCACTR::DISCRETE_STATE_SIZE;
105 case HEXAMOTION::MODEL_ID:
106 return HEXAMOTION::DISCRETE_STATE_SIZE;
107 case TRAFFICLIGHT::MODEL_ID:
108 return TRAFFICLIGHT::DISCRETE_STATE_SIZE;
109 default:
110 throw std::invalid_argument(kExceptionUnknownModel + std::to_string(model_id));
111 }
112 }

◆ 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 153 of file utils.h.

153 {
154 const int n = getContinuousStateSize(state);
155 state.continuous_state_covariance[n * i + j] = CONTINUOUS_STATE_COVARIANCE_UNKNOWN;
156 }

Variable Documentation

◆ kExceptionUnknownModel

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

Definition at line 22 of file utils.h.