|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Drive Programming
We're trying to implement three things. I think I've got a handle on one of them, and the two others I'm going to ask for input on.
All of this code is considering tank drive on one joystick, with PBASIC 2.5. 1) We have the wheel controlling a speed multiplier that gets added in to the calculation for the motor outputs. 2) We want to implement a "Regular drive" mode where the robot does not turn on a dime. This would involve one of the motors moving more slowly than the other. 3) We want to implement a gradual slowdown in the motor so that the robot does not come to a dead halt whenever the joystick is moved to the neutral position. This is our current code, with #1 above enabled. leftdrive=((p1_wheel/255)*(2000 + p1_y - p1_x + 127) Min 2000 Max 2254)-2000 rightdrive=((p1_wheel)/255)*(2000 + p1_y + p1_x - 127) Min 2000 Max 2254)-2000 For #2 I'm thinking something like this: Wait a minute. I just had a stroke of genius... I think. Wouldn't it just be if p1_x < 127 then leftdrive = p1_x rightdrive = p1_y else leftdrive = p1_y rightdrive = p1_x endif as for #3, I'm drawing a blank. I cannot think of an easy way to code this. It would involve getting the difference between the drive (left? right? both?) and the joystick position. Maybe just a lot of IF statements. Any input on any of the above three would be much appreciated. Thanks again! |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 1 stick drive to 2 stick drive | wayne 05 | Programming | 18 | 01-04-2004 16:41 |
| how does crab drive work? | Soukup | Technical Discussion | 13 | 25-04-2003 11:31 |
| Direct drive or Chain? | Suneet | Technical Discussion | 32 | 27-03-2003 23:00 |
| programming | JasonWestHigh | Technical Discussion | 1 | 13-01-2003 20:54 |
| "Motors and Drive train edition" of Fresh From the Forum | Ken Leung | CD Forum Support | 6 | 29-01-2002 12:32 |