-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJoystickAttack3.cpp
More file actions
executable file
·65 lines (53 loc) · 1.61 KB
/
JoystickAttack3.cpp
File metadata and controls
executable file
·65 lines (53 loc) · 1.61 KB
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
/*----------------------------------------------------------------------------*/
/* Copyright (c) TechForKid 2014. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#include "JoystickAttack3.h"
/**
* Construct an instance of a tfkJoystickAttack3.
* The joystick index is the usb port on the drivers station.
*
* @param port The port on the driver station that the joystick is plugged into.
*/
/* --------------------------------------------------------------------------- */
// Constructors
JoystickAttack3::JoystickAttack3(UINT32 port)
: Joystick(port),
m_Seuil_X(0.1),
m_Seuil_XX(-0.1),
m_Seuil_Y(0.1),
m_Seuil_YY(-0.1)
{
}
JoystickAttack3::~JoystickAttack3()
{
}
/* --------------------------------------------------------------------------- */
// Methods
/* --------------------------------------------------------------------------- */
/**
* Get the X value of the joystick in ENU - BODY format.
*/
float JoystickAttack3::GetX()
{
float v = -Joystick::GetY(); // Pour retourner la valeur Y de la classe de base, mais de sens inverse
if (v < m_Seuil_X && v > m_Seuil_XX)
{
v = 0;
}
return v;
}
float JoystickAttack3::GetY()
{
float v1 = Joystick::GetX();
if ( v1 < m_Seuil_X && v1 > m_Seuil_XX)
{
v1 = 0;
}
return v1;
}
float JoystickAttack3::GetT()
{
return 0.5 * Joystick::GetZ() + 0.5;
}