|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Button programming help
My team is trying to program our joysticks to where the trigger button on a Logitech Attack 3 controller is used for throttle on our bot (like a throttle button on a video game) So if we hit the joystick and are not holding the trigger the bot won't move. I was wondering if anybody has the code or can tell us how to write the code to do this, help would be apperciated. we are using tank drive. We are using Java to program our robot.
Last edited by interplanetary : 09-02-2010 at 12:26. |
|
#2
|
||||
|
||||
|
Re: Button programming help
You can use the getTrigger() method on a Joystick to determine whether or not the button is being pressed. If it is, call the tankDrive() method, and if it isn't, tell the robot to stop driving. This could be done by calling drive() with 0.0 as the speed and curve values.
Example: Code:
// Assumptions: these are already set up and configured.
RobotDrive drive;
Joystick leftStick, rightStick;
// In teleop control:
if (rightStick.getTrigger())
drive.tankDrive(leftStick, rightStick); // Drive when trigger is pressed
else
drive.drive(0.0, 0.0); // Stop driving if trigger is released
|
|
#3
|
|||
|
|||
|
Re: Button programming help
Yup, that's about all you'd need. Just make sure you aren't destroying the gearboxes by like going full speed and then hitting the trigger to stop movement instantaneously.
|
|
#4
|
|||
|
|||
|
Re: Button programming help
so would it be similar to do that with a pendulum style kicker. we are using springs and pistons to power to kicker
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Button Programming Error? | pyr0b0y | NI LabVIEW | 5 | 06-04-2009 17:18 |
| Joystick Button Programming in Labview Help Needed | domoarigato | NI LabVIEW | 11 | 28-01-2009 10:55 |
| Programming a joystick button... | programmr | Programming | 2 | 05-01-2009 16:13 |
| button programming | joesmomh00haha | Programming | 12 | 10-02-2007 10:36 |
| Joystick Button programming | Bharat Nain | Programming | 5 | 18-02-2005 11:48 |