1#ifndef JDRIVETRAIN_TWO_SIDE_H
2#define JDRIVETRAIN_TWO_SIDE_H
defines interface for controlling any ground-based drivetrain
Definition JDrivetrain.h:10
child class of JDrivetrain for controlling a drivetrain with one JMotorController for each side of th...
Definition JDrivetrainTwoSide.h:11
JTwoDTransform vel
Definition JDrivetrainTwoSide.h:23
float leftDist
Definition JDrivetrainTwoSide.h:20
JTwoDTransform maxVel
Definition JDrivetrainTwoSide.h:25
void resetDist()
Definition JDrivetrainTwoSide.h:107
void setMotorDistSetpoint(float distSetpoint, unsigned char i, bool _run=false)
Definition JDrivetrainTwoSide.h:132
JDrivetrainTwoSide(JMotorController &_left, JMotorController &_right, float _width)
Definition JDrivetrainTwoSide.h:28
JTwoDTransform getMaxVel()
returns the approximate maximum velocity of the drivetrain, if the drivetrain is told to move at max ...
Definition JDrivetrainTwoSide.h:113
float rightVel
Definition JDrivetrainTwoSide.h:19
void setMotorVel(float vel, unsigned char i, bool _run=false)
Definition JDrivetrainTwoSide.h:125
float width
Definition JDrivetrainTwoSide.h:17
bool setEnable(bool _enable)
enables or disables movement
Definition JDrivetrainTwoSide.h:53
JTwoDTransform getVel(bool _run=false)
Definition JDrivetrainTwoSide.h:71
bool getEnable()
gets the current state (enabled or disabled)
Definition JDrivetrainTwoSide.h:67
void setDistSetpoint(JTwoDTransform _dist, bool _run=false)
Definition JDrivetrainTwoSide.h:91
JTwoDTransform dist
Definition JDrivetrainTwoSide.h:24
float leftVel
Definition JDrivetrainTwoSide.h:18
float getWidth()
Definition JDrivetrainTwoSide.h:151
bool disable()
disables movement
Definition JDrivetrainTwoSide.h:63
void setVel(JTwoDTransform _vel, bool _run=false)
sets a velocity for the drivetrain to move at
Definition JDrivetrainTwoSide.h:83
void run()
call this in loop. it calls any encoder or motor update functions
Definition JDrivetrainTwoSide.h:39
JMotorController & left
Definition JDrivetrainTwoSide.h:13
void setWidth(float _width)
Definition JDrivetrainTwoSide.h:156
float getMotorVel(unsigned char i)
Definition JDrivetrainTwoSide.h:117
bool enable()
enables movement
Definition JDrivetrainTwoSide.h:59
JTwoDTransform getDist(bool _run=false)
Definition JDrivetrainTwoSide.h:77
float rightDist
Definition JDrivetrainTwoSide.h:21
void setMotorDistDelta(float distDelta, unsigned char i, bool _run=false)
Definition JDrivetrainTwoSide.h:139
unsigned char getNumberMotors()
Definition JDrivetrainTwoSide.h:146
void setDistDelta(JTwoDTransform _dist, bool _run=false)
Definition JDrivetrainTwoSide.h:99
JMotorController & right
Definition JDrivetrainTwoSide.h:14
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