Cheetah Software  1.0
ControlParameters.cpp File Reference

Interface to set gains/control parameters for simulator and robot These are designed to be updated infrequently. For high frequency data, consider using Driver Inputs or adding to the Robot Debug Data instead. More...

#include "ControlParameters/ControlParameters.h"
#include "INIReader.h"
#include "ParamHandler.hpp"
#include "Utilities/utilities.h"
#include <utility>
+ Include dependency graph for ControlParameters.cpp:

Go to the source code of this file.

Macros

#define YAML_COLLECTION_NAME_KEY   "__collection-name__"
 

Functions

std::string controlParameterValueKindToString (ControlParameterValueKind valueKind)
 
std::string controlParameterValueToString (ControlParameterValue value, ControlParameterValueKind kind)
 
ControlParameterValueKind getControlParameterValueKindFromString (const std::string &str)
 

Detailed Description

Interface to set gains/control parameters for simulator and robot These are designed to be updated infrequently. For high frequency data, consider using Driver Inputs or adding to the Robot Debug Data instead.

Definition in file ControlParameters.cpp.

Macro Definition Documentation

#define YAML_COLLECTION_NAME_KEY   "__collection-name__"

Definition at line 14 of file ControlParameters.cpp.

Function Documentation

std::string controlParameterValueKindToString ( ControlParameterValueKind  valueKind)

Definition at line 16 of file ControlParameters.cpp.

References DOUBLE, FLOAT, S64, VEC3_DOUBLE, and VEC3_FLOAT.

17  {
18  switch (valueKind) {
20  return "s64";
22  return "double";
24  return "float";
26  return "vec3d";
28  return "vec3f";
29  default:
30  return "unknown-ControlParameterValueKind";
31  }
32 }

+ Here is the caller graph for this function:

std::string controlParameterValueToString ( ControlParameterValue  value,
ControlParameterValueKind  kind 
)

Definition at line 34 of file ControlParameters.cpp.

References ControlParameterValue::d, DOUBLE, ControlParameterValue::f, FLOAT, ControlParameterValue::i, numberToString(), S64, VEC3_DOUBLE, VEC3_FLOAT, ControlParameterValue::vec3d, and ControlParameterValue::vec3f.

35  {
36  std::string result;
37  switch (kind) {
39  result += numberToString(value.d);
40  break;
42  result += numberToString(value.f);
43  break;
45  result += std::to_string(value.i);
46  break;
48  result += "[";
49  result += numberToString(value.vec3f[0]) + ", ";
50  result += numberToString(value.vec3f[1]) + ", ";
51  result += numberToString(value.vec3f[2]) + "]";
52  break;
54  result += "[";
55  result += numberToString(value.vec3d[0]) + ", ";
56  result += numberToString(value.vec3d[1]) + ", ";
57  result += numberToString(value.vec3d[2]) + "]";
58  break;
59  default:
60  result += "<unknown type " + std::to_string((u32)(kind)) +
61  "> (add it yourself in ControlParameterInterface.h!)";
62  break;
63  }
64  return result;
65 }
std::string numberToString(T number)
Definition: utilities.h:130
uint32_t u32
Definition: cTypes.h:18

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ControlParameterValueKind getControlParameterValueKindFromString ( const std::string &  str)

Definition at line 257 of file ControlParameters.cpp.

References DOUBLE, FLOAT, S64, VEC3_DOUBLE, and VEC3_FLOAT.

257  {
258  if(str.find('[') != std::string::npos) {
259  // vec type
260  if(str.find('f') != std::string::npos) {
262  } else {
264  }
265  } else {
266  // scalar type
267  if(str.find('.') != std::string::npos) {
268  if(str.find('f') != std::string::npos) {
270  } else {
272  }
273  } else {
274  // integer
276  }
277  }
278 }

+ Here is the caller graph for this function: