WPILibC++ 2024.3.2
CommandPS5Controller.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6#include <frc/PS5Controller.h>
7
8#include "Trigger.h"
10
11namespace frc2 {
12/**
13 * A version of {@link PS5Controller} with {@link Trigger} factories for
14 * command-based.
15 *
16 * @see PS5Controller
17 */
19 public:
20 using PS5Controller::PS5Controller;
21
22 /**
23 * Constructs an event instance around this button's digital signal.
24 *
25 * @param button the button index
26 * @param loop the event loop instance to attach the event to. Defaults to the
27 * CommandScheduler's default loop.
28 * @return an event instance representing the button's digital signal attached
29 * to the given loop.
30 */
31 Trigger Button(int button,
33 .GetDefaultButtonLoop()) const;
34
35 /**
36 * Constructs an event instance around the square button's digital signal.
37 *
38 * @param loop the event loop instance to attach the event to. Defaults to the
39 * CommandScheduler's default loop.
40 * @return an event instance representing the square button's digital signal
41 * attached to the given loop.
42 */
44 .GetDefaultButtonLoop()) const;
45
46 /**
47 * Constructs an event instance around the cross button's digital signal.
48 *
49 * @param loop the event loop instance to attach the event to. Defaults to the
50 * CommandScheduler's default loop.
51 * @return an event instance representing the cross button's digital signal
52 * attached to the given loop.
53 */
55 .GetDefaultButtonLoop()) const;
56
57 /**
58 * Constructs an event instance around the circle button's digital signal.
59 *
60 * @param loop the event loop instance to attach the event to. Defaults to the
61 * CommandScheduler's default loop.
62 * @return an event instance representing the circle button's digital signal
63 * attached to the given loop.
64 */
66 .GetDefaultButtonLoop()) const;
67
68 /**
69 * Constructs an event instance around the triangle button's digital signal.
70 *
71 * @param loop the event loop instance to attach the event to. Defaults to the
72 * CommandScheduler's default loop.
73 * @return an event instance representing the triangle button's digital signal
74 * attached to the given loop.
75 */
77 .GetDefaultButtonLoop()) const;
78
79 /**
80 * Constructs an event instance around the L1 button's digital signal.
81 *
82 * @param loop the event loop instance to attach the event to. Defaults to the
83 * CommandScheduler's default loop.
84 * @return an event instance representing the L1 button's digital signal
85 * attached to the given loop.
86 */
88 CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
89
90 /**
91 * Constructs an event instance around the R1 button's digital signal.
92 *
93 * @param loop the event loop instance to attach the event to. Defaults to the
94 * CommandScheduler's default loop.
95 * @return an event instance representing the R1 button's digital signal
96 * attached to the given loop.
97 */
99 CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
100
101 /**
102 * Constructs an event instance around the L2 button's digital signal.
103 *
104 * @param loop the event loop instance to attach the event to. Defaults to the
105 * CommandScheduler's default loop.
106 * @return an event instance representing the L2 button's digital signal
107 * attached to the given loop.
108 */
110 CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
111
112 /**
113 * Constructs an event instance around the R2 button's digital signal.
114 *
115 * @param loop the event loop instance to attach the event to. Defaults to the
116 * CommandScheduler's default loop.
117 * @return an event instance representing the R2 button's digital signal
118 * attached to the given loop.
119 */
121 CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
122
123 /**
124 * Constructs an event instance around the options button's digital signal.
125 *
126 * @param loop the event loop instance to attach the event to. Defaults to the
127 * CommandScheduler's default loop.
128 * @return an event instance representing the options button's digital signal
129 * attached to the given loop.
130 */
132 .GetDefaultButtonLoop()) const;
133
134 /**
135 * Constructs an event instance around the L3 button's digital signal.
136 *
137 * @param loop the event loop instance to attach the event to. Defaults to the
138 * CommandScheduler's default loop.
139 * @return an event instance representing the L3 button's digital signal
140 * attached to the given loop.
141 */
143 CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
144
145 /**
146 * Constructs an event instance around the R3 button's digital signal.
147 *
148 * @param loop the event loop instance to attach the event to. Defaults to the
149 * CommandScheduler's default loop.
150 * @return an event instance representing the R3 button's digital signal
151 * attached to the given loop.
152 */
154 CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
155
156 /**
157 * Constructs an event instance around the PS button's digital signal.
158 *
159 * @param loop the event loop instance to attach the event to. Defaults to the
160 * CommandScheduler's default loop.
161 * @return an event instance representing the PS button's digital signal
162 * attached to the given loop.
163 */
165 CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
166
167 /**
168 * Constructs an event instance around the touchpad's digital signal.
169 *
170 * @param loop the event loop instance to attach the event to. Defaults to the
171 * CommandScheduler's default loop.
172 * @return an event instance representing the touchpad's digital signal
173 * attached to the given loop.
174 */
176 .GetDefaultButtonLoop()) const;
177};
178} // namespace frc2
A version of PS5Controller with Trigger factories for command-based.
Definition: CommandPS5Controller.h:18
Trigger Touchpad(frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs an event instance around the touchpad's digital signal.
Trigger PS(frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
Constructs an event instance around the PS button's digital signal.
Trigger Triangle(frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs an event instance around the triangle button's digital signal.
Trigger R1(frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
Constructs an event instance around the R1 button's digital signal.
Trigger L2(frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
Constructs an event instance around the L2 button's digital signal.
Trigger Button(int button, frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs an event instance around this button's digital signal.
Trigger L1(frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
Constructs an event instance around the L1 button's digital signal.
Trigger L3(frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
Constructs an event instance around the L3 button's digital signal.
Trigger Cross(frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs an event instance around the cross button's digital signal.
Trigger Options(frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs an event instance around the options button's digital signal.
Trigger Square(frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs an event instance around the square button's digital signal.
Trigger Circle(frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs an event instance around the circle button's digital signal.
Trigger R3(frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
Constructs an event instance around the R3 button's digital signal.
Trigger R2(frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const
Constructs an event instance around the R2 button's digital signal.
static CommandScheduler & GetInstance()
Returns the Scheduler instance.
This class provides an easy way to link commands to conditions.
Definition: Trigger.h:31
A declarative way to bind a set of actions to a loop and execute them when the loop is polled.
Definition: EventLoop.h:15
Handle input from PS5 controllers connected to the Driver Station.
Definition: PS5Controller.h:23
Definition: TrapezoidProfileSubsystem.h:12