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

Drivetrain that controls a mecanum wheeled robot. More...

#include <JDrivetrainMecanum.h>

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

Classes

struct  MotorFloats
 
struct  Motors
 

Public Member Functions

 JDrivetrainMecanum (JMotorController &_FRmotor, JMotorController &_FLmotor, JMotorController &_BLmotor, JMotorController &_BRmotor, JTwoDTransform _robotToWheelScalar)
 
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 ()
 
JTwoDTransform getRobotToWheelScalar ()
 
void setRobotToWheelScalar (JTwoDTransform scalar)
 

Public Attributes

struct JDrivetrainMecanum::Motors motors
 

Protected Member Functions

void toWheels (JTwoDTransform t, MotorFloats &m)
 
void toTransform (MotorFloats m, JTwoDTransform &w)
 

Protected Attributes

JTwoDTransform robotToWheelScalar
 

Detailed Description

Drivetrain that controls a mecanum wheeled robot.

Constructor & Destructor Documentation

◆ JDrivetrainMecanum()

JDrivetrainMecanum::JDrivetrainMecanum ( JMotorController _FRmotor,
JMotorController _FLmotor,
JMotorController _BLmotor,
JMotorController _BRmotor,
JTwoDTransform  _robotToWheelScalar 
)
inline

Member Function Documentation

◆ disable()

bool JDrivetrainMecanum::disable ( )
inlinevirtual

disables movement

Return values
didthe state change

Implements JDrivetrainBasic.

◆ enable()

bool JDrivetrainMecanum::enable ( )
inlinevirtual

enables movement

Return values
didthe state change

Implements JDrivetrainBasic.

◆ getDist()

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

Reimplemented from JDrivetrain.

◆ getEnable()

bool JDrivetrainMecanum::getEnable ( )
inlinevirtual

gets the current state (enabled or disabled)

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

Implements JDrivetrainBasic.

◆ getMaxVel()

JTwoDTransform JDrivetrainMecanum::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 JDrivetrainMecanum::getMotorVel ( unsigned char  i)
inlinevirtual

Reimplemented from JDrivetrain.

◆ getNumberMotors()

unsigned char JDrivetrainMecanum::getNumberMotors ( )
inlinevirtual

Reimplemented from JDrivetrain.

◆ getRobotToWheelScalar()

JTwoDTransform JDrivetrainMecanum::getRobotToWheelScalar ( )
inline

◆ getVel()

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

Reimplemented from JDrivetrain.

◆ resetDist()

void JDrivetrainMecanum::resetDist ( )
inlinevirtual

Reimplemented from JDrivetrain.

◆ run()

void JDrivetrainMecanum::run ( )
inlinevirtual

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

Implements JDrivetrainBasic.

◆ setDistDelta()

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

Reimplemented from JDrivetrain.

◆ setDistSetpoint()

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

Reimplemented from JDrivetrain.

◆ setEnable()

bool JDrivetrainMecanum::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 JDrivetrainMecanum::setMotorDistDelta ( float  distDelta,
unsigned char  i,
bool  _run = false 
)
inlinevirtual

Reimplemented from JDrivetrain.

◆ setMotorDistSetpoint()

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

Reimplemented from JDrivetrain.

◆ setMotorVel()

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

Reimplemented from JDrivetrain.

◆ setRobotToWheelScalar()

void JDrivetrainMecanum::setRobotToWheelScalar ( JTwoDTransform  scalar)
inline

◆ setVel()

void JDrivetrainMecanum::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.

◆ toTransform()

void JDrivetrainMecanum::toTransform ( MotorFloats  m,
JTwoDTransform w 
)
inlineprotected

◆ toWheels()

void JDrivetrainMecanum::toWheels ( JTwoDTransform  t,
MotorFloats m 
)
inlineprotected

Member Data Documentation

◆ motors

struct JDrivetrainMecanum::Motors JDrivetrainMecanum::motors

◆ robotToWheelScalar

JTwoDTransform JDrivetrainMecanum::robotToWheelScalar
protected

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