View Single Post
  #7   Spotlight this post!  
Unread 23-06-2002, 22:23
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Here's a theory....

Posted by Mike Gray.

Engineer on team HOT from Huron Valley Schools sponsored by GM Milford Proving Ground.

Posted on 3/16/2000 7:27 AM MST


In Reply to: Re: please explain more... posted by Nate Smith on 3/15/2000 6:09 PM MST:



Nate,

I think I understand now. Your code looks fine, it just doesn't have an offset, but you don't necessarily need it. I think that what is happening, is that we are assuming that 'forward' ranges from 127 to 255 counts.

If we assume the reverse (inverse?), that reverse ranges from 127 to zero, the result is pretty much what you described. FORWARD is clamped at 128 counts, it never gets lower so the member never moves.

For reverse: Assume that the filtered joystick value ranges from 127 to 255. You multiply by 3 and divide by 2, then clamp at 126, so the member never moves...UNTIL the joystick exceeds 170 counts. Since p1_yfilt is a single byte, it rolls over beyond 255 counts and its value then becomes 0. Full speed, turbo, wrong direction.

Floating point math: 171*3/2=256.5

Integer math: 171*3/2=0

Ain't integer math a pain? Could this be what's happening? The solution is a rewrite, or invert the variable before operating on it. Its the asymmetry that's causing some confusion. If you were to scale symmetrically, you likely would not have a problem until you clamp the value.

I see that you filter p1_y. Are you using my code from the Innovation First white paper page? Do you find that it improves your motion control, or is it detrimental?

: As for losing part of our range, when I attempted to scale down the drive train output to 50% of the

joystick value in order to create our 'turbo boost' function, using the code shown below:
: (for forward)
: p1_yfilt = (p1_yfilt)/2 min 128 max 254
: (for reverse)
: p1_yfilt = (p1_yfilt*3)/2 min 0 max 126

: in one direction, i would lose all output unless the 'turbo' function was on, and in the other, it would always act as if the turbo was turned on.

: Looking at mike's code, that might work...will have to try it and see what happens...

: Nate


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.