|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Tank Drive
We need help with using two joysticks with a tank drive system. I do believe the default code is only one joystick. If there is code somewhere, documentation, or even your help, it would help greatly, thank you!
|
|
#2
|
|||||
|
|||||
|
Re: Tank Drive
Tank drive is very simple to program, and I believe that it is included in the default code, as an option. but here is what you would use as the code:
Code:
pwm01 = p1_y; //change 01 and 1 to appropriate joystick and pwm output pwm02 = p2_y; //change 02 and 2 to appropriate joystick and pwm output You put that in the function 'User_Driver' in place of whtever code you used, and its tank drive. |
|
#3
|
|||
|
|||
|
Re: Tank Drive
In the version of the default code that we use (not sure which one it is), the above code is included under Default PWM Mappings.
|
|
#4
|
|||
|
|||
|
Re: Tank Drive
I got the default code off of innovation first's documentation part on their website.
Where is the User_Driver function within the code? Last edited by Idaman323 : 14-02-2005 at 22:08. |
|
#5
|
|||||
|
|||||
|
Re: Tank Drive
Quote:
|
|
#6
|
|||
|
|||
|
Re: Tank Drive
AHHH I cant find it anywhere in the thing
there isnt any function it... |
|
#7
|
|||
|
|||
|
Re: Tank Drive
Er...it's in Default_Routine, not User_Driver
|
|
#8
|
|||||
|
|||||
|
Re: Tank Drive
OK... my team renamed that too, I just do not remember what we changed from the default code from last year, sorry.
It should be 'Default_Routine()' |
|
#9
|
|||||
|
|||||
|
Re: Tank Drive
It is part of a long list which maps the joystick inputs to pwm outputs. Its about ten lines long, they all look about the same (number=number
, and its about half or 3/4 the way down user_routines.c |
|
#10
|
|||
|
|||
|
Re: Tank Drive
So as long as I hav ethat included it should work?
|
|
#11
|
|||||
|
|||||
|
Re: Tank Drive
Quote:
On our bot last year, the motors were placed such that we had to reverse motor output to one side. So, Code:
pwm01 = p1_y; //put the joystick input to motor output directly pwm02 = 255-p2_y; //reverse this motor And this is, of course, assuming you are using one motor for left drive and one motor for right drive (no more no less). |
|
#12
|
|||
|
|||
|
Re: Tank Drive
Quote:
|
|
#13
|
|||
|
|||
|
Re: Tank Drive
Should I comment/delete (not sure what would be better) out the stuff i don't need, like p1_x and p2_x, or does that need to be there for the bot to run?
And Ive only had a little of coding experience but wouldn't making the one motor go backwards be pwm02 = p2_y-255; not pwm02 = 255-p2_y; or did he have it right before? And one more thing, in Deafault_Routine, there is a section titled, 1 Joystick Drive, and it combines the x, y on one joystick port.. Should i take this out? Last edited by Idaman323 : 15-02-2005 at 07:11. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Drive Straight C Code using Encoders without PID? | Chris_Elston | Programming | 17 | 15-02-2005 23:41 |
| Major problems with tank tread drive | Lord Nerdlinger | Technical Discussion | 13 | 23-02-2004 21:15 |
| Swerve/crab drive and tank turning | activemx | Technical Discussion | 9 | 23-02-2004 18:26 |
| tank drive | Stormhammer | Programming | 11 | 29-01-2004 23:08 |
| "Motors and Drive train edition" of Fresh From the Forum | Ken Leung | CD Forum Support | 6 | 29-01-2002 12:32 |