Guillaume Chauvon
/
Asservissment_robot2_v16_05
l
Diff: odometrie.cpp
- Revision:
- 5:3638d7e7c5c1
- Parent:
- 2:3066e614372f
- Child:
- 6:e1585b8bd07d
diff -r eac6746544fb -r 3638d7e7c5c1 odometrie.cpp --- a/odometrie.cpp Thu May 16 09:10:16 2019 +0000 +++ b/odometrie.cpp Mon May 20 23:08:09 2019 +0000 @@ -8,15 +8,19 @@ double y_actuel; double angle; // angle du robot +extern Serial pc; +extern double X_init = 0.0; +extern double Y_init = 0.0; +extern double ANGLE_init = 0.0; long int nbr_tick_D_prec; long int nbr_tick_G_prec; void init_odometrie() { - x_actuel=X_INIT; - y_actuel=Y_INIT; - angle=THETA_INIT; + x_actuel = X_init; + y_actuel = Y_init; + angle = ANGLE_init; nbr_tick_D_prec=0; nbr_tick_G_prec=0; } @@ -95,4 +99,20 @@ double get_angle() { return angle*180/PI; +} + +void setEmplacementDepartViolet() +{ + X_init = 30000.0; //22500 + Y_init = 30000.0; // 45000 + //ANGLE_init = 0.0; + ANGLE_init = 0.0; +} + + +void setEmplacementDepartJaune() +{ + X_init = 0.0; + Y_init = 0.0; + ANGLE_init = -90.0*3.1415/180.0; } \ No newline at end of file