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

#include <MotorMessage.h>

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

Public Member Functions

 MotorMessage (Hardware hardware, int data)
 
 ~MotorMessage () override
 
std::string serialize () override
 
int 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 sent to the Pololu motors. TODO: Change the data type from an integer specifying motor power to a double specifying wheel speed in cm/s

Definition at line 10 of file MotorMessage.h.

Constructor & Destructor Documentation

MotorMessage::MotorMessage ( Hardware  hardware,
int  data 
)

Constructor

Parameters
hardwareThe hardware address of the motor
dataAn Integer representing the speed of the motor [-4095 - 4095] = [Full Backwards, Full Forwards]
Exceptions
MessageLengthExceptionif the hardware size does not match
DataSizeExceptionif data exceeds FULL_FORWARDS/FULL_BACKWARDS as defined in DriveConstants

Definition at line 4 of file MotorMessage.cpp.

MotorMessage::~MotorMessage ( )
override

Destructor

Definition at line 17 of file MotorMessage.cpp.

Member Function Documentation

int MotorMessage::getData ( )

Returns the data the message is encapsulating.

Returns
Data for the motor

Definition at line 21 of file MotorMessage.cpp.

std::string MotorMessage::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 25 of file MotorMessage.cpp.


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