|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#5
|
|||
|
|||
|
Re: tank drive
Another way to think of this is to convert the IFI joystick values into signed values (e.g. -127 to 127) then simple math to mix, then simple math to limit and finally simple math to convert back to 0-255 for the Victor. The IFI example code was lifted right out of the Pbasic code from last year. Pbasic didn't understand negative numbers (it was truely wretched...) hence the bizzare mixing code.
------- char limit(int val) { if (val > 127) return 127; if (val < -127) return -127; return val; } void user_routine(void) { int Left = p1_y - 127; // Convert to signed # int Right = p1_x - 127; pwm01 = limit (Left + Right) + 127; pwm02 = limit(Left - Right) + 127; etc. } |
| 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 |
| Rookie team drive tream idea | Max Lobovsky | Technical Discussion | 18 | 21-01-2004 03:36 |
| 2-wheel versus 4-wheel drive | Ben Mitchell | Technical Discussion | 23 | 07-11-2003 00:50 |
| Direct drive or Chain? | Suneet | Technical Discussion | 32 | 27-03-2003 23:00 |
| Quad- 1/2 track drive system | Ben Mitchell | Technical Discussion | 24 | 30-01-2002 11:55 |