Go to Post 'We're back to square one! and while we're at it, let's redesign square one.' - Bethie42 [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 14-01-2009, 14:29
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Wondering if anyone else is having an issue with Joysticks

I'm writing some code to help the team prototype some drivetrain ideas. As a quick hack, I defined 2 joysticks and was going to use the joystick triggers to control some steering motors. I'm using the WindRiver workbench, and I used the simple template. In the OperatorControl() function I created 2 Joystick objects, and used GetTrigger(). Doing something like this:

Code:
        Joystick *left_stick, *right_stick;
        left_stick  = Joystick::GetStickfromPort(1);
        right_stick = Joystick::GetStickfromPort(2);

       while(isOperatorControll()) {
			if(left_stick->GetTrigger()) {
				left_steer.Set(.5);
			        right_steer.Set(.5);
			}
			else {
				left_steer.Set(0.0);
				right_steer.Set(0.0);
			}
			
			if(right_stick->GetTrigger()) {
				left_steer.Set(-.5);
				right_steer.Set(-.5);
			} 
			else {
			 	left_steer.Set(0.0);
			 	right_steer.Set(0.0);
			}
         }
And yes I know that both triggers down isn't being handled.

The odd thing is that the left_stick trigger works just fine (turning on/off the motors), but the right_stick trigger doesn't work at all. Commenting out the left_stick GetTrigger() block of code, and now the right trigger starts working. I've tried allocating the joystick on the stack, using new directly, etc. Bottom line is that I can get only one trigger working at a time. I'm using the KOP joysticks. I'm going to hook up a serial port and put some debug prints but was curious if anyone else is seeing the same thing. I do know that the the GetAxis functions are working because, using the same declarations for the joysticks, I was able to get the TankDrive() function to work properly.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is anyone else having this problem hpman247 Programming 10 27-11-2008 02:57
Anyone Else Having Problems with Q&A on FIRST? Windwarrior General Forum 6 25-01-2006 10:54
Anyone else having trouble keeping up with work? D. Gregory General Forum 36 28-03-2004 16:55
Anyone else having trouble with Yahoo mail services? Elgin Clock IT / Communications 12 20-03-2004 16:59
Anyone else having trouble with the pneumatics manual? Stu Bloom Pneumatics 15 13-01-2004 01:13


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

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