Class TrcDifferentialServoWrist
- All Implemented Interfaces:
TrcExclusiveSubsystem
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class contains all the parameters of the Differential Servo Wrist.Nested classes/interfaces inherited from interface trclib.robotcore.TrcExclusiveSubsystem
TrcExclusiveSubsystem.OwnershipParams
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTrcDifferentialServoWrist
(String instanceName, TrcDifferentialServoWrist.Params params) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
This method cancels previous wrist operation if applicable.void
This method cancels previous wrist operation if applicable.double
This method returns the physical rotate position value of the wrist.double
This method returns the last set rotate power value.double
This method returns the physical tilt position value of the wrist.double
This method returns the last set tilt power value.void
rotatePresetPositionDown
(String owner) This method sets the wrist to the next rotate preset position down from the current position.void
rotatePresetPositionUp
(String owner) This method sets the wrist to the next rotate preset position up from the current position.void
setPosition
(double tiltPos, double rotatePos) This method sets the tilt position of the wrist.void
setPosition
(double delay, double tiltPos, double rotatePos, TrcEvent completionEvent, double timeout) This method sets the tilt position of the wrist.void
setPosition
(double tiltPos, double rotatePos, TrcEvent completionEvent, double timeout) This method sets the tilt position of the wrist.void
setPosition
(String owner, double delay, double tiltPos, double rotatePos, TrcEvent completionEvent, double timeout) This method sets the tilt position of the wrist.void
setPower
(double tiltPower, double rotatePower) This method sets the wrist tilting power.void
setPower
(double delay, double tiltPower, double rotatePower) This method sets the wrist tilting power.void
This method sets the wrist tilting power.void
setRotatePresetPosition
(String owner, double delay, int presetIndex, TrcEvent event, double timeout) This method sets the wrist to the specified rotate preset position.void
setTiltPresetPosition
(String owner, double delay, int presetIndex, TrcEvent event, double timeout) This method sets the wrist to the specified tilt preset position.void
tiltPresetPositionDown
(String owner) This method sets the wrist to the next tilt preset position down from the current position.void
tiltPresetPositionUp
(String owner) This method sets the wrist to the next tilt preset position up from the current position.toString()
This method returns the instance name.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
-
Field Details
-
tracer
-
-
Constructor Details
-
TrcDifferentialServoWrist
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.params
- specifies the wrist parameters.
-
-
Method Details
-
toString
This method returns the instance name. -
cancel
This method cancels previous wrist operation if applicable.- Parameters:
owner
- specifies the owner ID to check if the caller has ownership of the subsystem.
-
cancel
public void cancel()This method cancels previous wrist operation if applicable. -
setPower
This method sets the wrist tilting power.- Parameters:
owner
- specifies the owner ID to check if the caller has ownership of the subsystem.delay
- specifies the delay in seconds before setting the power of the wrist, can be zero if no delay.tiltPower
- specifies how fast the wrist will tilt.rotatePower
- specifies how fast the wrist will rotate.
-
setPower
public void setPower(double delay, double tiltPower, double rotatePower) This method sets the wrist tilting power.- Parameters:
delay
- specifies the delay in seconds before setting the power of the wrist, can be zero if no delay.tiltPower
- specifies how fast the wrist will tilt.rotatePower
- specifies how fast the wrist will rotate.
-
setPower
public void setPower(double tiltPower, double rotatePower) This method sets the wrist tilting power.- Parameters:
tiltPower
- specifies how fast the wrist will tilt.rotatePower
- specifies how fast the wrist will rotate.
-
getTiltPower
public double getTiltPower()This method returns the last set tilt power value.- Returns:
- last tilt power set to the wrist.
-
getRotatePower
public double getRotatePower()This method returns the last set rotate power value.- Returns:
- last rotate power set to the wrist.
-
setPosition
public void setPosition(String owner, double delay, double tiltPos, double rotatePos, TrcEvent completionEvent, double timeout) This method sets the tilt position of the wrist. By default, the servo maps its physical position the same as its logical position [0.0, 1.0]. However, if setPhysicalPosRange was called, it could map a real world physical range (e.g. [0.0, 180.0] degrees) to the logical range of [0.0, 1.0]. If an event is given, it sets event after the given amount of time has expired.Servo operates on logical position. On a 180-degree servo, 0.0 is at 0-degree and 1.0 is at 180-degree. For a 90-degree servo, 0->0deg, 1->90deg. If servo direction is inverted, then 0.0 is at 180-degree and 1.0 is at 0-degree.
- Parameters:
owner
- specifies the owner ID to check if the caller has ownership of the subsystem.delay
- specifies the delay in seconds before setting the tilt position of the wrist, can be zero if no delay.tiltPos
- specifies the physical tilt position of the wrist. This value may be in degrees if setPhysicalPosRange is called with the degree range.rotatePos
- specifies the physical rotate position of the wrist. This value may be in degrees if setPhysicalPosRange is called with the degree range.completionEvent
- specifies an event object to signal when the timeout event has expired.timeout
- specifies a maximum time value the operation should be completed in seconds.
-
setPosition
public void setPosition(double delay, double tiltPos, double rotatePos, TrcEvent completionEvent, double timeout) This method sets the tilt position of the wrist. By default, the servo maps its physical position the same as its logical position [0.0, 1.0]. However, if setPhysicalPosRange was called, it could map a real world physical range (e.g. [0.0, 180.0] degrees) to the logical range of [0.0, 1.0]. If an event is given, it sets event after the given amount of time has expired.Servo operates on logical position. On a 180-degree servo, 0.0 is at 0-degree and 1.0 is at 180-degree. For a 90-degree servo, 0->0deg, 1->90deg. If servo direction is inverted, then 0.0 is at 180-degree and 1.0 is at 0-degree.
- Parameters:
delay
- specifies the delay in seconds before setting the tilt position of the wrist, can be zero if no delay.tiltPos
- specifies the physical tilt position of the wrist. This value may be in degrees if setPhysicalPosRange is called with the degree range.rotatePos
- specifies the physical rotate position of the wrist. This value may be in degrees if setPhysicalPosRange is called with the degree range.completionEvent
- specifies an event object to signal when the timeout event has expired.timeout
- specifies a maximum time value the operation should be completed in seconds.
-
setPosition
This method sets the tilt position of the wrist. By default, the servo maps its physical position the same as its logical position [0.0, 1.0]. However, if setPhysicalPosRange was called, it could map a real world physical range (e.g. [0.0, 180.0] degrees) to the logical range of [0.0, 1.0]. If an event is given, it sets event after the given amount of time has expired.Servo operates on logical position. On a 180-degree servo, 0.0 is at 0-degree and 1.0 is at 180-degree. For a 90-degree servo, 0->0deg, 1->90deg. If servo direction is inverted, then 0.0 is at 180-degree and 1.0 is at 0-degree.
- Parameters:
tiltPos
- specifies the physical tilt position of the wrist. This value may be in degrees if setPhysicalPosRange is called with the degree range.rotatePos
- specifies the physical rotate position of the wrist. This value may be in degrees if setPhysicalPosRange is called with the degree range.completionEvent
- specifies an event object to signal when the timeout event has expired.timeout
- specifies a maximum time value the operation should be completed in seconds.
-
setPosition
public void setPosition(double tiltPos, double rotatePos) This method sets the tilt position of the wrist. By default, the servo maps its physical position the same as its logical position [0.0, 1.0]. However, if setPhysicalPosRange was called, it could map a real world physical range (e.g. [0.0, 180.0] degrees) to the logical range of [0.0, 1.0]. If an event is given, it sets event after the given amount of time has expired.Servo operates on logical position. On a 180-degree servo, 0.0 is at 0-degree and 1.0 is at 180-degree. For a 90-degree servo, 0->0deg, 1->90deg. If servo direction is inverted, then 0.0 is at 180-degree and 1.0 is at 0-degree.
- Parameters:
tiltPos
- specifies the physical tilt position of the wrist. This value may be in degrees if setPhysicalPosRange is called with the degree range.rotatePos
- specifies the physical rotate position of the wrist. This value may be in degrees if setPhysicalPosRange is called with the degree range.
-
getTiltPosition
public double getTiltPosition()This method returns the physical tilt position value of the wrist. Generally, servo do not provide real time position feedback. Therefore, it will only return the position set by the last setPosition call.- Returns:
- physical tilt position of the wrist, could be in degrees if setPhysicalPosRange is called to set the range in degrees.
-
getRotatePosition
public double getRotatePosition()This method returns the physical rotate position value of the wrist. Generally, servo do not provide real time position feedback. Therefore, it will only return the position set by the last setPosition call.- Returns:
- physical rotate position of the wrist, could be in degrees if setPhysicalPosRange is called to set the range in degrees.
-
setTiltPresetPosition
public void setTiltPresetPosition(String owner, double delay, int presetIndex, TrcEvent event, double timeout) This method sets the wrist to the specified tilt preset position.- Parameters:
owner
- specifies the owner ID to check if the caller has ownership of the subsystem.delay
- specifies delay time in seconds before setting position, can be zero if no delay.presetIndex
- specifies the index to the preset position array.event
- specifies the event to signal when target is reached, can be null if not provided.timeout
- specifies a maximum time value the operation should be completed in seconds.
-
setRotatePresetPosition
public void setRotatePresetPosition(String owner, double delay, int presetIndex, TrcEvent event, double timeout) This method sets the wrist to the specified rotate preset position.- Parameters:
owner
- specifies the owner ID to check if the caller has ownership of the subsystem.delay
- specifies delay time in seconds before setting position, can be zero if no delay.presetIndex
- specifies the index to the preset position array.event
- specifies the event to signal when target is reached, can be null if not provided.timeout
- specifies a maximum time value the operation should be completed in seconds.
-
tiltPresetPositionUp
This method sets the wrist to the next tilt preset position up from the current position.- Parameters:
owner
- specifies the owner ID that will acquire ownership before setting the preset position and will automatically release ownership when the motor movement is completed, can be null if no ownership is required.
-
tiltPresetPositionDown
This method sets the wrist to the next tilt preset position down from the current position.- Parameters:
owner
- specifies the owner ID that will acquire ownership before setting the preset position and will automatically release ownership when the motor movement is completed, can be null if no ownership is required.
-
rotatePresetPositionUp
This method sets the wrist to the next rotate preset position up from the current position.- Parameters:
owner
- specifies the owner ID that will acquire ownership before setting the preset position and will automatically release ownership when the motor movement is completed, can be null if no ownership is required.
-
rotatePresetPositionDown
This method sets the wrist to the next rotate preset position down from the current position.- Parameters:
owner
- specifies the owner ID that will acquire ownership before setting the preset position and will automatically release ownership when the motor movement is completed, can be null if no ownership is required.
-