WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
JoystickSim.hpp
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
8
9namespace wpi {
10
11class Joystick;
12
13namespace sim {
14
15/**
16 * Class to control a simulated joystick.
17 */
18class JoystickSim : public GenericHIDSim {
19 public:
20 /**
21 * Constructs from a Joystick object.
22 *
23 * @param joystick joystick to simulate
24 */
25 explicit JoystickSim(const Joystick& joystick);
26
27 /**
28 * Constructs from a joystick port number.
29 *
30 * @param port port number
31 */
32 explicit JoystickSim(int port);
33
34 /**
35 * Set the X value of the joystick.
36 *
37 * @param value the new X value
38 */
39 void SetX(double value);
40
41 /**
42 * Set the Y value of the joystick.
43 *
44 * @param value the new Y value
45 */
46 void SetY(double value);
47
48 /**
49 * Set the Z value of the joystick.
50 *
51 * @param value the new Z value
52 */
53 void SetZ(double value);
54
55 /**
56 * Set the twist value of the joystick.
57 *
58 * @param value the new twist value
59 */
60 void SetTwist(double value);
61
62 /**
63 * Set the throttle value of the joystick.
64 *
65 * @param value the new throttle value
66 */
67 void SetThrottle(double value);
68
69 /**
70 * Set the trigger value of the joystick.
71 *
72 * @param state the new value
73 */
74 void SetTrigger(bool state);
75
76 /**
77 * Set the top state of the joystick.
78 *
79 * @param state the new state
80 */
81 void SetTop(bool state);
82
83 private:
84 const Joystick* m_joystick = nullptr;
85};
86
87} // namespace sim
88} // namespace wpi
Handle input from standard Joysticks connected to the Driver Station.
Definition Joystick.hpp:22
GenericHIDSim(const GenericHID &joystick)
Constructs from a GenericHID object.
void SetX(double value)
Set the X value of the joystick.
void SetTop(bool state)
Set the top state of the joystick.
JoystickSim(int port)
Constructs from a joystick port number.
JoystickSim(const Joystick &joystick)
Constructs from a Joystick object.
void SetZ(double value)
Set the Z value of the joystick.
void SetThrottle(double value)
Set the throttle value of the joystick.
void SetTwist(double value)
Set the twist value of the joystick.
void SetY(double value)
Set the Y value of the joystick.
void SetTrigger(bool state)
Set the trigger value of the joystick.
Definition CTREPCMSim.hpp:13
Definition CvSource.hpp:15