Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
toposens_driver::Command Class Reference

Generates firmware-compatible commands for tuning performance parameters. More...

#include <command.h>

Public Member Functions

 Command (TsParam param, float value)
 
 Command (TsService service)
 
char * getBytes ()
 
TsParam getParam ()
 
std::string getParamName ()
 
float getValue ()
 

Private Member Functions

std::string _getKey (TsParam param)
 
std::string _getKey (TsService service)
 

Private Attributes

char _bytes [50]
 
TsParam _param
 
float _value
 
const int MAX_VALUE = 9999
 
const int MIN_VALUE = -9999
 

Static Private Attributes

static const char kPrefix = 'C'
 

Detailed Description

Generates firmware-compatible commands for tuning performance parameters.

Firmware defines commands in two formats, singular and dimensional. Singular commands expect one parameter value, dimensional commands expect XYZ limits defining a spatial cuboid. Currently, only the voxel filtering command is dimensionally formatted.

Note that all desired values are transmitted as zero-padded 5-byte strings, and the first byte is always reserved for the arithmetic sign: 0 for positive values, - for negative values.

Note that modifications on these parameters are done on the sensor chip, not in this driver

Definition at line 60 of file command.h.

Constructor & Destructor Documentation

◆ Command() [1/2]

toposens_driver::Command::Command ( TsParam  param,
float  value 
)

Builds a command message accepted by the TS firmware.

Parameters
paramSetting name from the enumerated TsParam list.
valueDesired integer value for sensor parameter.

All desired values are transmitted as zero-padded 5-byte string. The first byte is always reserved for the arithmetic sign: 0 for positive values, - for negative values. The function also clips desired parameter values to predefined bounds.

Command format:
- Starts with kPrefix
- 5 bytes defining firmware parameter to update
- 5 bytes with desired parameter value
- Terminating carriage return

Definition at line 21 of file command.cpp.

◆ Command() [2/2]

toposens_driver::Command::Command ( TsService  service)

Builds a command message accepted by the TS firmware to invoke a service.

Parameters
paramService name from the enumerated TsService list.

Compiles command string for service requests.

Command format:
- Starts with kPrefix
- 5 bytes defining firmware service
- Terminating carriage return

Definition at line 55 of file command.cpp.

Member Function Documentation

◆ _getKey() [1/2]

std::string toposens_driver::Command::_getKey ( TsParam  param)
private

Looks up command keys defined by the TS firmware corresponding to given setting parameters.

Parameters
paramSetting name from the enumerated command list.
Returns
Corresponding firmware parameter key.

Paramter keys are 5-byte strings hard-coded in the TS device firmware.

Definition at line 65 of file command.cpp.

◆ _getKey() [2/2]

std::string toposens_driver::Command::_getKey ( TsService  service)
private

Looks up service keys defined by the TS firmware.

Parameters
paramservice name from the enumerated command list.
Returns
Corresponding firmware service key.

Command keys are 5-byte strings hard-coded in the TS device firmware.

Definition at line 83 of file command.cpp.

◆ getBytes()

char* toposens_driver::Command::getBytes ( )
inline

Returns the latest command message produced by generate().

Returns
Pointer to a char array containing command.

Definition at line 91 of file command.h.

◆ getParam()

TsParam toposens_driver::Command::getParam ( )
inline

Returns this object's parameter enumeration value denoting the firmware parameter to be updated.

Returns
parameter

Definition at line 79 of file command.h.

◆ getParamName()

std::string toposens_driver::Command::getParamName ( )

Looks up command name defined by the TsDriver configuration to given setting parameters.

Returns
Corresponding dynamic reconfigure name.

Command keys are 5-byte strings hard-coded in the TS device firmware.

Definition at line 93 of file command.cpp.

◆ getValue()

float toposens_driver::Command::getValue ( )
inline

Returns this object's parameter value denoting the parameter value to be set.

Returns
value

Definition at line 86 of file command.h.

Member Data Documentation

◆ _bytes

char toposens_driver::Command::_bytes[50]
private

Large enough buffer to hold a well-formed command.

Definition at line 103 of file command.h.

◆ _param

TsParam toposens_driver::Command::_param
private

Parameter to be encoded in command bytes.

Definition at line 105 of file command.h.

◆ _value

float toposens_driver::Command::_value
private

Parameeter value to be encoded in command bytes.

Definition at line 106 of file command.h.

◆ kPrefix

const char toposens_driver::Command::kPrefix = 'C'
staticprivate

Designates a string as a firmware command.

Definition at line 104 of file command.h.

◆ MAX_VALUE

const int toposens_driver::Command::MAX_VALUE = 9999
private

Definition at line 100 of file command.h.

◆ MIN_VALUE

const int toposens_driver::Command::MIN_VALUE = -9999
private

Definition at line 101 of file command.h.


The documentation for this class was generated from the following files:


toposens_driver
Author(s): Adi Singh, Sebastian Dengler, Christopher Lang, Roua Mokchah, Nancy Seckel, Georgiana Barbut
autogenerated on Mon Feb 28 2022 23:57:40