autonomous mode

hi im the programmer for team 867, i was wondering is there any default code for autonomous. and i have another question, how can we activate autonomous mode for testing.

This thread may help you out

ok kool i got it. this has nothing to do with this but i want to add a dead zone on the joystick. so like the robot wont move the split second you touch the joystick, how can i do this.

I want to add a dead zone on the joystick. so like the robot wont move the split second you touch the joystick

There is already a dead zone built into the Victor speed controllers. But whether you realize that or not, the joysticks must not be giving the response you want.

You could try something simple like this, to basically ignore the values near the centre of travel:

if ((joy >= 120) && (joy <= 140))  joy = 127;

Or a more sophisticated “exponential” method:

speed = joy - 127;
newspeed = ((speed * speed) / 127) * sign(speed);

I have attached a Labview 8 application that demonstrates various joystick response curves.

Good luck,

Mike

JoystickResponseCurves.vi (28.9 KB)


JoystickResponseCurves.vi (28.9 KB)

i have 2 questions

  1. where do i splice in the code you gave me i was looking through the code i cant see where to put it.
  2. do i connect the user interface to my computer for running the labview program.

This is a good idea, but I would propose the following enhancement to make it a little more flexible

#define JOYSTICK_DEADZONE   5
...
if((joy >= (127 - JOYSTICK_DEADZONE)) && (joy <= (127 + JOYSTICK_DEADZONE)))
{
  joy = 127;
}

Then, to extend that even further, you could create a macro so that you could apply deadzones whenever you needed to.

#define JOYSTICK_DEADZONE   5

#define DEADZONE(input, dz) (if(((input) >= (127 - (dz))) && ((input) <= (127 + (dz)))) (input) = 127;)

...

DEADZONE(joy1, JOYSTICK_DEADZONE)
DEADZONE(joy2, JOYSTICK_DEADZONE)

Notice that the lines that “call” the macto don’t have semicolons. This is because there is a terminating semicolon at the end of the macro itself.

Well, if you think about this logically, your outputs (pwm/relay/analog/digital outs) are based on your inputs, so it makes sense that deadzone code would be placed somewhere after the inputs are read, but before the outputs are written. Depending on how your inputs map to outputs, you may have intermediate calculations. It would then make sense to place your deadzone code before those calculations. When in doubt, take a deep breath and think through the problem. Programming is about thinking logically. Go step by step and you’ll figure it out.

I don’t know anything about the way that labview works. Hopefully someone else can answer that question.

i have 2 questions

  1. where do i splice in the code you gave me i was looking through the code i cant see where to put it.
  2. do i connect the user interface to my computer for running the labview program.

If you are using MPLAB, you will see (in the default code) where the joystick values are read, then the resulting values are assigned to the Victor pwm output variables. So you put the joystick code JUST AFTER the joystick value is read. You will have to make your own decisions for variable names, etc. And the code I provided is only for one joystick axis - you will have two joystick axes, so will need twice the amount of code.

Labview is a graphical development environment that runs on your PC. A copy of Student Labview was included in the KOP this year. I am attaching a screen shot of the Labview program running the Joystick application - you will get the idea that it is only useful to ILLUSTRATE how joystick values might be processed. The simulated joystick input is the horizontal slider at upper left. The three scales below show linear (direct), exponential, and logarithmic conversions.