|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to Auto Calibrate
Hi im Joe from team 2170
i am having trouble auto calibrating our robot can someone please tell me how i would? |
|
#2
|
|||
|
|||
|
Re: How to Auto Calibrate
Um...
What are you calibrating? If you mean joysticks... Plug your OI into a laptop via serial connection (Use the Dashboard port on the OI). Then, open IFI Dasboard. Make sure your jumper is set to OI DATA (if it's on RC DATA, move it to OI DATA) Play with the trims until p1_x, p1_y, p2_x, p2_y... etc are all set (to 127) Last edited by Jimmy Cao : 08-03-2008 at 11:11. |
|
#3
|
||||
|
||||
|
Re: How to Auto Calibrate
If you are talking about joysticks we usually just put the robot up on bricks or the carts so we can see how much we have to calibrate them.
|
|
#4
|
|||
|
|||
|
Re: How to Auto Calibrate
yea i mean joysitcks...but how can i program the robot so when i hit a button it auto calibrates?
|
|
#5
|
|||||
|
|||||
|
Re: How to Auto Calibrate
I don't know what you mean. Can you give more detail about what button you are talking about, and what you want to happen when the button is pressed? Please explain it without using the words "auto calibrate".
|
|
#6
|
|||
|
|||
|
Re: How to Auto Calibrate
Well, if you add code that sets the current value as the neutral (127) value, then you can "autocalibrate", or at least kinda autocalibrate.
|
|
#7
|
||||
|
||||
|
Re: How to Auto Calibrate
You can write a relatively simple algorithm that keeps watching for higher highs and lower lows and calculates the midpoint (average) value and watches how much displacement there is above and below this midpoint to scale whatever your joystick input is.
However, if you don't trim the joysticks, you could have a lot of meaningless joystick travel, such as the last 15 degrees of travel all being '255'. -q |
|
#8
|
||||
|
||||
|
Re: How to Auto Calibrate
I'm not sure if this is what your looking for but you could set it so that when you press the triggers it sets the joysticks to 127. Then instead of messing with the calibration wheels, you would press the triggers and it would set it to 127, 127. I'm not sure exactly how you would go about doing this but it would probably start with an if statement similiar to this
if(trig_sw==1) I'm sorry if this isn't that much help. It's my first year in FIRST and I began programming over the summer |
|
#9
|
|||
|
|||
|
Re: How to Auto Calibrate
I think i understand what you talking about:
You would need to set a code that would record ans store values given by the joysticks in a sequence: 1. you would have to get the manual trim as close as possible then make it so their is no way the manual trim can move. 2. your code would need something to trigger the code such as a switch and then have it run so the you have it scan for ranges that could be the max, min, neutral . -max would be the highest value recorded -min would be the lowest value recorded -neutral would probably be what the code would read first when no one is touching the stick. ~now i don't know alot of code but i know logically it would work but since my team refuses to do it i hope someone out there will finish this. |
|
#10
|
||||
|
||||
|
Re: How to Auto Calibrate
After thinking about this I think I have your code.
if(trig_sw==1) x1==127 y1==127 x2==127 y2==127 This should be it. Although you still want to check the variables x1,x2,y1,y2 are supposed to be the joystick direction. |
|
#11
|
|||
|
|||
|
Re: How to Auto Calibrate
Quote:
All this would do is set the joystick values to 127 for execution of the code loop. To have it really calibrate you need to store the offset from 127 into a variable and then have the code add/subtract it each time. |
|
#12
|
|||||
|
|||||
|
Re: How to Auto Calibrate
Quote:
You could do this pretty simply with code along these lines: Code:
//Definitions
signed char p1_x_off = 0;
signed char p1_y_off = 0;
//Code somewheres at the top of your default routine before you use p1_x, etc. for anything useful:
if (p1_top == 1)
{
p1_x_off = 127 - p1_x;
p1_y_off = 127 - p1_y;
}
p1_x = Limit_Mix(2000 + p1_x + p1_x_off);
p1_y = Limit_Mix(2000 + p1_y + p1_y_off);
Code:
Joystick center starts at: p1_x = 147 You "calibrate" so: p1_off = -20 Here, then are some typical joystick values and how they'd come out in your code: p1_x 147 127 0 20 254 p1_x + off 127 107 -20 0 234 Limit_Mix'd 127 107 0 0 234 |
|
#13
|
|||||
|
|||||
|
Re: How to Auto Calibrate
I wrote a simple calibration helper using easyC pro using the display on the OI because hooking up the laptop to dashboard between matches gets old fast.
The code is something like: if joy1 >= 230 { SetUserDisplay = joy2; } (and visa versa). Basically, you disable the robot and push the joystick you aren't calibrating all the way up. The user diplay on the OI then displays the opposite joystick's value (0-255). Adjust the trim until it gets as close as possible to 127, rinse, repeat with the other joystick, and you're good to go. |
|
#14
|
|||
|
|||
|
Re: How to Auto Calibrate
thx for all the help and input...i will try this asap at our Hartford Regional thursday-saturday...
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to end an auto mode after gyro gets out of deadband | kiettyyyy | Programming | 17 | 20-04-2006 07:59 |
| How does your auto-aim work? | JamesBrown | Programming | 36 | 28-03-2006 23:25 |
| auto mode | nuggetsyl | General Forum | 12 | 13-02-2006 19:45 |
| auto | Tachion | FIRST Tech Challenge | 3 | 17-11-2005 11:25 |
| Auto run | sirbleedsalot | Chit-Chat | 3 | 06-02-2005 00:17 |