#include <JSwerveModuleDifferential.h>
◆ JSwerveModuleDifferential()
- Parameters
-
_m1 | positive speed drives forward and steers CCW if viewed from above, just swap which motor is m1 and m2 or reverse a motor if this is not the case |
_m2 | positive speed drives forward and steers CW if viewed from above, just swap which motor is m1 and m2 or reverse a motor if this is not the case |
_angleEncoder | JEncoder, should be absolute encoder, from 0-360 degrees for a revolution |
_angleControlLoop | JSwerveAngleControlLoop object |
_driveRatio | motor revolutions per drive distance unit |
_steeringRatio | motor revolutions per steering revolution |
_angleOffset | degrees, default=0 added to encoder reading, adjust until angle is zero when wheel is straight forwards |
◆ getAngle()
float JSwerveModuleDifferential::getAngle |
( |
| ) |
|
|
inlinevirtual |
get angle measurement from wheel
- Return values
-
Reimplemented from JSwerveModule.
◆ getEnable()
bool JSwerveModuleDifferential::getEnable |
( |
| ) |
|
|
inlinevirtual |
get enable state of module
- Return values
-
(bool) | true = motors enabled, false = motors disabled |
Reimplemented from JSwerveModule.
◆ getMaxSpeed()
float JSwerveModuleDifferential::getMaxSpeed |
( |
| ) |
|
|
inlinevirtual |
◆ run()
void JSwerveModuleDifferential::run |
( |
| ) |
|
|
inlinevirtual |
call this in loop() so that the swerve module can update its motors and angle control loop
Reimplemented from JSwerveModule.
◆ set()
void JSwerveModuleDifferential::set |
( |
float |
_speed, |
|
|
float |
_angle, |
|
|
bool |
_run = true |
|
) |
| |
|
inlinevirtual |
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 from JSwerveModule.
◆ setEnable()
bool JSwerveModuleDifferential::setEnable |
( |
bool |
_enable | ) |
|
|
inlinevirtual |
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 from JSwerveModule.
◆ zeroTurnCounter()
long JSwerveModuleDifferential::zeroTurnCounter |
( |
| ) |
|
|
inlinevirtual |
zeros the encoder's counter of full turns, leaving only the fractional turn
- Return values
-
(long) | previous turn counter value |
Reimplemented from JSwerveModule.
◆ angleControlLoop
◆ angleEncoder
JEncoder& JSwerveModuleDifferential::angleEncoder |
◆ angleOffset
float JSwerveModuleDifferential::angleOffset = 0 |
◆ angleSetpoint
float JSwerveModuleDifferential::angleSetpoint = 0 |
◆ driveRatio
float JSwerveModuleDifferential::driveRatio = 1 |
◆ m1
◆ m2
◆ speedSetpoint
float JSwerveModuleDifferential::speedSetpoint = 0 |
◆ steeringRatio
float JSwerveModuleDifferential::steeringRatio = 1 |
The documentation for this class was generated from the following file: