Cheetah Software  1.0
GamepadCommand Struct Reference

#include <GamepadCommand.h>

+ Collaboration diagram for GamepadCommand:

Public Member Functions

 GamepadCommand ()
 
void zero ()
 
void set (const gamepad_lcmt *lcmt)
 
void get (gamepad_lcmt *lcmt)
 
void applyDeadband (float f)
 
std::string toString ()
 

Public Attributes

bool leftBumper
 
bool rightBumper
 
bool leftTriggerButton
 
bool rightTriggerButton
 
bool back
 
bool start
 
bool a
 
bool b
 
bool x
 
bool y
 
bool leftStickButton
 
bool rightStickButton
 
bool logitechButton
 
Vec2< float > leftStickAnalog
 
Vec2< float > rightStickAnalog
 
float leftTriggerAnalog
 
float rightTriggerAnalog
 

Detailed Description

Definition at line 12 of file GamepadCommand.h.

Constructor & Destructor Documentation

GamepadCommand::GamepadCommand ( )
inline

Definition at line 13 of file GamepadCommand.h.

References zero().

13 { zero(); }

+ Here is the call graph for this function:

Member Function Documentation

void GamepadCommand::applyDeadband ( float  f)
inline

The Logitech F310's seem to do a bad job of returning to zero exactly, so a deadband around zero is useful when integrating joystick commands

Definition at line 87 of file GamepadCommand.h.

References deadband(), and eigenDeadband().

87  {
92  }
Vec2< float > rightStickAnalog
Vec2< float > leftStickAnalog
float rightTriggerAnalog
T deadband(T x, T range)
Definition: utilities.h:46
void eigenDeadband(Eigen::MatrixBase< T > &v, typename T::Scalar band)
Definition: utilities.h:52
float leftTriggerAnalog
MX f(const MX &x, const MX &u)

+ Here is the call graph for this function:

void GamepadCommand::get ( gamepad_lcmt *  lcmt)
inline

Definition at line 62 of file GamepadCommand.h.

References a, b, back, leftBumper, leftStickButton, leftTriggerAnalog, leftTriggerButton, rightBumper, rightStickButton, rightTriggerAnalog, rightTriggerButton, start, x, and y.

62  {
63  lcmt->leftBumper = leftBumper;
64  lcmt->rightBumper = rightBumper;
65  lcmt->leftTriggerButton = leftTriggerButton;
66  lcmt->rightTriggerButton = rightTriggerButton;
67  lcmt->back = back;
68  lcmt->start = start;
69  lcmt->a = a;
70  lcmt->x = x;
71  lcmt->b = b;
72  lcmt->y = y;
73  lcmt->leftStickButton = leftStickButton;
74  lcmt->rightStickButton = rightStickButton;
75  lcmt->leftTriggerAnalog = leftTriggerAnalog;
76  lcmt->rightTriggerAnalog = rightTriggerAnalog;
77  for (int i = 0; i < 2; i++) {
78  lcmt->leftStickAnalog[i] = leftStickAnalog[i];
79  lcmt->rightStickAnalog[i] = rightStickAnalog[i];
80  }
81  }
Vec2< float > rightStickAnalog
Vec2< float > leftStickAnalog
float rightTriggerAnalog
float leftTriggerAnalog

+ Here is the caller graph for this function:

void GamepadCommand::set ( const gamepad_lcmt *  lcmt)
inline

Definition at line 41 of file GamepadCommand.h.

41  {
42  leftBumper = lcmt->leftBumper;
43  rightBumper = lcmt->rightBumper;
44  leftTriggerButton = lcmt->leftTriggerButton;
45  rightTriggerButton = lcmt->rightTriggerButton;
46  back = lcmt->back;
47  start = lcmt->start;
48  a = lcmt->a;
49  x = lcmt->x;
50  b = lcmt->b;
51  y = lcmt->y;
52  leftStickButton = lcmt->leftStickButton;
53  rightStickButton = lcmt->rightStickButton;
54  leftTriggerAnalog = lcmt->leftTriggerAnalog;
55  rightTriggerAnalog = lcmt->rightTriggerAnalog;
56  for (int i = 0; i < 2; i++) {
57  leftStickAnalog[i] = lcmt->leftStickAnalog[i];
58  rightStickAnalog[i] = lcmt->rightStickAnalog[i];
59  }
60  }
Vec2< float > rightStickAnalog
Vec2< float > leftStickAnalog
float rightTriggerAnalog
float leftTriggerAnalog

+ Here is the caller graph for this function:

std::string GamepadCommand::toString ( )
inline

Definition at line 94 of file GamepadCommand.h.

References boolToString(), and eigenToString().

94  {
95  std::string result =
96  "Result:\nleftBumper: " + boolToString(leftBumper) + "\n" +
97  "rightBumper: " + boolToString(rightBumper) + "\n" +
98  "leftTriggerButton: " + boolToString(leftTriggerButton) + "\n" +
99  "rightTriggerButton: " + boolToString(rightTriggerButton) + "\n" +
100  "back: " + boolToString(back) + "\n" + "start: " + boolToString(start) +
101  "\n" + "a: " + boolToString(a) + "\n" + "b: " + boolToString(b) + "\n" +
102  "x: " + boolToString(x) + "\n" + "y: " + boolToString(y) + "\n" +
103  "leftStickButton: " + boolToString(leftStickButton) + "\n" +
104  "rightStickButton: " + boolToString(rightStickButton) + "\n" +
105  "leftTriggerAnalog: " + std::to_string(leftTriggerAnalog) + "\n" +
106  "rightTriggerAnalog: " + std::to_string(rightTriggerAnalog) + "\n" +
107  "leftStickAnalog: " + eigenToString(leftStickAnalog) + "\n" +
108  "rightStickAnalog: " + eigenToString(rightStickAnalog) + "\n";
109  return result;
110  }
Vec2< float > rightStickAnalog
std::string eigenToString(Eigen::MatrixBase< T > &value)
Definition: utilities.h:148
Vec2< float > leftStickAnalog
float rightTriggerAnalog
float leftTriggerAnalog
static std::string boolToString(bool b)
Definition: utilities.h:154

+ Here is the call graph for this function:

void GamepadCommand::zero ( )
inline

Definition at line 21 of file GamepadCommand.h.

21  {
22  leftBumper = false;
23  rightBumper = false;
24  leftTriggerButton = false;
25  rightTriggerButton = false;
26  back = false;
27  start = false;
28  a = false;
29  b = false;
30  x = false;
31  y = false;
32  leftStickButton = false;
33  rightStickButton = false;
34 
39  }
Vec2< float > rightStickAnalog
typename Eigen::Matrix< T, 2, 1 > Vec2
Definition: cppTypes.h:22
Vec2< float > leftStickAnalog
float rightTriggerAnalog
float leftTriggerAnalog

+ Here is the caller graph for this function:

Member Data Documentation

bool GamepadCommand::a

Definition at line 15 of file GamepadCommand.h.

bool GamepadCommand::b

Definition at line 15 of file GamepadCommand.h.

bool GamepadCommand::back

Definition at line 15 of file GamepadCommand.h.

bool GamepadCommand::leftBumper

Definition at line 15 of file GamepadCommand.h.

Vec2<float> GamepadCommand::leftStickAnalog

Definition at line 18 of file GamepadCommand.h.

bool GamepadCommand::leftStickButton

Definition at line 15 of file GamepadCommand.h.

float GamepadCommand::leftTriggerAnalog

Definition at line 19 of file GamepadCommand.h.

bool GamepadCommand::leftTriggerButton

Definition at line 15 of file GamepadCommand.h.

bool GamepadCommand::logitechButton

Definition at line 15 of file GamepadCommand.h.

bool GamepadCommand::rightBumper

Definition at line 15 of file GamepadCommand.h.

Vec2<float> GamepadCommand::rightStickAnalog

Definition at line 18 of file GamepadCommand.h.

bool GamepadCommand::rightStickButton

Definition at line 15 of file GamepadCommand.h.

float GamepadCommand::rightTriggerAnalog

Definition at line 19 of file GamepadCommand.h.

bool GamepadCommand::rightTriggerButton

Definition at line 15 of file GamepadCommand.h.

bool GamepadCommand::start

Definition at line 15 of file GamepadCommand.h.

bool GamepadCommand::x

Definition at line 15 of file GamepadCommand.h.

bool GamepadCommand::y

Definition at line 15 of file GamepadCommand.h.


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