Library to calculate angles from positions and vice versa (also used for shooting angles)
Dependents: includeair includeair calcul_Ueff2 Mesure_energie
angleandposition.h@4:9492c1c361b9, 2015-10-29 (annotated)
- Committer:
- Gerth
- Date:
- Thu Oct 29 14:03:25 2015 +0000
- Revision:
- 4:9492c1c361b9
- Parent:
- 3:067c75c62882
converted floats to doubles
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gerth | 0:b8295c4b5793 | 1 | #ifndef _ANGLEANDPOSITION_H_ |
Gerth | 0:b8295c4b5793 | 2 | #define _ANGLEANDPOSITION_H_ |
Gerth | 0:b8295c4b5793 | 3 | |
Gerth | 0:b8295c4b5793 | 4 | #include "mbed.h" |
Gerth | 0:b8295c4b5793 | 5 | #include "math.h" |
Gerth | 0:b8295c4b5793 | 6 | |
Gerth | 0:b8295c4b5793 | 7 | class angleandposition |
Gerth | 0:b8295c4b5793 | 8 | { |
Gerth | 0:b8295c4b5793 | 9 | public: |
Gerth | 3:067c75c62882 | 10 | /** |
Gerth | 3:067c75c62882 | 11 | *Constructor |
Gerth | 3:067c75c62882 | 12 | */ |
Gerth | 0:b8295c4b5793 | 13 | angleandposition(void); |
Gerth | 0:b8295c4b5793 | 14 | |
Gerth | 3:067c75c62882 | 15 | /** |
Gerth | 3:067c75c62882 | 16 | *Calculates required angle for rigth arm from desired position. |
Gerth | 4:9492c1c361b9 | 17 | *@param x_position : double Desired x position in mm |
Gerth | 4:9492c1c361b9 | 18 | *@param y_position : double Desired y position in mm |
Gerth | 3:067c75c62882 | 19 | *@return Required angle for rigth arm in rad |
Gerth | 3:067c75c62882 | 20 | */ |
Gerth | 4:9492c1c361b9 | 21 | double positiontoangle1 (double x_position,double y_position); |
Gerth | 3:067c75c62882 | 22 | |
Gerth | 3:067c75c62882 | 23 | /** |
Gerth | 3:067c75c62882 | 24 | *Calculates required angle for left arm from desired position. |
Gerth | 4:9492c1c361b9 | 25 | *@param x_position : double Desired x position in mm |
Gerth | 4:9492c1c361b9 | 26 | *@param y_position : double Desired y position in mm |
Gerth | 3:067c75c62882 | 27 | *@return Required angle for left arm in rad |
Gerth | 3:067c75c62882 | 28 | */ |
Gerth | 4:9492c1c361b9 | 29 | double positiontoangle2 (double x_position,double y_position); |
Gerth | 3:067c75c62882 | 30 | |
Gerth | 3:067c75c62882 | 31 | /** |
Gerth | 3:067c75c62882 | 32 | *Calculates the x position of the pod from the angles of the arms |
Gerth | 4:9492c1c361b9 | 33 | *@param theta_r : double Angle of rigth arm in rad |
Gerth | 4:9492c1c361b9 | 34 | *@param theta_l : double Angle of left arm in rad |
Gerth | 3:067c75c62882 | 35 | *@return X position of pod in mm |
Gerth | 3:067c75c62882 | 36 | */ |
Gerth | 4:9492c1c361b9 | 37 | double angletoposition (double theta_r,double theta_l); |
Gerth | 3:067c75c62882 | 38 | |
Gerth | 3:067c75c62882 | 39 | /** |
Gerth | 3:067c75c62882 | 40 | *Calculates the y position of the pod from the angles of the arms |
Gerth | 4:9492c1c361b9 | 41 | *@param theta_r : double Angle of rigth arm in rad |
Gerth | 4:9492c1c361b9 | 42 | *@param theta_l : double Angle of left arm in rad |
Gerth | 3:067c75c62882 | 43 | *@return Y position of pod in mm |
Gerth | 3:067c75c62882 | 44 | */ |
Gerth | 4:9492c1c361b9 | 45 | double angletoposition_y(double theta_r,double theta_l); |
Gerth | 3:067c75c62882 | 46 | |
Gerth | 0:b8295c4b5793 | 47 | |
Gerth | 0:b8295c4b5793 | 48 | private: |
Gerth | 0:b8295c4b5793 | 49 | |
Gerth | 0:b8295c4b5793 | 50 | }; |
Gerth | 0:b8295c4b5793 | 51 | #endif |