60#ifndef guWhiteboard_NaoWalkStatus_h
61#define guWhiteboard_NaoWalkStatus_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_NaoWalkStatus_DEFINED
73#define guWhiteboard_NaoWalkStatus_DEFINED
75#undef NaoWalkStatus_DEFINED
76#define NaoWalkStatus_DEFINED
104 this->init(t_walkEngineState, t_odometry, t_odometryResetCounter);
146 return !(*
this == t_other);
156 return !(*
this == t_other);
204#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
214#ifdef USE_WB_NAO_WALK_STATUS_C_CONVERSION
217 std::string descr = buffer;
220 std::ostringstream ss;
224 ss <<
"walkEngineState=" <<
"wes_Disconnected";
229 ss <<
"walkEngineState=" <<
"wes_StoppedReady";
234 ss <<
"walkEngineState=" <<
"wes_StoppedStanding";
239 ss <<
"walkEngineState=" <<
"wes_Walking";
252#ifdef USE_WB_NAO_WALK_STATUS_C_CONVERSION
255 std::string toString = buffer;
258 std::ostringstream ss;
262 ss <<
"wes_Disconnected";
267 ss <<
"wes_StoppedReady";
272 ss <<
"wes_StoppedStanding";
289#ifdef USE_WB_NAO_WALK_STATUS_C_CONVERSION
294 char * str_cstr =
const_cast<char *
>(t_str.c_str());
295 size_t temp_length = strlen(str_cstr);
296 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
301 char* var_str = &var_str_buffer[0];
303 char* key = &key_buffer[0];
310 if (index == 0 && str_cstr[0] ==
'{') {
316 for (
int i = index; i < length; i++) {
318 if (bracecount == 0 && str_cstr[i] ==
'=') {
323 if (bracecount == 0 && isspace(str_cstr[i])) {
330 if (bracecount == 0 && str_cstr[i] ==
',') {
334 if (str_cstr[i] ==
'{') {
338 if (str_cstr[i] ==
'}') {
340 if (bracecount < 0) {
345 if (i == length - 1) {
349 if (endKey >= startKey && endKey - startKey < length) {
350 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
351 key[(endKey - startKey) + 1] = 0;
355 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
356 var_str[(index - startVar) + 1] = 0;
362 if (strlen(key) > 0) {
363 if (0 == strcmp(
"walkEngineState", key)) {
365 }
else if (0 == strcmp(
"odometry", key)) {
367 }
else if (0 == strcmp(
"odometryResetCounter", key)) {
377 if (strcmp(
"wes_Disconnected", var_str) == 0) {
378#pragma clang diagnostic push
379#pragma clang diagnostic ignored "-Wbad-function-cast"
381#pragma clang diagnostic pop
382 }
else if (strcmp(
"wes_StoppedReady", var_str) == 0) {
383#pragma clang diagnostic push
384#pragma clang diagnostic ignored "-Wbad-function-cast"
386#pragma clang diagnostic pop
387 }
else if (strcmp(
"wes_StoppedStanding", var_str) == 0) {
388#pragma clang diagnostic push
389#pragma clang diagnostic ignored "-Wbad-function-cast"
391#pragma clang diagnostic pop
392 }
else if (strcmp(
"wes_Walking", var_str) == 0) {
393#pragma clang diagnostic push
394#pragma clang diagnostic ignored "-Wbad-function-cast"
396#pragma clang diagnostic pop
398#pragma clang diagnostic push
399#pragma clang diagnostic ignored "-Wbad-function-cast"
401#pragma clang diagnostic pop
421 }
while(index < length);
Provides a C++ wrapper around wb_nao_walk_status.
void from_string(const std::string &t_str)
void set_odometryResetCounter(const uint8_t &t_newValue)
uint8_t & odometryResetCounter()
NaoWalkStatus(enum WalkEngineState t_walkEngineState=wes_Disconnected, struct wb_odometry t_odometry=wb_odometry(), uint8_t t_odometryResetCounter=0)
Create a new NaoWalkStatus.
void set_walkEngineState(const enum WalkEngineState &t_newValue)
void set_odometry(const Odometry &t_newValue)
bool operator==(const NaoWalkStatus &t_other) const
NaoWalkStatus(const struct wb_nao_walk_status &t_other)
Copy Constructor.
bool operator!=(const NaoWalkStatus &t_other) const
NaoWalkStatus(const NaoWalkStatus &t_other)
Copy Constructor.
NaoWalkStatus & operator=(const NaoWalkStatus &t_other)
Copy Assignment Operator.
std::string description()
const uint8_t & odometryResetCounter() const
NaoWalkStatus(const std::string &t_str)
String Constructor.
enum WalkEngineState & walkEngineState() const
const Odometry & odometry() const
enum WalkEngineState & walkEngineState()
Provides a C++ wrapper around wb_odometry.
std::string description()
void from_string(const std::string &t_str)
WHITEBOARD_POSTER_STRING_CONVERSION.
enum WalkEngineState walkEngineState
The current state of the walk engine, see enum documentation.
struct wb_odometry odometry
Current odometry object.
uint8_t odometryResetCounter
A counter used to reset the odometry object, change this value and send it via NaoWalkCommand to trig...
WHITEBOARD_POSTER_STRING_CONVERSION.
const char * wb_nao_walk_status_description(const struct wb_nao_walk_status *self, char *descString, size_t bufferSize)
Convert to a description string.
const char * wb_nao_walk_status_to_string(const struct wb_nao_walk_status *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_nao_walk_status * wb_nao_walk_status_from_string(struct wb_nao_walk_status *self, const char *str)
Convert from a string.
#define NAOWALKSTATUS_DESC_BUFFER_SIZE
@ wes_StoppedReady
In the Crouched stance, ready to walk again straight away but not currently moving anywhere.
@ wes_StoppedStanding
In the Standing position, this position uses less power than Stopped / Crouched, it is a minimal stif...
@ wes_Walking
Walking around, includes stopping, kicking, transition from Standing etc... basically the walk engine...
@ wes_Disconnected
Not connected to the DCM, does not control any joints in this state.
#define NAOWALKSTATUS_TO_STRING_BUFFER_SIZE