Fonction Set_position (Angle) fonction maintenant en mode Gyroscope
This commit is contained in:
parent
6857a944ba
commit
4fc35d5c1e
@ -17,6 +17,7 @@ void Localisation_set(double x_mm, double y_mm, double angle_radian){
|
|||||||
position.x_mm = x_mm;
|
position.x_mm = x_mm;
|
||||||
position.y_mm = y_mm;
|
position.y_mm = y_mm;
|
||||||
position.angle_radian = angle_radian;
|
position.angle_radian = angle_radian;
|
||||||
|
gyro_set_angle_radian(angle_radian);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Localisation_set_x(double x_mm){
|
void Localisation_set_x(double x_mm){
|
||||||
|
5
gyro.c
5
gyro.c
@ -6,7 +6,9 @@
|
|||||||
#include "spi_nb.h"
|
#include "spi_nb.h"
|
||||||
#include "Temps.h"
|
#include "Temps.h"
|
||||||
#include "gyro.h"
|
#include "gyro.h"
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
|
#define RADIAN_VERS_DEGRES (180. / M_PI)
|
||||||
|
|
||||||
|
|
||||||
#ifdef GYRO_L3GD20H
|
#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;
|
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){
|
struct t_angle_gyro_double gyro_get_angle_degres(void){
|
||||||
return angle_gyro;
|
return angle_gyro;
|
||||||
|
1
gyro.h
1
gyro.h
@ -3,6 +3,7 @@
|
|||||||
void Gyro_Init(void);
|
void Gyro_Init(void);
|
||||||
void Gyro_Read(uint16_t);
|
void Gyro_Read(uint16_t);
|
||||||
void gyro_affiche(struct t_angle_gyro_double angle_gyro, char * titre);
|
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_angle_degres(void);
|
||||||
struct t_angle_gyro_double gyro_get_vitesse(void);
|
struct t_angle_gyro_double gyro_get_vitesse(void);
|
||||||
int16_t gyro_get_temp(void);
|
int16_t gyro_get_temp(void);
|
Loading…
Reference in New Issue
Block a user