defines a common interface for swerve modules
More...
#include <JSwerveModule.h>
|
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
|
|
defines a common interface for swerve modules
◆ 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 |
◆ 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 |
◆ 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
-
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: