|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using the Logitech F510 Controller Help
Hello everyone,
I've been trying to get the Logitech F510 to work with the Command Based Robot Template structure. I've managed to get the axises working with 'GetRawAxis()', however I am having trouble getting the buttons to respond. I am not sure if I properly understand where and what to put in order to make them function. Can anybody help me with the structure of button OI in the code and - if you can - which button coresponds to what number (not really necessary, although helpful)? P.S. I am using WindRiver C++ EDIT: We checked the controller to see if it functions properly, it does. We also used another teams controller to make sure it was the code, and it is. It is very urgent that this be solved as quickly as possible. Any help would be incredible, thank you. Some additional info; I have the following in OI.cpp: Code:
#include "OI.h"
#include "Robotmap.h"
#include "Commands/C_PullyFwd.h"
#include "Commands/C_PullyRev.h"
#include "Subsystems/Chassis.h"
OI::OI() {
Chassis *chassis;
gamepad = new Joystick(GAMEPAD_PORT);
bool gamepad_button_x = gamepad->GetRawButton(GAMEPAD_BUTTON_X);
bool gamepad_button_a = gamepad->GetRawButton(GAMEPAD_BUTTON_A);
bool gamepad_button_b = gamepad->GetRawButton(GAMEPAD_BUTTON_B);
bool gamepad_button_y = gamepad->GetRawButton(GAMEPAD_BUTTON_Y);
bool gamepad_button_L1 = gamepad->GetRawButton(GAMEPAD_BUTTON_L1);
bool gamepad_button_L2 = gamepad->GetRawButton(GAMEPAD_BUTTON_L2);
bool gamepad_button_R1 = gamepad->GetRawButton(GAMEPAD_BUTTON_R1);
//bool gamepad_button_R2 = gamepad->GetRawButton(GAMEPAD_BUTTON_R2);
if (gamepad_button_x == true) {
//
}
if (gamepad_button_a == true) {
//Drive straight
chassis->customTankDrive(1.0, 1.0);
}
if (gamepad_button_b == true) {
//
}
if (gamepad_button_y == true) {
//shooting
}
if (gamepad_button_L1 == true) {
//bridge mech up
}
if (gamepad_button_L2 == true) {
//pulley brings balls out
new PullyRev(1000);
}
if (gamepad_button_R1 == true) {
//bridge mech down
}
if (gamepad_button_R2 == true) {
//Pully brings in balls
new PullyFwd(1000);
}
}
Joystick * OI::getJoystick() { //activate the Joystick class
return gamepad;
}
-I know the functions being called work -I've tried making the if statement conditions without the '== true' -Tried using if, else if, else if, ... else structure -Tried replacing the if statements with Code:
if ((gamepad->GetRawButton(GAMEPAD_BUTTON_R2) ) == true ) {}
Last edited by ss9090 : 12-02-2012 at 14:43. Reason: More info |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|