|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: 1 Joystick Control
Quote:
Code:
pwm13 = pwm14 = 255 - Limit_Mix(2000 + p1_y + p1_x - 127); |
|
#2
|
|||
|
|||
|
Re: 1 Joystick Control
See also this thread.
Hmmm... I never thought about putting the subtraction outside of the Limit_Mix() function. I had it inside: Code:
//Put modified joystick numbers into the four motors //The (256- ) part reverses one side's motors so no reverse wiring is needed! pwm13 = pwm14 = Limit_Mix(2000 + p1_yNew + p1_xNew - 127); pwm15 = pwm16 = Limit_Mix(2000 + (256 - p1_yNew) - (256 - p1_xNew) + 127); Reversing motors isn't the only problem us programmers have to go thru. We loaded up code on our brand-spanking new robot that we've been testing on last year's robot for the past -- well, the past year, come to think of it. New robot goes all which-way crazy directions. (Didn't help that one side's motors weren't working.) Shop says "programming error!" (Yeah, right!) Check wiring from last year to this year. Red-to-red, black-to-black. Everything checks out. Turns out (40 minutes later!) new robot has one less set of gears, so motor output to wheels is now opposite from last year. Shop says "oh yeah." Sigh.... But this year we had our autonomous working (on last year's robot) before they even built the robot! Woo-hoo! ![]() |
|
#3
|
|||||
|
|||||
|
Re: 1 Joystick Control
Quote:
You explained that by using a pwm value of 255 as an example. However, valid pwm signals are in the range 0-254, with 127 being neutral. Quote:
Of course, 254 is only the right value to subtract from in theory. With the Victor's observed "neutral bias", though, it might actually work better to choose 132 as the mirror point instead of 127, and subtract from 264 instead (making sure to limit the result to 254 after the subtraction). |
|
#4
|
|||
|
|||
|
Re: 1 Joystick Control
ok..... Forward goes foreward and backwards goes backwards... But left goes right and right goes left
|
|
#5
|
|||||
|
|||||
|
Re: 1 Joystick Control
Quote:
Maybe post Your code? Last edited by kevin.li.rit : 31-01-2008 at 17:58. |
|
#6
|
|||
|
|||
|
Re: 1 Joystick Control
Quote:
In my defense (meager as can be) I can only say I did put it inside the Limit_Mix() function, so that the function did keep the numbers in range. I'll have to check my spreadsheet numbers again, and try the 132 center point. |
|
#7
|
|||
|
|||
|
Re: 1 Joystick Control
This is easier.
Code:
left_motor = speed - turn_rate; right_motor = speed + turn_rate; |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Joystick control rotated? | silliewillie | Control System | 6 | 12-02-2005 21:23 |
| We need help with joystick control | Team ICE #1611 | Control System | 4 | 24-01-2005 15:57 |
| Single joystick control problem | Mr. Van | Programming | 7 | 23-11-2004 09:10 |
| One Joystick Control | KWalsh | Programming | 4 | 24-02-2004 17:53 |
| Control System, Joystick mod? | Jordan A. | Technical Discussion | 16 | 13-02-2002 02:29 |