feedback_motor.h

00001 #ifndef FEEDBACK_MOTOR_H
00002 #define FEEDBACK_MOTOR_H
00003 
00004 #include "motor.h"
00005 
00006 #define PARAMETER_MESSAGE_LENGTH    24
00007 
00008 class FeedbackMotor : public Motor
00009 {
00010 public:
00011   FeedbackMotor(bool internal_pwm, uint8_t external_speed_pin, 
00012                 PinName internal_speed_pin, PinName microswitch_pin,
00013                 PinMode microswitch_mode = PullNone);
00014   virtual ~FeedbackMotor();
00015   virtual void updateMotor();
00016   virtual bool setControlParameters(uint8_t length, uint8_t *data);
00017   virtual uint8_t * readControlParameters(uint8_t & length);
00018   virtual long readTargetPosition();
00019   virtual long readTargetVelocity();
00020   virtual void setDestination(long encoderPosition, long duration);
00021   
00022 protected:
00023   float dt_, target_position_, position_error_, target_velocity_, integral_error_;
00024   float p_gain_, i_gain_, d_gain_, i_saturation_, max_pwm_, velocity_threshold_;
00025   float pwm_;
00026   bool control_enabled_;
00027 };
00028 
00029 #endif /* FEEDBACK_MOTOR_H */
Generated on Sun May 8 08:05:56 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3