Library to calculate angles from positions and vice versa (also used for shooting angles)

Dependents:   includeair includeair calcul_Ueff2 Mesure_energie

Revision:
0:b8295c4b5793
Child:
1:6cace9fdb088
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/angleandposition.cpp	Thu Oct 15 11:19:39 2015 +0000
@@ -0,0 +1,43 @@
+#include "angleandposition.h"
+#include "mbed.h"
+#include "math.h"
+#include <vector>
+using std::vector;
+
+Serial comp(USBTX,USBRX);
+
+const float bar1=260; // length bar 1 in mm
+const float bar2=342; // length bar 2 in mm
+const float y_position=225;// y positon of pod in mm
+const float y_punch=425;// y position when punched out in mm
+const float width_playfield=473; //width in mm
+const float base_spacing=105.29; //spacing between two dc motors at base
+const float number_steps=10;
+// make linspace of y positions
+
+
+angleandposition::angleandposition(void)
+{
+    float y_step=y_position;
+    vector<double> array;
+    double step = (y_punch-y_position) / (number_steps-1);
+
+    while(y_step <= y_punch) {
+        array.push_back(y_step);
+        y_step += step;           // could recode to better handle rounding errors
+        comp.printf("y= %f\n",y_step);
+    }
+}
+
+float angleandposition::positiontoangle1(float x_position)
+{
+    /* float virt_bar_right = sqrt((x_const-0.5.*base_spacing).^2 + y.^2);
+     return angle1;*/
+}
+
+float angleandposition::positiontoangle2(float x_position)
+{
+
+
+    //return angle2;
+}
\ No newline at end of file