WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
frc2::CommandJoystick Class Reference

A version of frc::Joystick with Trigger factories for command-based. More...

#include <frc2/command/button/CommandJoystick.h>

Inheritance diagram for frc2::CommandJoystick:
frc2::CommandGenericHID

Public Member Functions

 CommandJoystick (int port)
 Construct an instance of a controller.
 
frc::JoystickGetHID ()
 Get the underlying GenericHID object.
 
class Trigger Trigger (frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
 Constructs an event instance around the trigger button's digital signal.
 
class Trigger Top (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs an event instance around the top button's digital signal.
 
double GetMagnitude () const
 Get the magnitude of the direction vector formed by the joystick's current position relative to its origin.
 
units::radian_t GetDirection () const
 Get the direction of the vector formed by the joystick and its origin.
 
- Public Member Functions inherited from frc2::CommandGenericHID
 CommandGenericHID (int port)
 Construct an instance of a device.
 
frc::GenericHIDGetHID ()
 Get the underlying GenericHID object.
 
Trigger Button (int button, frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs an event instance around this button's digital signal.
 
Trigger POV (int angle, frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around this angle of a POV on the HID.
 
Trigger POV (int pov, int angle, frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around this angle of a POV on the HID.
 
Trigger POVUp (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the 0 degree angle (up) of the default (index 0) POV on the HID.
 
Trigger POVUpRight (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the 45 degree angle (right up) of the default (index 0) POV on the HID.
 
Trigger POVRight (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the 90 degree angle (right) of the default (index 0) POV on the HID.
 
Trigger POVDownRight (frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the 135 degree angle (right down) of the default (index 0) POV on the HID.
 
Trigger POVDown (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the 180 degree angle (down) of the default (index 0) POV on the HID.
 
Trigger POVDownLeft (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the 225 degree angle (down left) of the default (index 0) POV on the HID.
 
Trigger POVLeft (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the 270 degree angle (left) of the default (index 0) POV on the HID.
 
Trigger POVUpLeft (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the 315 degree angle (left up) of the default (index 0) POV on the HID.
 
Trigger POVCenter (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance based around the center (not pressed) position of the default (index 0) POV on the HID.
 
Trigger AxisLessThan (int axis, double threshold, frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
 Constructs a Trigger instance that is true when the axis value is less than threshold, attached to the default command scheduler button loop.
 
Trigger AxisGreaterThan (int axis, double threshold, frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
 Constructs a Trigger instance that is true when the axis value is greater than threshold, attached to the default command scheduler button loop.
 
Trigger AxisMagnitudeGreaterThan (int axis, double threshold, frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
 Constructs a Trigger instance that is true when the axis magnitude value is greater than threshold, attached to the given loop.
 
void SetRumble (frc::GenericHID::RumbleType type, double value)
 Set the rumble output for the HID.
 
bool IsConnected () const
 Get if the HID is connected.
 

Detailed Description

A version of frc::Joystick with Trigger factories for command-based.

See also
frc::Joystick

Constructor & Destructor Documentation

◆ CommandJoystick()

frc2::CommandJoystick::CommandJoystick ( int port)
explicit

Construct an instance of a controller.

Parameters
portThe port index on the Driver Station that the controller is plugged into.

Member Function Documentation

◆ GetDirection()

units::radian_t frc2::CommandJoystick::GetDirection ( ) const

Get the direction of the vector formed by the joystick and its origin.

Returns
The direction of the vector.

◆ GetHID()

frc::Joystick & frc2::CommandJoystick::GetHID ( )

Get the underlying GenericHID object.

Returns
the wrapped GenericHID object

◆ GetMagnitude()

double frc2::CommandJoystick::GetMagnitude ( ) const

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

◆ Top()

class Trigger frc2::CommandJoystick::Top ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs an event instance around the top button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
an event instance representing the top button's digital signal attached to the given loop.

◆ Trigger()

class Trigger frc2::CommandJoystick::Trigger ( frc::EventLoop * loop = CommandScheduler::GetInstance().GetDefaultButtonLoop()) const

Constructs an event instance around the trigger button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
an event instance representing the trigger button's digital signal attached to the given loop.

The documentation for this class was generated from the following file: