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
geometry.cpp
- Committer:
- ronvbree
- Date:
- 2016-11-02
- Revision:
- 7:a80cb6b06320
- Parent:
- 2:fc869e45e672
File content as of revision 7:a80cb6b06320:
#include "math.h" #include "geometry.h" // Sets the required arm lengths in the 'upper' and 'lower' parameters void getArmLengthsForRollerPosition(float x, float y, float &upper, float &lower) { lower = sqrt(pow(y-h,2)+pow(x,2)); upper = sqrt(pow(lower,2)+pow(d,2)-2*d*sqrt(pow(lower,2)-pow(x,2))); } // Sets the roller position corresponding to the current arm lengths in the x and y parameters void getRollerPositionForArmLengths(float upper, float lower, float &x, float &y) { y = (pow(lower,2)-pow(upper,2)+2*h*d+pow(d,2))/(2*d); x = sqrt(-((pow(lower, 4) + pow(upper, 4))/(4*pow(d, 2)))+((pow(lower, 2)*pow(upper, 2))/(2*pow(d,2)))-(pow(upper,2)/2)+(pow(d,2)/4)+pow(lower, 2)); }