#include <command.hpp>
Classes | |
struct | Data |
Data structure containing data for commands. More... | |
Public Types | |
typedef ecl::PushAndPop < unsigned char > | Buffer |
typedef ecl::Stencil< Buffer > | BufferStencil |
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 | |
bool | deserialise (ecl::PushAndPop< unsigned char > &byteStream) |
void | resetBuffer (Buffer &buffer) |
bool | serialise (ecl::PushAndPop< unsigned char > &byteStream) |
virtual | ~Command () |
Static Public Member Functions | |
static Command | GetControllerGain () |
static Command | GetVersionInfo () |
static Command | PlaySoundSequence (const enum SoundSequences &number, Command::Data ¤t_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 ¤t_data) |
static Command | SetExternalPower (const DigitalOutput &digital_output, Command::Data ¤t_data) |
static Command | SetLedArray (const enum LedNumber &number, const enum LedColour &colour, Command::Data ¤t_data) |
static Command | SetVelocityControl (DiffDrive &diff_drive) |
static Command | SetVelocityControl (const int16_t &speed, const int16_t &radius) |
Public Attributes | |
Data | data |
Static Private Attributes | |
static const unsigned char | header0 = 0xaa |
static const unsigned char | header1 = 0x55 |
Definition at line 34 of file command.hpp.
typedef ecl::PushAndPop<unsigned char> kobuki::Command::Buffer |
Definition at line 37 of file command.hpp.
typedef ecl::Stencil< Buffer > kobuki::Command::BufferStencil |
Definition at line 38 of file command.hpp.
These values are used to detect the type of sub-payload that is ensuing.
BaseControl | |
Sound | |
SoundSequence | |
RequestExtra | |
ChangeFrame | |
RequestEeprom | |
SetDigitalOut | |
SetController | |
GetController |
Definition at line 43 of file command.hpp.
Definition at line 49 of file command.hpp.
virtual kobuki::Command::~Command | ( | ) | [inline, virtual] |
Definition at line 111 of file command.hpp.
bool kobuki::Command::deserialise | ( | ecl::PushAndPop< unsigned char > & | byteStream | ) | [inline, virtual] |
Command kobuki::Command::GetControllerGain | ( | ) | [static] |
Definition at line 188 of file command.cpp.
Command kobuki::Command::GetVersionInfo | ( | ) | [static] |
Definition at line 146 of file command.cpp.
Command kobuki::Command::PlaySoundSequence | ( | const enum SoundSequences & | number, |
Command::Data & | current_data | ||
) | [static] |
Definition at line 135 of file command.cpp.
void kobuki::Command::resetBuffer | ( | Buffer & | buffer | ) |
Clears the command buffer and resets the header.
Definition at line 202 of file command.cpp.
bool kobuki::Command::serialise | ( | ecl::PushAndPop< unsigned char > & | byteStream | ) | [virtual] |
Implements packet_handler::payloadBase.
Definition at line 210 of file command.cpp.
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 176 of file command.cpp.
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.
digital_output | : mask and value to send |
current_data | : need to store settings as the gp_output command is a combo command |
Definition at line 84 of file command.cpp.
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.
digital_output | : mask and value to send |
current_data | : need to store settings as the gp_output command is a combo command |
Definition at line 115 of file command.cpp.
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.
Important to overlay this on top of the existing gp_out configuration.
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 |
Definition at line 53 of file command.cpp.
Command kobuki::Command::SetVelocityControl | ( | DiffDrive & | diff_drive | ) | [static] |
Definition at line 157 of file command.cpp.
Command kobuki::Command::SetVelocityControl | ( | const int16_t & | speed, |
const int16_t & | radius | ||
) | [static] |
Definition at line 167 of file command.cpp.
Definition at line 126 of file command.hpp.
const unsigned char kobuki::Command::header0 = 0xaa [static, private] |
Definition at line 133 of file command.hpp.
const unsigned char kobuki::Command::header1 = 0x55 [static, private] |
Definition at line 134 of file command.hpp.