Package frclib.motor
Class FrcServo
java.lang.Object
trclib.motor.TrcServo
frclib.motor.FrcServo
- All Implemented Interfaces:
TrcExclusiveSubsystem
This class implements an FRC specific servo motor that connects to a specified PWM channel on the RoboRIO.
This class extends TrcServo and is implementing the abstract methods required by TrcServo.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.motor.TrcServo
TrcServo.Params
Nested classes/interfaces inherited from interface trclib.robotcore.TrcExclusiveSubsystem
TrcExclusiveSubsystem.OwnershipParams
-
Field Summary
Fields inherited from class trclib.motor.TrcServo
servoSetPosElapsedTimer, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor: Create an instance of the object.FrcServo
(String instanceName, int pwmChannel, TrcServo.Params params) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptiondouble
This method returns the logical position value set by the last setLogicalPosition call.boolean
This method checks if the servo motor direction is inverted.void
setInverted
(boolean inverted) This method inverts the servo motor direction.void
setLogicalPosition
(double position) This method sets the logical position of the servo motor.Methods inherited from class trclib.motor.TrcServo
cancel, cancel, follow, getPosition, getPower, presetPositionDown, presetPositionUp, printElapsedTime, setElapsedTimerEnabled, setLogicalPosRange, setMaxStepRate, setPhysicalPosRange, setPosition, setPosition, setPosition, setPosition, setPosition, setPosition, setPosition, setPosition, setPosPresets, setPower, setPower, setPower, setPower, setPower, setPower, setPresetPosition, toLogicalPosition, toPhysicalPosition, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface trclib.robotcore.TrcExclusiveSubsystem
acquireExclusiveAccess, acquireOwnership, cancelExclusiveAccess, getCurrentOwner, hasOwnership, releaseExclusiveAccess, releaseOwnership, validateOwnership
-
Constructor Details
-
FrcServo
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.pwmChannel
- specifies the PWM channel the servo is connected to.params
- specifies the parameters of the servo.
-
FrcServo
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.pwmChannel
- specifies the PWM channel the servo is connected to.
-
-
Method Details
-
setInverted
public void setInverted(boolean inverted) This method inverts the servo motor direction.- Specified by:
setInverted
in classTrcServo
- Parameters:
inverted
- specifies true to invert the servo direction, false otherwise.
-
isInverted
public boolean isInverted()This method checks if the servo motor direction is inverted.- Specified by:
isInverted
in classTrcServo
- Returns:
- true if the servo direction is inverted, false otherwise.
-
setLogicalPosition
public void setLogicalPosition(double position) This method sets the logical position of the servo motor.- Specified by:
setLogicalPosition
in classTrcServo
- Parameters:
position
- specifies the logical position of the servo motor in the range of [0.0, 1.0].
-
getLogicalPosition
public double getLogicalPosition()This method returns the logical position value set by the last setLogicalPosition call. Note that servo motors do not provide real time position feedback. Therefore, getLogicalPosition doesn't actually return the current position.- Specified by:
getLogicalPosition
in classTrcServo
- Returns:
- motor position value set by the last setLogicalPosition call in the range of [0.0, 1.0].
-