1#ifndef JDRIVETRAIN_MECANUM_H
2#define JDRIVETRAIN_MECANUM_H
21 :
motors({ _FRmotor, _FLmotor, _BLmotor, _BRmotor })
38 return ret1 || ret2 || ret3 || ret4;
54 return ret1 || ret2 || ret3 || ret4;
defines interface for controlling any ground-based drivetrain
Definition JDrivetrain.h:10
Drivetrain that controls a mecanum wheeled robot.
Definition JDrivetrainMecanum.h:11
void setDistSetpoint(JTwoDTransform _dist, bool _run=false)
Definition JDrivetrainMecanum.h:93
JDrivetrainMecanum(JMotorController &_FRmotor, JMotorController &_FLmotor, JMotorController &_BLmotor, JMotorController &_BRmotor, JTwoDTransform _robotToWheelScalar)
Definition JDrivetrainMecanum.h:20
void setMotorDistDelta(float distDelta, unsigned char i, bool _run=false)
Definition JDrivetrainMecanum.h:167
JTwoDTransform getVel(bool _run=false)
Definition JDrivetrainMecanum.h:56
JTwoDTransform getDist(bool _run=false)
Definition JDrivetrainMecanum.h:69
void setRobotToWheelScalar(JTwoDTransform scalar)
Definition JDrivetrainMecanum.h:186
void toTransform(MotorFloats m, JTwoDTransform &w)
Definition JDrivetrainMecanum.h:206
void setVel(JTwoDTransform _vel, bool _run=false)
sets a velocity for the drivetrain to move at
Definition JDrivetrainMecanum.h:82
bool enable()
enables movement
Definition JDrivetrainMecanum.h:40
JTwoDTransform robotToWheelScalar
Definition JDrivetrainMecanum.h:192
void setDistDelta(JTwoDTransform _dist, bool _run=false)
Definition JDrivetrainMecanum.h:104
void run()
call this in loop. it calls any encoder or motor update functions
Definition JDrivetrainMecanum.h:25
bool getEnable()
gets the current state (enabled or disabled)
Definition JDrivetrainMecanum.h:48
struct JDrivetrainMecanum::Motors motors
void setMotorVel(float vel, unsigned char i, bool _run=false)
Definition JDrivetrainMecanum.h:145
JTwoDTransform getRobotToWheelScalar()
Definition JDrivetrainMecanum.h:182
unsigned char getNumberMotors()
Definition JDrivetrainMecanum.h:178
void toWheels(JTwoDTransform t, MotorFloats &m)
Definition JDrivetrainMecanum.h:199
bool setEnable(bool _enable)
enables or disables movement
Definition JDrivetrainMecanum.h:32
void setMotorDistSetpoint(float distSetpoint, unsigned char i, bool _run=false)
Definition JDrivetrainMecanum.h:156
bool disable()
disables movement
Definition JDrivetrainMecanum.h:44
float getMotorVel(unsigned char i)
Definition JDrivetrainMecanum.h:133
void resetDist()
Definition JDrivetrainMecanum.h:115
JTwoDTransform getMaxVel()
returns the approximate maximum velocity of the drivetrain, if the drivetrain is told to move at max ...
Definition JDrivetrainMecanum.h:122
virtual float getVel()=0
get current velocity of motor
virtual void setVel(float vel, bool _run=true)=0
set velocity for controller
virtual bool getEnable()=0
is the controller enabled
virtual float getMaxVel()=0
How fast of a motor speed setting would get adjusted to full motor power.
virtual void run()=0
update driver
virtual bool setEnable(bool _enable)=0
change whether motor controller is enabled
This class defines a common interface for classes which control velocity and position of a motor cont...
Definition JMotorController.h:8
virtual float resetPos()=0
reset what position the controller thinks it's in
virtual float getPos()=0
get what position the motor is currently at
virtual bool setPosSetpoint(float _posSetpoint, bool _run=true)=0
set position for motor to drive towards position as fast as possible (setpoint for control loop if av...
virtual bool setPosDelta(float _posDelta, bool _run=true, bool _resetPos=false)=0
alternative method for setting velocity that uses setPosSetpoint
Definition JDrivetrainMecanum.h:193
float BLmotor
Definition JDrivetrainMecanum.h:196
float FRmotor
Definition JDrivetrainMecanum.h:194
float BRmotor
Definition JDrivetrainMecanum.h:197
float FLmotor
Definition JDrivetrainMecanum.h:195
Definition JDrivetrainMecanum.h:13
JMotorController & FLmotor
Definition JDrivetrainMecanum.h:15
JMotorController & BLmotor
Definition JDrivetrainMecanum.h:16
JMotorController & BRmotor
Definition JDrivetrainMecanum.h:17
JMotorController & FRmotor
Definition JDrivetrainMecanum.h:14