|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#4
|
|||
|
|||
|
Re: 2008 Omni Drive Code Help
First uses this:
pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127); pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127); They Add 2000 to prevent a negative value and when they call LIMIT_MIX () It evaluates the result and subtract out the 2000. I think your code could be changed to motor_fl_1 = Limit_Mix(2000 + drive_ly + drive_lx - 127); motor_fr_1 = Limit_Mix(2000 + 127 - drive_ly + drive_lx); motor_br_1 = Limit_Mix(2000 + 382 - drive_ly - drive_lx); motor_bl_1 = Limit_Mix(2000+ 127 + drive_ly - drive_lx); if ( (motor_fl_1 < 137) && ( motor_fl_1 > 117 ) ) pwm_drive_fl = 127; else pwm_drive_fl = motor_fl_1; if ( (motor_fr_1 < 137) && ( motor_fr_1 > 117 ) ) pwm_drive_fr = 127; else pwm_drive_fr = motor_fr_1; if ( (motor_br_1 < 137) && ( motor_br_1 > 117 ) ) pwm_drive_br = 127; else pwm_drive_br = motor_br_1; if ( (motor_bl_1 < 137) && ( motor_bl_1 > 117 ) ) pwm_drive_bl = 127; else pwm_drive_bl = motor_bl_1; This should prevent any over runs even if your joystick is doing something weird. Are you using a chicket? Although I must admit I don't understand the "382 - drive_ly - drive_lx" but I'll assume you know the formula to be correct and that the problem you're having is from a violation in a positive integer math problem. Hope that helps Steve |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help in Kevin's 2008 default code | robotrobot2 | Programming | 5 | 20-01-2008 14:36 |
| Lego Omni Drive | Synergy1848 | Robot Showcase | 19 | 03-01-2007 11:51 |
| pic: vex omni drive | 1902_Battery_SGT | FIRST Tech Challenge | 6 | 28-05-2006 17:55 |
| omni drive vs tank | |20807 61|2|_ | Technical Discussion | 49 | 17-01-2006 13:54 |
| Omni-drive autonomous questions | Andrew Schuetze | Programming | 6 | 17-01-2006 12:15 |