60#ifndef guWhiteboard_FilteredVisionObject_h
61#define guWhiteboard_FilteredVisionObject_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_FilteredVisionObject_DEFINED
73#define guWhiteboard_FilteredVisionObject_DEFINED
75#undef FilteredVisionObject_DEFINED
76#define FilteredVisionObject_DEFINED
90 void init(uint64_t t_visibilityHistory = 0, int32_t t_frameCounter = 0, int16_t t_distance = 0, int16_t t_x = 0, int16_t t_y = 0, int16_t t_yaw = 0, int16_t t_ray_angle = 0,
bool t_isVisible =
true,
bool t_pad1 =
true) {
107 FilteredVisionObject(uint64_t t_visibilityHistory = 0, int32_t t_frameCounter = 0, int16_t t_distance = 0, int16_t t_x = 0, int16_t t_y = 0, int16_t t_yaw = 0, int16_t t_ray_angle = 0,
bool t_isVisible =
true,
bool t_pad1 =
true) {
108 this->init(t_visibilityHistory, t_frameCounter, t_distance, t_x, t_y, t_yaw, t_ray_angle, t_isVisible, t_pad1);
146 &&
x() == t_other.
x()
147 &&
y() == t_other.
y()
156 return !(*
this == t_other);
166 return !(*
this == t_other);
219 const int16_t &
x()
const
224 void set_x(
const int16_t &t_newValue)
234 const int16_t &
y()
const
239 void set_y(
const int16_t &t_newValue)
249 const int16_t &
yaw()
const
304#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
314#ifdef USE_WB_FILTERED_VISION_OBJECT_C_CONVERSION
317 std::string descr = buffer;
320 std::ostringstream ss;
323 ss <<
"frameCounter=" <<
static_cast<signed>(this->
frameCounter());
325 ss <<
"distance=" <<
static_cast<signed>(this->
distance());
327 ss <<
"x=" <<
static_cast<signed>(this->
x());
329 ss <<
"y=" <<
static_cast<signed>(this->
y());
331 ss <<
"yaw=" <<
static_cast<signed>(this->
yaw());
333 ss <<
"ray_angle=" <<
static_cast<signed>(this->
ray_angle());
335 ss <<
"isVisible=" << (this->
isVisible() ?
"true" :
"false");
337 ss <<
"pad1=" << (this->
pad1() ?
"true" :
"false");
343#ifdef USE_WB_FILTERED_VISION_OBJECT_C_CONVERSION
346 std::string toString = buffer;
349 std::ostringstream ss;
354 ss << static_cast<signed>(this->
distance());
356 ss << static_cast<signed>(this->
x());
358 ss << static_cast<signed>(this->
y());
360 ss << static_cast<signed>(this->
yaw());
362 ss << static_cast<signed>(this->
ray_angle());
364 ss << (this->
isVisible() ?
"true" :
"false");
366 ss << (this->
pad1() ?
"true" :
"false");
371#ifdef USE_WB_FILTERED_VISION_OBJECT_C_CONVERSION
376 char * str_cstr =
const_cast<char *
>(t_str.c_str());
377 size_t temp_length = strlen(str_cstr);
378 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
383 char* var_str = &var_str_buffer[0];
385 char* key = &key_buffer[0];
392 if (index == 0 && str_cstr[0] ==
'{') {
398 for (
int i = index; i < length; i++) {
400 if (bracecount == 0 && str_cstr[i] ==
'=') {
405 if (bracecount == 0 && isspace(str_cstr[i])) {
412 if (bracecount == 0 && str_cstr[i] ==
',') {
416 if (str_cstr[i] ==
'{') {
420 if (str_cstr[i] ==
'}') {
422 if (bracecount < 0) {
427 if (i == length - 1) {
431 if (endKey >= startKey && endKey - startKey < length) {
432 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
433 key[(endKey - startKey) + 1] = 0;
437 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
438 var_str[(index - startVar) + 1] = 0;
444 if (strlen(key) > 0) {
445 if (0 == strcmp(
"visibilityHistory", key)) {
447 }
else if (0 == strcmp(
"frameCounter", key)) {
449 }
else if (0 == strcmp(
"distance", key)) {
451 }
else if (0 == strcmp(
"x", key)) {
453 }
else if (0 == strcmp(
"y", key)) {
455 }
else if (0 == strcmp(
"yaw", key)) {
457 }
else if (0 == strcmp(
"ray_angle", key)) {
459 }
else if (0 == strcmp(
"isVisible", key)) {
461 }
else if (0 == strcmp(
"pad1", key)) {
485 this->
set_distance(
static_cast<int16_t
>(atoi(var_str)));
490 this->
set_x(
static_cast<int16_t
>(atoi(var_str)));
495 this->
set_y(
static_cast<int16_t
>(atoi(var_str)));
500 this->
set_yaw(
static_cast<int16_t
>(atoi(var_str)));
510 this->
set_isVisible(strcmp(var_str,
"true") == 0 || strcmp(var_str,
"1") == 0);
515 this->
set_pad1(strcmp(var_str,
"true") == 0 || strcmp(var_str,
"1") == 0);
522 }
while(index < length);
Provides a C++ wrapper around wb_filtered_vision_object.
FilteredVisionObject(const FilteredVisionObject &t_other)
Copy Constructor.
void set_ray_angle(const int16_t &t_newValue)
const int16_t & x() const
std::string description()
const int16_t & yaw() const
void set_x(const int16_t &t_newValue)
FilteredVisionObject(const struct wb_filtered_vision_object &t_other)
Copy Constructor.
void set_visibilityHistory(const uint64_t &t_newValue)
const int32_t & frameCounter() const
FilteredVisionObject(uint64_t t_visibilityHistory=0, int32_t t_frameCounter=0, int16_t t_distance=0, int16_t t_x=0, int16_t t_y=0, int16_t t_yaw=0, int16_t t_ray_angle=0, bool t_isVisible=true, bool t_pad1=true)
Create a new FilteredVisionObject.
void set_pad1(const bool &t_newValue)
void set_y(const int16_t &t_newValue)
uint64_t & visibilityHistory()
bool operator==(const FilteredVisionObject &t_other) const
void set_isVisible(const bool &t_newValue)
void from_string(const std::string &t_str)
const int16_t & y() const
FilteredVisionObject & operator=(const FilteredVisionObject &t_other)
Copy Assignment Operator.
const bool & isVisible() const
FilteredVisionObject(const std::string &t_str)
String Constructor.
bool operator!=(const FilteredVisionObject &t_other) const
const uint64_t & visibilityHistory() const
const int16_t & distance() const
const int16_t & ray_angle() const
void set_frameCounter(const int32_t &t_newValue)
void set_distance(const int16_t &t_newValue)
const bool & pad1() const
void set_yaw(const int16_t &t_newValue)
WHITEBOARD_POSTER_STRING_CONVERSION.
bool pad1
16 bit padding .
int16_t x
centre x-coordinate in image (0,0) is the centre of the image, positive is to the right
int32_t frameCounter
incremented every time we do not see the object.
int16_t distance
distance to landmark in cm
uint64_t visibilityHistory
a 64-bit history of whether vision said visible 1 or not visible 0.
int16_t yaw
the Yaw in Degrees when the object was last used to generated filtered values.
int16_t ray_angle
In degrees, position of the object, positive is left, negative is right, with distance polar position...
int16_t y
centre y-coordinate in image, positive is upwards
bool isVisible
is this a credible sighting.
const char * wb_filtered_vision_object_to_string(const struct wb_filtered_vision_object *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_filtered_vision_object_description(const struct wb_filtered_vision_object *self, char *descString, size_t bufferSize)
Convert to a description string.
struct wb_filtered_vision_object * wb_filtered_vision_object_from_string(struct wb_filtered_vision_object *self, const char *str)
Convert from a string.
#define FILTERED_VISION_OBJECT_TO_STRING_BUFFER_SIZE
#define FILTERED_VISION_OBJECT_DESC_BUFFER_SIZE