60#ifndef guWhiteboard_ParticlePosition_h
61#define guWhiteboard_ParticlePosition_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
73#undef guWhiteboard_ParticlePosition_DEFINED
74#define guWhiteboard_ParticlePosition_DEFINED
76#undef ParticlePosition_DEFINED
77#define ParticlePosition_DEFINED
93 void init(
struct wb_point2d t_position =
wb_point2d(), int16_t t_headingInDegrees = 0,
float t_confidence = 0.0f) {
105 this->init(t_position, t_headingInDegrees, t_confidence);
147 return !(*
this == t_other);
157 return !(*
this == t_other);
205#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
215#ifdef USE_WB_PARTICLE_POSITION_C_CONVERSION
218 std::string descr = buffer;
221 std::ostringstream ss;
232#ifdef USE_WB_PARTICLE_POSITION_C_CONVERSION
235 std::string toString = buffer;
238 std::ostringstream ss;
248#ifdef USE_WB_PARTICLE_POSITION_C_CONVERSION
253 char * str_cstr =
const_cast<char *
>(t_str.c_str());
254 size_t temp_length = strlen(str_cstr);
255 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
260 char* var_str = &var_str_buffer[0];
262 char* key = &key_buffer[0];
269 if (index == 0 && str_cstr[0] ==
'{') {
275 for (
int i = index; i < length; i++) {
277 if (bracecount == 0 && str_cstr[i] ==
'=') {
282 if (bracecount == 0 && isspace(str_cstr[i])) {
289 if (bracecount == 0 && str_cstr[i] ==
',') {
293 if (str_cstr[i] ==
'{') {
297 if (str_cstr[i] ==
'}') {
299 if (bracecount < 0) {
304 if (i == length - 1) {
308 if (endKey >= startKey && endKey - startKey < length) {
309 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
310 key[(endKey - startKey) + 1] = 0;
314 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
315 var_str[(index - startVar) + 1] = 0;
321 if (strlen(key) > 0) {
322 if (0 == strcmp(
"position", key)) {
324 }
else if (0 == strcmp(
"headingInDegrees", key)) {
326 }
else if (0 == strcmp(
"confidence", key)) {
355 }
while(index < length);
Provides a C++ wrapper around wb_particle_position.
std::string description()
int16_t & headingInDegrees()
bool operator!=(const ParticlePosition &t_other) const
ParticlePosition & operator=(const ParticlePosition &t_other)
Copy Assignment Operator.
const Point2D & position() const
bool operator==(const ParticlePosition &t_other) const
ParticlePosition(const struct wb_particle_position &t_other)
Copy Constructor.
const float & confidence() const
void set_position(const Point2D &t_newValue)
ParticlePosition(const ParticlePosition &t_other)
Copy Constructor.
const int16_t & headingInDegrees() const
void set_confidence(const float &t_newValue)
ParticlePosition(struct wb_point2d t_position=wb_point2d(), int16_t t_headingInDegrees=0, float t_confidence=0.0f)
Create a new ParticlePosition.
ParticlePosition(const std::string &t_str)
String Constructor.
void set_headingInDegrees(const int16_t &t_newValue)
void from_string(const std::string &t_str)
Provides a C++ wrapper around wb_point2d.
void from_string(const std::string &t_str)
std::string description()
WHITEBOARD_POSTER_STRING_CONVERSION.
struct wb_point2d position
position in the soccer field, The origin (0,0) us the center of the soccer field, larger Y is along t...
float confidence
degre of certaintity that this a reliable locaiton where the robot is, should be between 0 and 1
int16_t headingInDegrees
90 degrees is looking ahead into the oponetns goal.
WHITEBOARD_POSTER_STRING_CONVERSION.
const char * wb_particle_position_description(const struct wb_particle_position *self, char *descString, size_t bufferSize)
Convert to a description string.
const char * wb_particle_position_to_string(const struct wb_particle_position *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_particle_position * wb_particle_position_from_string(struct wb_particle_position *self, const char *str)
Convert from a string.
#define PARTICLE_POSITION_DESC_BUFFER_SIZE
#define PARTICLE_POSITION_TO_STRING_BUFFER_SIZE