|
| JServoControllerStallProtected (JServoControllerAdvanced advancedServo, JServoStallSensing &servoStallSensor, float _unStallThreshold, float _stallThreshold, unsigned long _stallActivateTimeout, unsigned long _stallDeactivateTimeout) |
|
virtual void | run () |
| call this in your main loop
|
|
bool | isStallProtectionActivated () |
|
unsigned long | getTimeSinceStallStateChangeMillis () |
|
bool | isStalled () |
|
bool | getStallProtectionEnable () |
|
void | setStallProtectionEnable (bool enableStallProtection) |
|
| JServoControllerAdvanced (JMotorDriverServoAdvanced &_servo, float _weakFreq=.5, unsigned long _weakenTimeout=0, float _normalFreq=1.0, unsigned long _startWeakTimeout=0, bool _reverse=false, float velLimit=INFINITY, float accelLimit=INFINITY, float decelLimit=NAN, unsigned long _disableTimeout=0, float _minAngleLimit=0, float _maxAngleLimit=180, float _pos=90, float _minSetAngle=0, float _maxSetAngle=180, int minServoVal=544, int maxServoVal=2400, bool _preventGoingWrongWay=true, bool _preventGoingTooFast=true, float _stoppingDecelLimit=INFINITY) |
| Constructor for JServoControllerAdvanced, a class for controlling JMotorDriverServoAdvanced, with angle calibration and accel and velocity limiting.
|
|
bool | setEnable (bool _enable) |
| enable or disable the servo (start or stop sending a signal to the servo)
|
|
void | setStrengthWeak () |
| set servo to weaker setting
|
|
void | setStrengthNormal () |
| set servo to normal setting
|
|
void | adjustServoFrequency (float freq=1.0) |
| adjust frequency as a fraction of standard 50hz frequency lower frequencies (try .75) may let you reduce how strongly the servo holds its position
|
|
void | setWeakFreq (float _weak) |
| change setting for what fraction of normal frequency the signal should go to in order to weaken the servo's strength
|
|
void | setNormalFreq (float _norm) |
|
bool | getWeakened () |
|
void | setWeakTimeout (unsigned long _timeout) |
|
unsigned long | getWeakenTimeout () |
|
void | setStartWeakTimeout (unsigned long _timeout) |
|
unsigned long | getStartWeakTimeout () |
|
float | getWeakFreq () |
|
float | getNormalFreq () |
|
| JServoController (JMotorDriverServo &_servo, bool _reverse=false, float velLimit=INFINITY, float accelLimit=INFINITY, float decelLimit=NAN, unsigned long _disableTimeout=0, float _minAngleLimit=0, float _maxAngleLimit=180, float _pos=90, float _minSetAngle=0, float _maxSetAngle=180, int minServoVal=544, int maxServoVal=2400, bool _preventGoingWrongWay=true, bool _preventGoingTooFast=true, float _stoppingDecelLimit=INFINITY) |
| Constructor for JServoController, a class for controlling JMotorDriverServo, with angle calibration and accel and velocity limiting.
|
|
void | setAngleImmediate (float angle, bool _run=true) |
| set servo angle immediately, without velocity or acceleration limiting
|
|
void | setAngleImmediateInc (float angleDiff, bool _run=true) |
| increment servo angle and set immediately, without velocity or acceleration limiting
|
|
void | setAngleSmoothed (float angle, bool _run=true) |
| set servo angle target, servo will move to target but at limited velocity and acceleration
|
|
void | setDisableTimeout (unsigned long _timeout) |
| default: 0, after how many milliseconds of no movement should the servo be disabled? 0=never disable
|
|
unsigned long | getDisableTimeout () |
|
unsigned long | getLastMovedMillis () |
| returns the value of millis() when the servo last moved
|
|
unsigned long | getMillisSinceMoved () |
| returns the number of milliseconds since the servo last moved
|
|
void | setLastMovedMillis (unsigned long mil) |
| allows for changing the variable that stores when the servo last moved
|
|
bool | enable () |
| equivalent to setEnable(true)
|
|
bool | disable () |
| equivalent to setEnable(false)
|
|
bool | getEnable () |
| returns whether the servo is enabled or not
|
|
float | getPosTarget () |
| what position is the servo moving towards or at
|
|
float | getPos () |
| what position is the servo actually being set to? (slowly approaches target if smoothing is used)
|
|
float | getVelocity () |
| what rate is servo position being changed at?
|
|
bool | isPosAtTarget () |
| true if position=target, false otherwise
|
|
bool | isPosNotAtTarget () |
| equivalent to !isPosAtTarget()
|
|
float | distToTarget () |
| returns target-position
|
|
void | restartRun () |
| if you stopped calling run() for a while, call this before restarting run() to avoid a big jump in movement
|
|
bool | getActive () |
| returns whether the servo is "awake" (whether signals are being sent)
|
|
void | wake () |
| if the servo has been disabled because of inactivity, calling this function simulates the servo being told to move and wakes it up
|
|
void | setReverse (bool rev) |
|
bool | getReverse () |
|
void | setAngleLimits (float _minAngleLimit, float _maxAngleLimit) |
|
void | setMinAngleLimit (float _minAngleLimit) |
|
void | setMaxAngleLimit (float _maxAngleLimit) |
|
float | getMinAngleLimit () |
|
float | getMaxAngleLimit () |
|
float | getAngleLimitRange () |
|
void | setSetAngles (float _minSetAngle, float _maxSetAngle) |
|
void | setMinSetAngle (float _minSetAngle) |
|
void | setMaxSetAngle (float _maxSetAngle) |
|
float | getAccelLimit () |
| returns value of accelLimit
|
|
float | getDecelLimit () |
|
float | getVelLimit () |
| returns value of velLimit
|
|
void | setAccelLimit (float accelLim) |
| set maximum rate that motor speed can be changed at
|
|
void | setAccelAndDecelLimits (float accelLim, float decelLim=NAN) |
|
void | setDecelLimit (float decelLim=NAN) |
|
void | setVelLimit (float velLim) |
| set maximum motor speed
|
|
void | setVelAccelLimits (float velLim, float accelLim, float decelLim=NAN) |
|
void | setPosition (float pos, bool _run=true) |
| sets servo position, leaves target where it was
|
|
void | setMinServoValue (int value) |
| microseconds for shortest servo pulse
|
|
void | setMaxServoValue (int value) |
| microseconds for longest servo pulse
|
|
void | setServoRangeValues (int min, int max) |
| set the settings for short and long servo pulses at the same time
|
|
int | getMinServoRangeValue () |
| returns setting for microseconds for shortest servo pulse
|
|
int | getMaxServoRangeValue () |
| returns setting for microseconds for longest servo pulse
|
|
int | getServoValueRange () |
| returns difference (in microseconds) between longest and shortest servo pulse settings
|
|
int | getSetMicroseconds () |
| returns how many microseconds the servo signal pulse was most recently set to
|
|
bool | getConstrainRange () |
| returns whether the range of set() will be constrained to within -1 and 1
|
|
void | setConstrainRange (bool _constrainRange) |
| set whether the range of set() will be constrained to within -1 and 1
|
|
void | setVel (float vel, bool _run=true) |
| set velocity for controller
|
|
void | setVelTarget (float vel, bool _run=true) |
| set target velocity for controller (acceleration limited)
|
|
float | getVelTarget () |
| get target velocity for controller
|
|
float | getVel () |
| get current velocity of motor
|
|
float | getDriverSetVal () |
| returns the value the motor driver is being set to
|
|
bool | isDriverInRange () |
| true if motor driver is being set to within its range, false if driver is at a maximum
|
|
float | getDriverMinRange () |
| if getDriverSetVal goes below this, isDriverInRange will go false
|
|
float | getDriverMaxRange () |
| if getDriverSetVal exceeds this, isDriverInRange will go false
|
|
float | getMaxVel () |
| How fast of a motor speed setting would get adjusted to full motor power.
|
|
float | getMinVel () |
| slowest speed motor can go
|
|
void | setMaxDriverRangeAmount (float _driverRangeAmount) |
| set what fraction of driverRange can be used
|
|
bool | setPosTarget (float _posTarget, bool _run=true) |
| set target position (motor drives towards position, following acceleration profile)
|
|
bool | setPosSetpoint (float _posSetpoint, bool _run=true) |
| set position for motor to drive towards position as fast as possible (setpoint for control loop if available)
|
|
bool | setPosDelta (float _posDelta, bool _run=true, bool _resetPos=false) |
| alternative method for setting velocity that uses setPosSetpoint
|
|
float | getPosSetpoint () |
| get position controller is currently trying to get to
|
|
float | resetPos () |
| reset what position the controller thinks it's in
|
|
bool | isPosModeNotVelocity () |
| true if controller is in position target mode, false if in velocity mode
|
|