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
controller.cpp
- Committer:
- ronvbree
- Date:
- 2016-11-02
- Revision:
- 2:fc869e45e672
- Parent:
- 0:494acf21d3bc
- Child:
- 7:a80cb6b06320
File content as of revision 2:fc869e45e672:
#include "controller.h" bool constantMovementTo(Arm arm, float length) { const float velocity = 2; float initialLength = arm.getLength(); float dLength = length-initialLength; if (dLength < 0) { arm.setVelocity(-1 * velocity); while (dLength < 0) { // Wait } arm.setVelocity(0); return true; } else { arm.setVelocity(velocity); while (dLength > 0) { // Wait } arm.setVelocity(0); return true; } }