Class CommandJoystick
java.lang.Object
edu.wpi.first.wpilibj2.command.button.CommandGenericHID
edu.wpi.first.wpilibj2.command.button.CommandJoystick
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the direction of the vector formed by the joystick and its origin in degrees.double
Get the direction of the vector formed by the joystick and its origin in radians.getHID()
Get the underlying GenericHID object.double
Get the magnitude of the direction vector formed by the joystick's current position relative to its origin.double
Get the throttle value of the current joystick.int
Get the channel currently associated with the throttle axis.double
getTwist()
Get the twist value of the current joystick.int
Get the channel currently associated with the twist axis.double
getX()
Get the x position of the HID.int
Get the channel currently associated with the X axis.double
getY()
Get the y position of the HID.int
Get the channel currently associated with the Y axis.double
getZ()
Get the z position of the HID.int
Get the channel currently associated with the Z axis.void
setThrottleChannel
(int channel) Set the channel associated with the throttle axis.void
setTwistChannel
(int channel) Set the channel associated with the twist axis.void
setXChannel
(int channel) Set the channel associated with the X axis.void
setYChannel
(int channel) Set the channel associated with the Y axis.void
setZChannel
(int channel) Set the channel associated with the Z axis.top()
Constructs an event instance around the top button's digital signal.Constructs an event instance around the top button's digital signal.trigger()
Constructs an event instance around the trigger button's digital signal.Constructs an event instance around the trigger button's digital signal.Methods inherited from class edu.wpi.first.wpilibj2.command.button.CommandGenericHID
axisGreaterThan, axisGreaterThan, axisLessThan, axisLessThan, axisMagnitudeGreaterThan, axisMagnitudeGreaterThan, button, button, getRawAxis, isConnected, pov, pov, povCenter, povDown, povDownLeft, povDownRight, povLeft, povRight, povUp, povUpLeft, povUpRight, setRumble
-
Constructor Details
-
CommandJoystick
Construct an instance of a controller.- Parameters:
port
- The port index on the Driver Station that the controller is plugged into.
-
-
Method Details
-
getHID
Get the underlying GenericHID object.- Overrides:
getHID
in classCommandGenericHID
- Returns:
- the wrapped GenericHID object
-
trigger
Constructs an event instance around the trigger button's digital signal.- Returns:
- an event instance representing the trigger button's digital signal attached to the
default scheduler button loop
. - See Also:
-
trigger
Constructs an event instance around the trigger button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the trigger button's digital signal attached to the given loop.
-
top
Constructs an event instance around the top button's digital signal.- Returns:
- an event instance representing the top button's digital signal attached to the
default scheduler button loop
. - See Also:
-
top
Constructs an event instance around the top button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the top button's digital signal attached to the given loop.
-
setXChannel
Set the channel associated with the X axis.- Parameters:
channel
- The channel to set the axis to.
-
setYChannel
Set the channel associated with the Y axis.- Parameters:
channel
- The channel to set the axis to.
-
setZChannel
Set the channel associated with the Z axis.- Parameters:
channel
- The channel to set the axis to.
-
setThrottleChannel
Set the channel associated with the throttle axis.- Parameters:
channel
- The channel to set the axis to.
-
setTwistChannel
Set the channel associated with the twist axis.- Parameters:
channel
- The channel to set the axis to.
-
getXChannel
Get the channel currently associated with the X axis.- Returns:
- The channel for the axis.
-
getYChannel
Get the channel currently associated with the Y axis.- Returns:
- The channel for the axis.
-
getZChannel
Get the channel currently associated with the Z axis.- Returns:
- The channel for the axis.
-
getTwistChannel
Get the channel currently associated with the twist axis.- Returns:
- The channel for the axis.
-
getThrottleChannel
Get the channel currently associated with the throttle axis.- Returns:
- The channel for the axis.
-
getX
Get the x position of the HID.- Returns:
- the x position
-
getY
Get the y position of the HID.- Returns:
- the y position
-
getZ
Get the z position of the HID.- Returns:
- the z position
-
getTwist
Get the twist value of the current joystick. This depends on the mapping of the joystick connected to the current port.- Returns:
- The Twist value of the joystick.
-
getThrottle
Get the throttle value of the current joystick. This depends on the mapping of the joystick connected to the current port.- Returns:
- The Throttle value of the joystick.
-
getMagnitude
Get the magnitude of the direction vector formed by the joystick's current position relative to its origin.- Returns:
- The magnitude of the direction vector
-
getDirectionRadians
Get the direction of the vector formed by the joystick and its origin in radians.- Returns:
- The direction of the vector in radians
-
getDirectionDegrees
Get the direction of the vector formed by the joystick and its origin in degrees.- Returns:
- The direction of the vector in degrees
-