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

defines a common interface for swerve modules More...

#include <JSwerveModule.h>

Inheritance diagram for JSwerveModule:
Inheritance graph
[legend]

Public Member Functions

virtual void set (float _speed, float _angle, bool _run=true)
 set speed and angle setpoints for wheel
 
virtual float getAngle ()
 get angle measurement from wheel
 
virtual float getMaxSpeed ()
 maximum drive speed
 
virtual long zeroTurnCounter ()
 zeros the encoder's counter of full turns, leaving only the fractional turn
 
virtual bool setEnable (bool _enable)
 set enable state of swerve module motors
 
virtual bool getEnable ()
 get enable state of module
 
bool enable ()
 enable motor
 
bool disable ()
 disable motor
 
virtual void run ()
 call this in loop() so that the swerve module can update its motors and angle control loop
 

Detailed Description

defines a common interface for swerve modules

Member Function Documentation

◆ disable()

bool JSwerveModule::disable ( )
inline

disable motor

Note
equivalent to setEnable(false)
Return values
(bool)true if state changed, false if state already set

◆ enable()

bool JSwerveModule::enable ( )
inline

enable motor

Note
equivalent to setEnable(true)
Return values
(bool)true if state changed, false if state already set

◆ getAngle()

virtual float JSwerveModule::getAngle ( )
virtual

get angle measurement from wheel

Return values
(float)angle in degrees

Reimplemented in JSwerveModuleDifferential.

◆ getEnable()

virtual bool JSwerveModule::getEnable ( )
virtual

get enable state of module

Return values
(bool)true = motors enabled, false = motors disabled

Reimplemented in JSwerveModuleDifferential.

◆ getMaxSpeed()

virtual float JSwerveModule::getMaxSpeed ( )
virtual

maximum drive speed

Reimplemented in JSwerveModuleDifferential.

◆ run()

virtual void JSwerveModule::run ( )
virtual

call this in loop() so that the swerve module can update its motors and angle control loop

Reimplemented in JSwerveModuleDifferential.

◆ set()

virtual void JSwerveModule::set ( float  _speed,
float  _angle,
bool  _run = true 
)
virtual

set speed and angle setpoints for wheel

Parameters
speed(float) speed for wheel
angle(float) angle in degrees
run(bool) default:true, true = call run() in this function, false = you'll call run() yourself
Return values
None

Reimplemented in JSwerveModuleDifferential.

◆ setEnable()

virtual bool JSwerveModule::setEnable ( bool  _enable)
virtual

set enable state of swerve module motors

Parameters
_enable(bool) true = enable module, false = disable module
Return values
(bool)true if state changed, false if state already set

Reimplemented in JSwerveModuleDifferential.

◆ zeroTurnCounter()

virtual long JSwerveModule::zeroTurnCounter ( )
virtual

zeros the encoder's counter of full turns, leaving only the fractional turn

Return values
(long)previous turn counter value

Reimplemented in JSwerveModuleDifferential.


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