pbasic question

Posted by Stephen at 1/29/2001 9:07 PM EST

Other on team #122, NASA Knights, from Grafton High School (Robotics team is at NHGS) and NASA.

I was programming the logic to automatically calibrate the joysticks each time the robot was turned on, and I ran into a problem. I should start off saying that the code works fine as long as the wheels aren’t terribly off center. The problem comes when the wheels near a limit (either 255 or 0). When I thought of the logic, I was counting on the fact that if a joystick command goes further than 255 than it would wrap around to 0; but I was wrong. Apparently it just maxes out at 255. So … if the wheel is all the way in one direction, the robot will not be able to move in that direction. I was thinking about just changing p1_x and p1_y to word variables (as opposed to bytes [8 bits]), but that will not work- so I have come here to ask for help. If you (the chief-delphi community) cannot find a solution than it’s still all right, because the code works fine as long as the wheels are somewhat close to center (leeway of about 20 either way [40 total])

Posted by Joe Johnson at 1/29/2001 10:06 PM EST

Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems.

In Reply to: pbasic question
Posted by Stephen on 1/29/2001 9:07 PM EST:

I recommend against recalibrating joysticks (and the
Victors by the way – for similar reasons).

Basically the problem is that the system works just
fine until it doesn’t work anymore.

As you move the center trims more and more off of
center, you gradually lose resolution of the joysticks
until the resolution so bad nothing works right.

Here is what I recommend instead: Use the lights on
the OI (or your handy dandy Dashboard) to provide
feedback on the trim position of the joystick.

In this way, you can get the joysticks set right
without using valuable CPU time to scale them.

There is an even strong case against re-calibrating the
Victors, but that is a problem for antoher day.

Joe J.

Posted by Ken Wilson at 1/30/2001 2:35 AM EST

Engineer on team #248, FEMEX, from Philadelphia Girls High and PECO Energy Company.

In Reply to: I vote against calibrating joysticks…
Posted by Joe Johnson on 1/29/2001 10:06 PM EST:

: Joe

FEMEX calibrated its Victors last year. Could you explain the possible pitfalls? THANX

kenny …out of control in Philadelphia

Posted by Ken Leung at 1/30/2001 5:09 AM EST

Student on team #192, Gunn Robotics Team, from Henry M. Gunn Senior High School.

In Reply to: I vote against calibrating joysticks…
Posted by Joe Johnson on 1/29/2001 10:06 PM EST:

: Here is what I recommend instead: Use the lights on
: the OI (or your handy dandy Dashboard) to provide
: feedback on the trim position of the joystick.

A little advice about using the lights as an indicator of joystick calibration. You might want to include a dead zone around the center of range of the axis. Being a driver myself, I can tell you that it is really hard to calibrate the joystick to exact zero. You might want to make a “dead zone” around the center, so even if the joystick is slightly off, it will still count as the center. A few advantage for doing this: 1. easier and quicker for calibration, 2. easier for (shakey hand) drivers to hold joystick at center position when they doesn’t want to move the robot, 3. Driver can control the robot much more accuratly if they are used to fast maneuvers on the joystick.

Probably Everyone are doing this… but no harm posting this out.

Posted by Josh Vetter at 1/30/2001 10:40 PM EST

Student on team #548, Robostangs, from Northville High School and BOSCH.

In Reply to: dead zone
Posted by Ken Leung on 1/30/2001 5:09 AM EST:

How do you create the dead zone? We are a rookie team, and need all the programming help we can get.
Thanks
Josh Vetter

Posted by Joe Ross at 1/31/2001 2:59 AM EST

Engineer on team #330, Beach Bot, from Hope Chapel Academy and NASA/JPL , J&F Machine, and Raytheon.

In Reply to: Re: dead zone
Posted by Josh Vetter on 1/30/2001 10:40 PM EST:

: How do you create the dead zone? We are a rookie team, and need all the programming help we can get.

There are many different ways to program a dead zone. The simplest (but not always the best) is to use an if statement.

in pseudo-code:

if joystick is greater than 117 AND joystick is less than 137 then joystick = 127

127 is the neutral position, so if the joystick value is ever +/- 10 from the neutral position, then the robot won’t move. out team has found that a value of +/- between 5 and 10 works the best.

There are a few problems with this method. If you can find them, then you probably don’t need help developing a dead stick routine :wink:

You should also read the whitepaper on filtering the joysticks availible from innovationfirst.com. It contains a “dead stick” routine among other things