Motor Class Reference

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

List of all members.

Public Member Functions

virtual bool setControlParameters (uint8_t length, uint8_t *data)=0
virtual uint8_t * readControlParameters (uint8_t &length)=0
virtual long readTargetPosition ()=0
virtual long readTargetVelocity ()=0
virtual void updateMotor ()=0
uint8_t readMicroswitch ()
long readEncoder ()
float readPWMDuty ()
void setEncoder (long position)
virtual void setDestination (long encoderPosition, long duration)
void setPWMDuty (float duty)

Protected Member Functions

 Motor (bool internal_pwm, uint8_t external_speed_pin, PinName internal_speed_pin, PinName microswitch_pin, PinMode microswitch_mode)

Protected Attributes

uint8_t external_speed_pin_
bool internal_pwm_
uint8_t external_speed_
PwmOut speed_
 Hardware PWM controller.
DigitalIn microswitch_
 Microswitch input.
bool update_in_progress_
long encoder_
 Current encoder value.
long desired_encoder_
 Desired encoder value.
long desired_distance_
 Desired move distance.
Timer move_duration_
 Time since the move began.
float desired_move_duration_
 How long the move should take in seconds.

Detailed Description

Definition at line 19 of file motor.h.


Member Function Documentation

virtual bool Motor::setControlParameters ( uint8_t  length,
uint8_t *  data 
) [pure virtual]

Update the control algorithm's parameters

Takes in raw data from the serial port, checks the length, and deserializes the data. Note: it is the implementer's responsibility to deallocate the data using the delete operator.

Parameters:
int length The number of bytes in the data buffer
uint8_t *data The serialized parameters
Returns:
bool true if the data was deserialized successfully false otherwise

Implemented in FeedbackMotor.

virtual void Motor::updateMotor (  )  [pure virtual]

Runs a single step of the control algorithm

Updates the PWM value for the given motor

Implemented in FeedbackMotor.


Member Data Documentation

long Motor::desired_distance_ [protected]

Desired move distance.

Definition at line 83 of file motor.h.

Referenced by FeedbackMotor::updateMotor().

long Motor::desired_encoder_ [protected]

Desired encoder value.

Definition at line 81 of file motor.h.

Referenced by FeedbackMotor::updateMotor().

float Motor::desired_move_duration_ [protected]

How long the move should take in seconds.

Definition at line 87 of file motor.h.

Referenced by FeedbackMotor::updateMotor().

long Motor::encoder_ [protected]

Current encoder value.

Definition at line 79 of file motor.h.

Referenced by FeedbackMotor::updateMotor().

DigitalIn Motor::microswitch_ [protected]

Microswitch input.

Definition at line 74 of file motor.h.

Time since the move began.

Definition at line 85 of file motor.h.

Referenced by FeedbackMotor::updateMotor().

PwmOut Motor::speed_ [protected]

Hardware PWM controller.

Definition at line 72 of file motor.h.

bool Motor::update_in_progress_ [protected]

Reports if either parameters or positions in the process of being updated over serial

Definition at line 77 of file motor.h.

Referenced by FeedbackMotor::setControlParameters(), and FeedbackMotor::updateMotor().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:23:20 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3