Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Attributes | List of all members
kobuki::Command Class Reference

#include <command.hpp>

Inheritance diagram for kobuki::Command:
Inheritance graph
[legend]

Classes

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

Public Types

typedef ecl::PushAndPop< unsigned char > Buffer
 
typedef ecl::Stencil< BufferBufferStencil
 
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 }
 

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

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

Static Private Attributes

static const unsigned char header0 = 0xaa
 
static const unsigned char header1 = 0x55
 

Additional Inherited Members

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

Detailed Description

Definition at line 40 of file command.hpp.

Member Typedef Documentation

◆ Buffer

typedef ecl::PushAndPop<unsigned char> kobuki::Command::Buffer

Definition at line 49 of file command.hpp.

◆ BufferStencil

Definition at line 50 of file command.hpp.

Member Enumeration Documentation

◆ Name

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

Enumerator
BaseControl 
Sound 
SoundSequence 
RequestExtra 
ChangeFrame 
RequestEeprom 
SetDigitalOut 
SetController 
GetController 

Definition at line 55 of file command.hpp.

◆ VersionFlag

Enumerator
HardwareVersion 
FirmwareVersion 
UniqueDeviceID 

Definition at line 61 of file command.hpp.

Constructor & Destructor Documentation

◆ ~Command()

virtual kobuki::Command::~Command ( )
inlinevirtual

Definition at line 123 of file command.hpp.

Member Function Documentation

◆ GetControllerGain()

Command kobuki::Command::GetControllerGain ( )
static

Definition at line 192 of file command.cpp.

◆ GetVersionInfo()

Command kobuki::Command::GetVersionInfo ( )
static

Definition at line 150 of file command.cpp.

◆ PlaySoundSequence()

Command kobuki::Command::PlaySoundSequence ( const enum SoundSequences number,
Command::Data current_data 
)
static

Definition at line 139 of file command.cpp.

◆ resetBuffer()

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

Clears the command buffer and resets the header.

Definition at line 206 of file command.cpp.

◆ serialise()

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

Implements packet_handler::payloadBase.

Definition at line 214 of file command.cpp.

◆ SetControllerGain()

Command kobuki::Command::SetControllerGain ( const unsigned char &  type,
const unsigned int &  p_gain,
const unsigned int &  i_gain,
const unsigned int &  d_gain 
)
static

Definition at line 180 of file command.cpp.

◆ 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.

Todo:
could use far better documentation here/example here.
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.

Definition at line 88 of file command.cpp.

◆ 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.

Todo:
could use far better documentation here/example here.
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.

Definition at line 119 of file command.cpp.

◆ 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.

Definition at line 57 of file command.cpp.

◆ SetVelocityControl() [1/2]

Command kobuki::Command::SetVelocityControl ( const int16_t &  speed,
const int16_t &  radius 
)
static

Definition at line 171 of file command.cpp.

◆ SetVelocityControl() [2/2]

Command kobuki::Command::SetVelocityControl ( DiffDrive diff_drive)
static

Definition at line 161 of file command.cpp.

Member Data Documentation

◆ data

Data kobuki::Command::data

Definition at line 138 of file command.hpp.

◆ header0

const unsigned char kobuki::Command::header0 = 0xaa
staticprivate

Definition at line 145 of file command.hpp.

◆ header1

const unsigned char kobuki::Command::header1 = 0x55
staticprivate

Definition at line 146 of file command.hpp.


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


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Wed Mar 2 2022 00:26:14