Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI biquadFilter
arm.h
- Committer:
- ronvbree
- Date:
- 2016-10-31
- Revision:
- 0:494acf21d3bc
- Child:
- 2:fc869e45e672
File content as of revision 0:494acf21d3bc:
#include "mbed.h"
/*
Constants
*/
const bool clockwise = true;
const bool counterClockwise = false;
const float motorGain = 8.4f; // Rad/s
const float maxVelocity = 8.4f; // Rad/s (max velocity: 80 rpm = 80*2*pi/60 = 8.4 rad/s)
const float tick = 0.1f; // In seconds
const float gearRadius = 5.2f; // In cm
/*
Arm class
*/
class Arm {
private:
// Instance Variables
float length; // Current length of the arm in centimeters
float velocity; // Angular velocity in rotations per second
PwmOut motorControl;
DigitalOut motorDirection;
Ticker ticker; // Keeps the arm's instance variables up to date
// Methods
void setMotor(float motorValue);
void doTick();
public:
// Constructor
Arm(float initialLength, PinName motorPWM, PinName motorDir);
// Methods
float getLength();
float getVelocity();
void setVelocity(float referenceVelocity);
};