mirror of
https://github.com/modelec/odo_STM32.git
synced 2026-01-18 16:27:25 +01:00
une partie de la comm de done (je crois)
This commit is contained in:
45
Core/Inc/modelec.h
Normal file
45
Core/Inc/modelec.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* modelec.h
|
||||||
|
*
|
||||||
|
* Created on: May 26, 2025
|
||||||
|
* Author: maxch
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INC_MODELEC_H_
|
||||||
|
#define INC_MODELEC_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "point.h"
|
||||||
|
#include "pidPosition.h"
|
||||||
|
#include "pidVitesse.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Fonctions accessibles
|
||||||
|
void ModelecOdometrySetup(void **out_pid, void **out_pidG, void **out_pidD);
|
||||||
|
void ModelecOdometryUpdate();
|
||||||
|
void ModelecOdometryLoop(void* pid, void* pidG, void* pidD);
|
||||||
|
void determinationCoefPosition(Point objectifPoint, Point pointActuel, PidPosition& pid, PidVitesse& pidG, PidVitesse& pidD, float vitGauche, float vitDroit);
|
||||||
|
|
||||||
|
|
||||||
|
// Variables globales accessibles
|
||||||
|
extern float x;
|
||||||
|
extern float y;
|
||||||
|
extern float theta;
|
||||||
|
|
||||||
|
extern float vitesseLineaire;
|
||||||
|
extern float vitesseAngulaire;
|
||||||
|
extern float vitesseLeft;
|
||||||
|
extern float vitesseRight;
|
||||||
|
|
||||||
|
extern Point currentPoint;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* INC_MODELEC_H_ */
|
||||||
@@ -6,10 +6,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include "CommCallbacks.hpp"
|
#include "CommCallbacks.hpp"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "modelec.cpp"
|
#include "modelec.h"
|
||||||
#include "motors.h"
|
#include "motors.h"
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
#include "pidPosition.h"
|
#include "pidPosition.h"
|
||||||
@@ -33,9 +33,10 @@ void Comm_GetSpeed(float* vx, float* vy, float* omega){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Comm_GetPID(float* p, float* i, float* d) {
|
void Comm_GetPID(float* p, float* i, float* d) {
|
||||||
PIDController::getInstance().getCoefficients(*p, *i, *d);
|
//PIDController::getInstance().getCoefficients(*p, *i, *d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void Comm_SetPID(float p, float i, float d) {
|
void Comm_SetPID(float p, float i, float d) {
|
||||||
PIDController::getInstance().setCoefficients(p, i, d);
|
PIDController::getInstance().setCoefficients(p, i, d);
|
||||||
}
|
}
|
||||||
@@ -48,6 +49,6 @@ void Comm_StartOdometry(bool on) {
|
|||||||
void Comm_AddWaypoint(int id, int type, float x, float y, float theta) {
|
void Comm_AddWaypoint(int id, int type, float x, float y, float theta) {
|
||||||
Waypoint wp(id, type, x, y, theta);
|
Waypoint wp(id, type, x, y, theta);
|
||||||
WaypointManager::getInstance().addWaypoint(wp);
|
WaypointManager::getInstance().addWaypoint(wp);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "pidPosition.h"
|
#include "pidPosition.h"
|
||||||
#include "usbd_cdc_if.h"
|
#include "usbd_cdc_if.h"
|
||||||
#include "commSTM.h"
|
#include "commSTM.h"
|
||||||
|
#include "modelec.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@@ -245,10 +246,6 @@ void ModelecOdometryLoop(void* pid, void* pidG, void* pidD) {
|
|||||||
determinationCoefPosition(targetPoint, currentPoint, *pidPosition, *pidVitesseG, *pidVitesseD, motor.getLeftCurrentSpeed(), motor.getRightCurrentSpeed());
|
determinationCoefPosition(targetPoint, currentPoint, *pidPosition, *pidVitesseG, *pidVitesseD, motor.getLeftCurrentSpeed(), motor.getRightCurrentSpeed());
|
||||||
//HAL_Delay(1000);
|
//HAL_Delay(1000);
|
||||||
motor.update();
|
motor.update();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishStatus();
|
publishStatus();
|
||||||
|
|||||||
Reference in New Issue
Block a user