View Full Version : Victor 884 calibration
Torboticsmember
05-02-2007, 19:12
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.
Pavan Dave
06-02-2007, 00:02
The Victor is pre-calibrated to values compatible with an
IFI Control System and re-calibration is not needed.
You can re-calibrate to achieve ‘full forward/reverse’
from your joystick movement if necessary.
NOTE: While in calibration mode, the Victor will
record the max PWM value detected as ‘full forward’,
the min PWM value as ‘full reverse’, and ‘neutral’ will
be the PWM value recorded at the release of the Cal
button. The following steps will guide.
User Calibration:
1. Power ON the speed controller.
2. Press and hold the Cal button. After a moment, the
LED indicator on the Victor will begin alternating
between RED and GREEN to indicate a cal mode.
3. While continuing to hold the Cal button, move the
joystick to the maximum and minimum positions.
This can be done in any order and as many times as
desired.
4. While continuing to hold the Cal button, return the
joystick to center (neutral position).
5. Release the Cal button.
6. A flashing GREEN indicator confirms a successful
calibration.
7. A flashing RED indicator denotes an unsuccessful
calibration.
An unsuccessful calibration occurs when either:
a) Insufficient joystick travel was detected in forward
and/or reverse.
b) The trim tab is too far from center.
Resetting Calibration to Factory Pre-calibration:
1. Power OFF the speed controller.
2. Press and hold the Cal button.
3. While continuing to hold the Cal button, Power ON
the speed controller.
4. A flashing GREEN indicator denotes calibration is
reset. Release the Cal button.
Located Here (http://ifirobotics.com/docs/ifi-v884-users-manual-9-25-06.pdf).
Pavan.
Al Skierkiewicz
06-02-2007, 08:03
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.
Dave Flowerday
06-02-2007, 08:10
In this case, the first thing I would do is calibrate the Chicklet. Follow the directions in the manual here (http://www.ifirobotics.com/docs/usbchicklet-usermanual-rev1-2.pdf). 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.
Alan Anderson
06-02-2007, 08:12
All teams should be calibrating speed controllers to their control system...
...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.
Dave Flowerday
06-02-2007, 08:32
...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.
whytheheckme
06-02-2007, 09:07
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.
Jacob
Dave Flowerday
06-02-2007, 10:50
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));
}
else
{
/* 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.
Mike Copioli
06-02-2007, 22:35
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.
Jacob
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.
Cody Carey
06-02-2007, 22:54
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.
Jared Russell
07-02-2007, 00:17
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.
Mike Copioli
07-02-2007, 09:44
In this case, the first thing I would do is calibrate the Chicklet. Follow the directions in the manual here (http://www.ifirobotics.com/docs/usbchicklet-usermanual-rev1-2.pdf). 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.
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.
...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.
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.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.