Victor 884 calibration

How do you calibrate a victor 884 so when using an xbox 360 controller the motors do not turn when not moving the joysticks.

That should be changed in your program. Output the values you receive from your joysticks to screen and when your joysticks are centered set that value to neutral.

Located Here.


All teams should be calibrating speed controllers to their control system. It is the only way to insure that you have full range in both directions and insuring that the joystick will cause a 127 when released (center position). Although the Victors come calibrated to known joystick values they have not been matched to your joysticks. Do your drivers a favor and calibrate.

In this case, the first thing I would do is calibrate the Chicklet. Follow the directions in the manual here. If you calibrate your robot code or Victors to match whatever the joystick is outputting now you could create a dangerous situation. Consider this: if your Chicklet is outputting a value of 110 when the joystick is centered, and you calibrate to this, then if the Chicklet gets unplugged (setting the joystick value to 127), your robot will drive forward. As a rule of thumb, you always want to start by calibrating your joystick such that it outputs 127 when it is centered.

…or calibrating their control system to their joysticks. Doing it in software is not as convenient as using the built-in feature of the Victor, but it helps keep autonomous control values consistent.

Yes, this is quite important for autonomous. I would not recommend doing what Al said (calibrating the Victors to the joysticks). This is what we do:

  • First, calibrate the joysticks such that the OI reads 127 when the joystick is centered. The IFI Dashboard makes this really easy.
  • Next, determine the minimum and maximum values that each joystick axis will output - they’ll usually all be different (again, IFI Dashboard comes in handy).
  • Write scaling code that scales each joystick axis to the full 0-254 range.
  • Use this scaled value everywhere in code for driving. This allows your autonomous routines to send in a 0-254 value and look just like the joysticks.
  • Finally, we have special software that we use to calibrate the Victors. It does not output raw joystick values, but rather ensures that the PWM outputs are driven through their full range from 0 to 254.

After all this is done, from that point on the only thing that needs to be done is to adjust the joystick “min” and “max” values if a joystick is replaced, or to recalibrate a Victor only if it is replaced. Like Alan said, doing this ensures that your autonomous behaves correctly.

On my Xbox controller, My return-to-center values are 110 to 140, depending on from which way its returning to the center. I just put an input deadband in that covers these values.


Here is some code that can be used to scale the joysticks:

/* Typedefs so that compiler-independent types can be used.  These should be
 * defined in a single header file somewhere and included in all of your code.
 * While not strictly necessary, it is a good habit to get into. */
typedef char  s8;
typedef short s16;
typedef long  s32;

typedef unsigned char  u8;
typedef unsigned short u16;
typedef unsigned long  u32;

/* Always calibrate your joysticks so that they output 127 when in their
 * resting position.  Use the IFI Dashboard if necessary to help with this. */
#define JOYSTICK_MID 127

/* This function takes in a joystick value from the OI as well as a known
 * minimum and maximum value for this stick and scales it such that the value
 * is in the full 0-254 range.  The return value from the function is the new,
 * scaled value. */
u8 scale_joystick(u8 joystick_orig, u8 joystick_min, u8 joystick_max)
    s16 scaled_val = JOYSTICK_MID;

    /* First, make sure the original joystick value falls in between
     * joystick_min and joystick_max, in case it's slightly higher or lower
     * than we expected. */
    if(joystick_orig > joystick_max)
        joystick_orig = joystick_max;
    else if(joystick_orig < joystick_min)
        joystick_orig = joystick_min;

    if(joystick_orig > JOYSTICK_MID)
        /* Formula: ((positive joystick deflection / positive range) * 127) +
         * 127.  Multiply by 127 before dividing by the range in order to
         * avoid floating-point operations. */
        scaled_val = ((s16)JOYSTICK_MID) +
            ((((s16)joystick_orig - ((s16)JOYSTICK_MID)) *
              ((s16)JOYSTICK_MID)) /
            ((s16)joystick_max - ((s16)JOYSTICK_MID)));
    else if(joystick_orig < JOYSTICK_MID)
        /* Formula: 127 - ((negative joystick deflection / negative range) *
         * 127).  Multiply by 127 before dividing by the range in order to
         * avoid floating-point operations. */
        scaled_val = ((s16)JOYSTICK_MID) -
            (((((s16)JOYSTICK_MID) - (s16)joystick_orig) *
              ((s16)JOYSTICK_MID)) /
            (((s16)JOYSTICK_MID) - (s16)joystick_min));
        /* Do nothing - the incoming joystick value was 127, and the scaled
         * value is already defaulted to this. */

    return scaled_val;

To use this code, you should determine the minimum and maximum values for each axis of each joystick and store them in your code as #defines. Then, call this function like this:

    /* #defines as an example */
    #define PORT1_X_MIN 24
    #define PORT1_X_MAX 249
    #define PORT1_Y_MIN 22
    #define PORT1_Y_MAX 250


    p1_x = scale_joystick(p1_x, PORT1_X_MIN, PORT1_X_MAX);
    p1_y = scale_joystick(p1_y, PORT1_Y_MIN, PORT1_Y_MAX);

You’ll want to put that code shortly after the Getdata() call in Process_Data_From_Master_uP(), before p1_x, p1_y, etc. get used by anything else. Don’t forget to change your #defines if you change your joysticks.

This is why we recommend the Logitech Dual action instead of the X-box controller. The X- box is not as consistent when returning to center.

I would actually recommend that new teams with no experience in calibrating the victors avoid doing so at all costs unless you can get a qualified person to help. We tried it in 2005, when we had all rookie team-members, and it caused us nothing but harm. The 'bot would go crazy during autonomous, and we could never get the controls to respond right. Looking back now, we can see that this was all do to the fact that we had zero experience in electrical/programming, and made mistakes… but they were easy ones to make. Try to stick to the trim-tabs on the joystick. In cases like with the Xbox controller, your dead band is an awesome and simple solution to the problem.

This is why I love the USB Chicklet. With the Logitech 3D Pro, full forward is EXACTLY 254, full reverse EXACTLY 0, and neutral EXACTLY 127. You don’t need to worry about scaling code, or about calibrating to joysticks and not to software.

I could not agree with this more. Keep neutral 127. The Chicklets are production calibrated with this in mind. This means that when the device(gamepad/joystick) is unplugged from the Chicklet, the Chicklet will set its outputs to 127. This is only valid if your device returns to center. The purpose of the user calibration is to correct for inaccuracies in the device(gamepad/joystick). User calibration should be performed with any new device and that device should be matched and used with the chicklet that it was calibrated with.

Exactly. It’s been years since Team 95’s robots have ever had (except for testing purposes) a joystick axis hooked directly to a PWM in code.