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@29:1c5254b27851, 2016-11-04 (annotated)
- Committer:
- Jankoekenpan
- Date:
- Fri Nov 04 13:26:28 2016 +0000
- Revision:
- 29:1c5254b27851
- Parent:
- 7:a80cb6b06320
documented the processEMG function
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ronvbree | 2:fc869e45e672 | 1 | #include "math.h" |
| ronvbree | 2:fc869e45e672 | 2 | #include "geometry.h" |
| ronvbree | 0:494acf21d3bc | 3 | |
| ronvbree | 0:494acf21d3bc | 4 | // Sets the required arm lengths in the 'upper' and 'lower' parameters |
| ronvbree | 0:494acf21d3bc | 5 | void getArmLengthsForRollerPosition(float x, float y, float &upper, float &lower) { |
| ronvbree | 0:494acf21d3bc | 6 | lower = sqrt(pow(y-h,2)+pow(x,2)); |
| ronvbree | 0:494acf21d3bc | 7 | upper = sqrt(pow(lower,2)+pow(d,2)-2*d*sqrt(pow(lower,2)-pow(x,2))); |
| ronvbree | 0:494acf21d3bc | 8 | } |
| ronvbree | 0:494acf21d3bc | 9 | |
| ronvbree | 0:494acf21d3bc | 10 | // Sets the roller position corresponding to the current arm lengths in the x and y parameters |
| ronvbree | 0:494acf21d3bc | 11 | void getRollerPositionForArmLengths(float upper, float lower, float &x, float &y) { |
| ronvbree | 7:a80cb6b06320 | 12 | y = (pow(lower,2)-pow(upper,2)+2*h*d+pow(d,2))/(2*d); |
| ronvbree | 7:a80cb6b06320 | 13 | 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)); |
| ronvbree | 0:494acf21d3bc | 14 | } |