JMotor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
JDrivetrainTwoSide Class Reference

child class of JDrivetrain for controlling a drivetrain with one JMotorController for each side of the drivetrain More...

#include <JDrivetrainTwoSide.h>

Inheritance diagram for JDrivetrainTwoSide:
Inheritance graph
[legend]
Collaboration diagram for JDrivetrainTwoSide:
Collaboration graph
[legend]

Public Member Functions

 JDrivetrainTwoSide (JMotorController &_left, JMotorController &_right, float _width)
 
void run ()
 call this in loop. it calls any encoder or motor update functions
 
bool setEnable (bool _enable)
 enables or disables movement
 
bool enable ()
 enables movement
 
bool disable ()
 disables movement
 
bool getEnable ()
 gets the current state (enabled or disabled)
 
JTwoDTransform getVel (bool _run=false)
 
JTwoDTransform getDist (bool _run=false)
 
void setVel (JTwoDTransform _vel, bool _run=false)
 sets a velocity for the drivetrain to move at
 
void setDistSetpoint (JTwoDTransform _dist, bool _run=false)
 
void setDistDelta (JTwoDTransform _dist, bool _run=false)
 
void resetDist ()
 
JTwoDTransform getMaxVel ()
 returns the approximate maximum velocity of the drivetrain, if the drivetrain is told to move at max velocity, it should set the motors to full power.
 
float getMotorVel (unsigned char i)
 
void setMotorVel (float vel, unsigned char i, bool _run=false)
 
void setMotorDistSetpoint (float distSetpoint, unsigned char i, bool _run=false)
 
void setMotorDistDelta (float distDelta, unsigned char i, bool _run=false)
 
unsigned char getNumberMotors ()
 
float getWidth ()
 
void setWidth (float _width)
 

Public Attributes

JMotorControllerleft
 
JMotorControllerright
 

Protected Attributes

float width
 
float leftVel
 
float rightVel
 
float leftDist
 
float rightDist
 
JTwoDTransform vel
 
JTwoDTransform dist
 
JTwoDTransform maxVel
 

Detailed Description

child class of JDrivetrain for controlling a drivetrain with one JMotorController for each side of the drivetrain

Note
both sides should move forward when the controllers are given a positive speed

Constructor & Destructor Documentation

◆ JDrivetrainTwoSide()

JDrivetrainTwoSide::JDrivetrainTwoSide ( JMotorController _left,
JMotorController _right,
float  _width 
)
inline

Member Function Documentation

◆ disable()

bool JDrivetrainTwoSide::disable ( )
inlinevirtual

disables movement

Return values
didthe state change

Implements JDrivetrainBasic.

◆ enable()

bool JDrivetrainTwoSide::enable ( )
inlinevirtual

enables movement

Return values
didthe state change

Implements JDrivetrainBasic.

◆ getDist()

JTwoDTransform JDrivetrainTwoSide::getDist ( bool  _run = false)
inlinevirtual

Reimplemented from JDrivetrain.

◆ getEnable()

bool JDrivetrainTwoSide::getEnable ( )
inlinevirtual

gets the current state (enabled or disabled)

Return values
(bool)true=enabled false=movement disabled

Implements JDrivetrainBasic.

◆ getMaxVel()

JTwoDTransform JDrivetrainTwoSide::getMaxVel ( )
inlinevirtual

returns the approximate maximum velocity of the drivetrain, if the drivetrain is told to move at max velocity, it should set the motors to full power.

Note
depends on how well calibrated the motor compensators are
Return values
(JTwoDTransform)maximum velocity (in whatever units your drivetrain and motors are set up for)

Implements JDrivetrainBasic.

◆ getMotorVel()

float JDrivetrainTwoSide::getMotorVel ( unsigned char  i)
inlinevirtual

Reimplemented from JDrivetrain.

◆ getNumberMotors()

unsigned char JDrivetrainTwoSide::getNumberMotors ( )
inlinevirtual

Reimplemented from JDrivetrain.

◆ getVel()

JTwoDTransform JDrivetrainTwoSide::getVel ( bool  _run = false)
inlinevirtual

Reimplemented from JDrivetrain.

◆ getWidth()

float JDrivetrainTwoSide::getWidth ( )
inline

◆ resetDist()

void JDrivetrainTwoSide::resetDist ( )
inlinevirtual

Reimplemented from JDrivetrain.

◆ run()

void JDrivetrainTwoSide::run ( )
inlinevirtual

call this in loop. it calls any encoder or motor update functions

Implements JDrivetrainBasic.

◆ setDistDelta()

void JDrivetrainTwoSide::setDistDelta ( JTwoDTransform  _dist,
bool  _run = false 
)
inlinevirtual

Reimplemented from JDrivetrain.

◆ setDistSetpoint()

void JDrivetrainTwoSide::setDistSetpoint ( JTwoDTransform  _dist,
bool  _run = false 
)
inlinevirtual

Reimplemented from JDrivetrain.

◆ setEnable()

bool JDrivetrainTwoSide::setEnable ( bool  _enable)
inlinevirtual

enables or disables movement

Parameters
_enable(bool) true=enabled false=movement disabled
Return values
didthe state change

Implements JDrivetrainBasic.

◆ setMotorDistDelta()

void JDrivetrainTwoSide::setMotorDistDelta ( float  distDelta,
unsigned char  i,
bool  _run = false 
)
inlinevirtual

Reimplemented from JDrivetrain.

◆ setMotorDistSetpoint()

void JDrivetrainTwoSide::setMotorDistSetpoint ( float  distSetpoint,
unsigned char  i,
bool  _run = false 
)
inlinevirtual

Reimplemented from JDrivetrain.

◆ setMotorVel()

void JDrivetrainTwoSide::setMotorVel ( float  vel,
unsigned char  i,
bool  _run = false 
)
inlinevirtual

Reimplemented from JDrivetrain.

◆ setVel()

void JDrivetrainTwoSide::setVel ( JTwoDTransform  _vel,
bool  _run = false 
)
inlinevirtual

sets a velocity for the drivetrain to move at

Parameters
_vel(JTwoDTransform) velocity to move at
_run(bool, default=true) if true setVel will call run() for you, if false you must call it yourself
Return values
None

Implements JDrivetrainBasic.

◆ setWidth()

void JDrivetrainTwoSide::setWidth ( float  _width)
inline

Member Data Documentation

◆ dist

JTwoDTransform JDrivetrainTwoSide::dist
protected

◆ left

JMotorController& JDrivetrainTwoSide::left

◆ leftDist

float JDrivetrainTwoSide::leftDist
protected

◆ leftVel

float JDrivetrainTwoSide::leftVel
protected

◆ maxVel

JTwoDTransform JDrivetrainTwoSide::maxVel
protected

◆ right

JMotorController& JDrivetrainTwoSide::right

◆ rightDist

float JDrivetrainTwoSide::rightDist
protected

◆ rightVel

float JDrivetrainTwoSide::rightVel
protected

◆ vel

JTwoDTransform JDrivetrainTwoSide::vel
protected

◆ width

float JDrivetrainTwoSide::width
protected

The documentation for this class was generated from the following file: