svoe

Dependencies:   mbed mbed-STM32F103C8T6 MPU6050_1

Revision:
15:960b922433d1
Parent:
14:e12d0fdc3a48
Child:
17:bd6b6ac89e0e
--- a/common.h	Sun Nov 18 13:33:28 2018 +0000
+++ b/common.h	Sat Dec 01 14:25:04 2018 +0000
@@ -1,28 +1,31 @@
 Serial wifi(PA_9, PA_10);
-Serial pc(PB_10, PB_11);
+Serial sound_out(PB_10, PB_11);
+Serial sound_in(PA_2, PA_3);
 //USBSerial usb_serial(0x1f00, 0x2012, 0x0001,  false);
 DigitalOut  myled(LED1);
 DigitalOut test(PB_15); //Test pin for diagnostics and debugging
 int volatile proc_counter; //(3e5 - 2e6 idle, 2e5 - 5e5 at motion) / per 50 mS
 
 float const t_step = 0.02;//SI realtime step
+float time_sec;
 
-float const g= 9.81;//SI
+float const g = 9.81;//SI
+float const pi = 3.1415926535;
+
 float const r_wheel = 0.038;//SI
 float const center_mas = 0.022;//SI (ot osi)
 float const mass = 1.3;//SI
 float const m_inert = 5e-3;//SI
 float const half_axis = 0.08;//SI
-float const pi = 3.1415926535;
 float const ppr = 3200;//pulses per revolution
 
 struct coord{
-float x; //m //vpered
-float y; //m //vpravo
-float azimuth; // rad [-pi;+pi]
-float speed; //m/s
-float path; //m
-float omega; //rad/s    
+    float x; //m //vpered
+    float y; //m //vpravo
+    float azimuth; // rad [-pi;+pi]
+    float speed; //m/s
+    float path; //m
+    float omega; //rad/s    
 };
 
 coord current;
@@ -30,14 +33,15 @@
 
 float balance_prop = 160;
 float balance_diff = 7;
-float x_prop = 40;//18;
-float x_diff = 35;//20;
-float azimuth_prop = 15;
-float azimuth_diff = 8;
-//float azimuth_corr = 0;
+float x_prop = 45;//45;
+float x_diff = 37;//37;
+float azimuth_prop = 40;//50;
+float azimuth_diff = 10;//15;
 
 float coord_accuracy = 0.1;
-bool ready;
+bool coord_ready;
 
-float trajectory [9][2] = {{0,0},{0.2,0.2},{0.2,0.2},{0,0},{0.2,0},{-0.2,0},{0,0},{0,0.2},{0,0}};
+bool fall_flag;
 
+float trajectory [10][3] = {{0,0,0},{0.2,0.2,pi/2},{0,0.4,pi},{-0.2,0.2,-pi/2},{0,0},{0.2,-0.2,-pi/2},{0,-0.4,-pi},{-0.2,-0.2,pi/2},{0,0,0}};
+