Kobuki 1.0.0
C++ API for the Kobuki research robot
Loading...
Searching...
No Matches
kobuki::Command Class Reference
Inheritance diagram for kobuki::Command:
Collaboration diagram for kobuki::Command:

Classes

struct  Data
 Data structure containing data for commands. More...
 

Public Types

enum  Name {
  BaseControl = 1 , Sound = 3 , SoundSequence = 4 , RequestExtra = 9 ,
  ChangeFrame = 10 , RequestEeprom = 11 , SetDigitalOut = 12 , SetController = 13 ,
  GetController = 14
}
 
enum  VersionFlag { HardwareVersion = 0x01 , FirmwareVersion = 0x02 , UniqueDeviceID = 0x08 }
 
typedef ecl::PushAndPop< unsigned char > Buffer
 
typedef ecl::Stencil< Buffer > BufferStencil
 

Public Member Functions

void resetBuffer (Buffer &buffer)
 
bool serialise (ecl::PushAndPop< unsigned char > &byteStream)
 
bool deserialise (ecl::PushAndPop< unsigned char > &)
 
- Public Member Functions inherited from packet_handler::payloadBase
 payloadBase (const bool is_dynamic_=false, const unsigned char length_=0)
 

Static Public Member Functions

static Command SetLedArray (const enum LedNumber &number, const enum LedColour &colour, Command::Data &current_data)
 
static Command SetDigitalOutput (const DigitalOutput &digital_output, Command::Data &current_data)
 
static Command SetExternalPower (const DigitalOutput &digital_output, Command::Data &current_data)
 
static Command PlaySoundSequence (const enum SoundSequences &number)
 
static Command GetVersionInfo ()
 
static Command SetVelocityControl (DiffDrive &diff_drive)
 
static Command SetVelocityControl (const int16_t &speed, const int16_t &radius)
 
static Command SetControllerGain (const unsigned char &type, const unsigned int &p_gain, const unsigned int &i_gain, const unsigned int &d_gain)
 
static Command GetControllerGain ()
 

Public Attributes

Data data
 
- Public Attributes inherited from packet_handler::payloadBase
bool yes
 
const bool is_dynamic
 
const unsigned char length
 

Additional Inherited Members

- Protected Member Functions inherited from packet_handler::payloadBase
template<typename T >
void buildVariable (T &V, ecl::PushAndPop< unsigned char > &buffer)
 
template<typename T >
void buildBytes (const T &V, ecl::PushAndPop< unsigned char > &buffer)
 

Member Enumeration Documentation

◆ Name

These values are used to detect the type of sub-payload that is ensuing.

Member Function Documentation

◆ deserialise()

bool kobuki::Command::deserialise ( ecl::PushAndPop< unsigned char > &  )
inlinevirtual

Unused

Implements packet_handler::payloadBase.

◆ resetBuffer()

void kobuki::Command::resetBuffer ( Buffer &  buffer)

Clears the command buffer and resets the header.

◆ serialise()

bool kobuki::Command::serialise ( ecl::PushAndPop< unsigned char > &  byteStream)
virtual

◆ SetDigitalOutput()

Command kobuki::Command::SetDigitalOutput ( const DigitalOutput digital_output,
Command::Data current_data 
)
static

Set one of the digital out pins available to the user.

They set the last 4 bits on the data.gp_out variable.

Parameters
digital_output: mask and value to send
current_data: need to store settings as the gp_output command is a combo command
Returns
Command : the command to send down the wire.

◆ SetExternalPower()

Command kobuki::Command::SetExternalPower ( const DigitalOutput digital_output,
Command::Data current_data 
)
static

Set one of the external power sources available to the user.

They set the second 4 bits(0x00f0) on the data.gp_out variable.

Parameters
digital_output: mask and value to send
current_data: need to store settings as the gp_output command is a combo command
Returns
Command : the command to send down the wire.

◆ SetLedArray()

Command kobuki::Command::SetLedArray ( const enum LedNumber &  number,
const enum LedColour &  colour,
Command::Data current_data 
)
static

Update the gp_out bits and get ready for sending as a SetDigitalOut command.

The led arrays are obtained from the gp_outputs with a 0x0f00 mask.

  • Led1 Red : 0x0100
  • Led1 Green : 0x0200
  • Led1 Orange : 0x0300
  • Led2 Red : 0x0400
  • Led2 Green : 0x0800
  • Led2 Orange : 0x0c00

Important to overlay this on top of the existing gp_out configuration.

Parameters
number: led enumerated number
colour: green, orange, red or black
current_data: need to store settings as the gp_output command is a combo command
Returns
Command : the command to send down the wire.

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