1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include "frc/simulation/GenericHIDSim.h"
namespace frc {
class Joystick;
namespace sim {
/**
* Class to control a simulated joystick.
*/
class JoystickSim : public GenericHIDSim {
public:
/**
* Constructs from a Joystick object.
*
* @param joystick joystick to simulate
*/
explicit JoystickSim(const Joystick& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit JoystickSim(int port);
/**
* Set the X value of the joystick.
*
* @param value the new X value
*/
void SetX(double value);
/**
* Set the Y value of the joystick.
*
* @param value the new Y value
*/
void SetY(double value);
/**
* Set the Z value of the joystick.
*
* @param value the new Z value
*/
void SetZ(double value);
/**
* Set the twist value of the joystick.
*
* @param value the new twist value
*/
void SetTwist(double value);
/**
* Set the throttle value of the joystick.
*
* @param value the new throttle value
*/
void SetThrottle(double value);
/**
* Set the trigger value of the joystick.
*
* @param state the new value
*/
void SetTrigger(bool state);
/**
* Set the top state of the joystick.
*
* @param state the new state
*/
void SetTop(bool state);
private:
const Joystick* m_joystick = nullptr;
};
} // namespace sim
} // namespace frc