|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
WindRiver "TankDrive"
I followed the guide as to how to set up a project and it seems much simpler than MPLab. I'd like to be able to set up the TankDrive function so that we can automatically adjust to half speed if the trigger on the joystick is pressed, among other things. I've been looking for where the "TankDrive" function is defined so I can edit it.
Is this what I should go about doing? If not, what should I do? |
|
#2
|
||||
|
||||
|
Re: WindRiver "TankDrive"
You have a couple ways on implementing it. I wouldn't suggest editing the WPILib, at least not yet as there will still be patches that may overwrite what you do. You could create your own class and inherit that. Or you could create your own Joystick class instead, inheriting the Joystick and adding the scaling to the GeyY() function (or if you assign a different axis for drive). There is also RobotDrive::TankDrive(float leftDrive, float rightDrive) that you could use when the trigger is pressed. The function is defined in RobotDrive.h
|
|
#3
|
|||
|
|||
|
Re: WindRiver "TankDrive"
I think that TankDrive(float leftDrive, float rightDrive) is used in the original program.
But would this work? within the code, making two variables, one leftHalf and another rightHalf. Then continually assigning each to leftJoystick/2 and rightJoystick/2 respectively? And then having an Code:
else if (triggerPressed==1) {
myRobot->TankDrive(leftHalf, rightHalf);
}
Last edited by KRibordy : 01-13-2009 at 05:34 PM. |
|
#4
|
||||
|
||||
|
Re: WindRiver "TankDrive"
You could even simplify that instead of having the rightHalf variable:
Code:
else if (triggerPressed)
{
myRobot->TankDrive(leftJoystick->GetY()/2,rightJoystick->GetY()/2);
}
Last edited by wt200999 : 01-13-2009 at 06:06 PM. |
|
#5
|
|||
|
|||
|
Re: WindRiver "TankDrive"
That's what I was planning on doing. Thanks.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Championship Event - Where the "Random" Match Sorting Really "Shines" | Travis Hoffman | Championship Event | 57 | 04-19-2007 08:06 AM |
| New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" | Jessica Boucher | Team Organization | 0 | 08-10-2005 10:55 AM |
| "Thunderbirds" Vs. "Team America" Which one will rule the box office? | Elgin Clock | Chit-Chat | 3 | 09-07-2004 07:53 PM |
| Conflict between "Initialize_Tracker()" and "pwm13 & pwm15"? Kevin? | gnormhurst | Programming | 3 | 02-22-2004 02:55 AM |
| how tall is the ramp when in "up" and "balanced" position??? | archiver | 2001 | 1 | 06-24-2002 12:54 AM |