Robot Principal 26
Documentation du Club Robot INSA Rennes 2026
Chargement...
Recherche...
Aucune correspondance
motors/include/DRV8844.h
Aller à la documentation de ce fichier.
1//
2// Created by Romain Pouvreau on 15/04/2026.
3//
9
10#ifndef MOTORS_DRV8844_H
11#define MOTORS_DRV8844_H
12
13#include "mathutils.h"
14#include "AbstractDriver.h"
15#include <iostream>
16
17#ifdef ARDUINO
18#include <Arduino.h>
19#elif ESP_PLATFORM
20
21#endif
22
23
24class DRV8844 : public AbstractDriver
25{
26public:
30 DRV8844(int m1_en, int m1_dir, int m1_pwm, int m2_en, int m2_dir, int m2_pwm, int fault, int rst);
31
35 void init();
36
42 int attach(AbstractMotor* motor) override;
43
50 int attach(AbstractMotor* motor, uint8_t id) override;
51
58 void setVelocity(float velocity, uint8_t id) override;
59
65 float getVelocity(uint8_t id) const override;
66
71 bool isFaulty() const;
72
77 void setSleep(bool active);
78
79private:
80 int m_m1_en;
81 int m_m1_dir;
82 int m_m1_pwm;
83 int m_m2_en;
84 int m_m2_dir;
85 int m_m2_pwm;
86 int m_fault;
87 int m_rst;
88
89 float m_currentVelocity[2] {};
90};
91
92
93
94#endif //MOTORS_DRV8844_H
Représente un driver moteur abstrait.
Definition motors/include/AbstractDriver.h:27
Definition motors/include/AbstractMotors.h:14
int attach(AbstractMotor *motor) override
Attache un moteur au canal disponible.
Definition motors/src/DRV8844.cpp:41
void setVelocity(float velocity, uint8_t id) override
Définit la vitesse de sortie pour le moteur spécifié.
Definition motors/src/DRV8844.cpp:63
DRV8844(int m1_en, int m1_dir, int m1_pwm, int m2_en, int m2_dir, int m2_pwm, int fault, int rst)
Construit le driver DRV8844.
Definition motors/src/DRV8844.cpp:9
bool isFaulty() const
Vérifie l'état de santé du driver.
Definition motors/src/DRV8844.cpp:102
void setSleep(bool active)
Contrôle le mode basse consommation.
void init()
Initialise les broches matérielles.
Definition motors/src/DRV8844.cpp:21
float getVelocity(uint8_t id) const override
Récupère la dernière vitesse appliquée.
Definition motors/src/DRV8844.cpp:97
Interface abstraite des drivers moteurs.