Open FFBoard
Open source force feedback firmware
Loading...
Searching...
No Matches
MotorDriver.cpp
Go to the documentation of this file.
1/*
2 * MotorDriver.cpp
3 *
4 * Created on: Feb 1, 2020
5 * Author: Yannick
6 */
7
8#include <ODriveCAN.h>
9#include "MotorDriver.h"
10#include "ClassChooser.h"
11
12#include "TMC4671.h"
13#include "MotorPWM.h"
14#include "VescCAN.h"
15#include "MotorSimplemotion.h"
16#include "RmdMotorCAN.h"
17
18ClassIdentifier MotorDriver::info ={.name = "None" , .id=CLSID_MOT_NONE, .visibility = ClassVisibility::visible};
19
24const std::vector<class_entry<MotorDriver>> MotorDriver::all_drivers =
25{
27
28#ifdef TMC4671DRIVER
29
30// add_class<TMC4671, MotorDriver>(),
33// add_class<TMC_3, MotorDriver>(),
34#endif
35#ifdef PWMDRIVER
37#endif
38#ifdef ODRIVE
41#endif
42#ifdef VESC
45#endif
46#ifdef SIMPLEMOTION
49#endif
50#ifdef RMDCAN
53#endif
54};
55
61 if(reset){
62 startMotor();
63 }else{
64 stopMotor();
65 }
66}
67
69 return true;
70}
71
76 return false;
77}
78
79
83
84
90void MotorDriver::turn(int16_t val){
91
92}
93
100
104 turn(0);
105}
106
112 return this->drvEncoder.get();
113}
constexpr class_entry< B > add_class(std::optional< uint16_t > selectionId=std::nullopt)
virtual void turn(int16_t power)
const ClassIdentifier getInfo()
virtual bool motorReady()
virtual void emergencyStop(bool reset=false)
virtual void startMotor()
static ClassIdentifier info
Definition MotorDriver.h:18
virtual bool hasIntegratedEncoder()
static const std::vector< class_entry< MotorDriver > > all_drivers
Definition MotorDriver.h:24
std::shared_ptr< Encoder > drvEncoder
Definition MotorDriver.h:46
virtual Encoder * getEncoder()
virtual void stopMotor()