Fonction Set_position (Angle) fonction maintenant en mode Gyroscope

This commit is contained in:
Samuel 2023-03-29 23:11:04 +02:00
parent 6857a944ba
commit 4fc35d5c1e
3 changed files with 7 additions and 0 deletions

View File

@ -17,6 +17,7 @@ void Localisation_set(double x_mm, double y_mm, double angle_radian){
position.x_mm = x_mm;
position.y_mm = y_mm;
position.angle_radian = angle_radian;
gyro_set_angle_radian(angle_radian);
}
void Localisation_set_x(double x_mm){

5
gyro.c
View File

@ -6,7 +6,9 @@
#include "spi_nb.h"
#include "Temps.h"
#include "gyro.h"
#include "math.h"
#define RADIAN_VERS_DEGRES (180. / M_PI)
#ifdef GYRO_L3GD20H
@ -35,6 +37,9 @@ uint32_t rot_x_zero, rot_y_zero, rot_z_zero;
struct t_angle_gyro_double angle_gyro, vitesse_gyro;
void gyro_set_angle_radian(double angle_radian){
angle_gyro.rot_z = angle_radian * RADIAN_VERS_DEGRES;
}
struct t_angle_gyro_double gyro_get_angle_degres(void){
return angle_gyro;

1
gyro.h
View File

@ -3,6 +3,7 @@
void Gyro_Init(void);
void Gyro_Read(uint16_t);
void gyro_affiche(struct t_angle_gyro_double angle_gyro, char * titre);
void gyro_set_angle_radian(double angle_radian);
struct t_angle_gyro_double gyro_get_angle_degres(void);
struct t_angle_gyro_double gyro_get_vitesse(void);
int16_t gyro_get_temp(void);