Wyatt  1.0.1
Public Member Functions | List of all members
EncoderMessage Class Reference

#include <EncoderMessage.h>

Inheritance diagram for EncoderMessage:
Inheritance graph
[legend]
Collaboration diagram for EncoderMessage:
Collaboration graph
[legend]

Public Member Functions

 EncoderMessage (Hardware hardware, double data)
 
 ~EncoderMessage () override
 
std::string serialize () override
 
double getData ()
 
- Public Member Functions inherited from IMessage
 IMessage (Hardware hardware)
 
virtual ~IMessage ()
 
Hardware getHardware ()
 

Additional Inherited Members

- Protected Attributes inherited from IMessage
Hardware hardware
 

Detailed Description

Message class encapsulating data between the raspi and the pololu motor encoders. The Double data represents the RPM of the motor. It may need to be scaled depending on the gear ratio. TODO: to decouple the program from the hardware, the data should represent the speed of the motors in cm/s instead of rpm.

Definition at line 15 of file EncoderMessage.h.

Constructor & Destructor Documentation

EncoderMessage::EncoderMessage ( Hardware  hardware,
double  data 
)

Constructor.

Parameters
hardwareThe hardware address for the encoder
dataDouble representing the RPM speed of the motors
Exceptions
MessageLengthExceptionif hardware length does not match the data size

Definition at line 7 of file EncoderMessage.cpp.

EncoderMessage::~EncoderMessage ( )
override

Destructor.

Definition at line 15 of file EncoderMessage.cpp.

Member Function Documentation

double EncoderMessage::getData ( )

Returns the double data the message is encapsulating

Returns
Double data the message is encapsulating.

Definition at line 19 of file EncoderMessage.cpp.

std::string EncoderMessage::serialize ( )
overridevirtual

Serializes the message into a string representation. The hardware address is appended to the front.

Returns
A string representation of the message.

Implements IMessage.

Definition at line 23 of file EncoderMessage.cpp.


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