Go to Post It's official: we've run out of things to talk about. - Jessica Boucher [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 11-02-2012, 15:34
ss9090 ss9090 is offline
Registered User
AKA: Stewart Smith
FRC #4367 (Streetbots)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: ON, Canada
Posts: 6
ss9090 is an unknown quantity at this point
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 ) {}
__________________
FRC 4736 Streetbots
2012 Streetsville Secondary's pioneering FRC team

Thanks to our mentor team, 1241 Theory6, for all of their help! I wish everybody there the best in their futures.

-Lead Programmer (Wind River C++)
-Lead Electrical
-Lead Controls
-Part-time Build

2012 - 17th seed (GTR West)

Last edited by ss9090 : 12-02-2012 at 14:43. Reason: More info
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:34.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi