diff --git a/Core/Inc/modelec.h b/Core/Inc/modelec.h new file mode 100644 index 0000000..11688ef --- /dev/null +++ b/Core/Inc/modelec.h @@ -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_ */ diff --git a/Core/Src/CommCallbacks.cpp b/Core/Src/CommCallbacks.cpp index 512a401..7651bc7 100644 --- a/Core/Src/CommCallbacks.cpp +++ b/Core/Src/CommCallbacks.cpp @@ -6,10 +6,10 @@ */ -/* + #include "CommCallbacks.hpp" #include "main.h" -#include "modelec.cpp" +#include "modelec.h" #include "motors.h" #include "pid.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) { - PIDController::getInstance().getCoefficients(*p, *i, *d); + //PIDController::getInstance().getCoefficients(*p, *i, *d); } +/* void Comm_SetPID(float p, float i, float 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) { Waypoint wp(id, type, x, y, theta); WaypointManager::getInstance().addWaypoint(wp); -} +}*/ + -*/ diff --git a/Core/Src/modelec.cpp b/Core/Src/modelec.cpp index efb90e6..0963f6b 100644 --- a/Core/Src/modelec.cpp +++ b/Core/Src/modelec.cpp @@ -14,6 +14,7 @@ #include "pidPosition.h" #include "usbd_cdc_if.h" #include "commSTM.h" +#include "modelec.h" extern "C" { @@ -245,10 +246,6 @@ void ModelecOdometryLoop(void* pid, void* pidG, void* pidD) { determinationCoefPosition(targetPoint, currentPoint, *pidPosition, *pidVitesseG, *pidVitesseD, motor.getLeftCurrentSpeed(), motor.getRightCurrentSpeed()); //HAL_Delay(1000); motor.update(); - - - - } publishStatus();