Go to Post Holy Underwriters Laboratories Industrial Safety Awards Batman! - AndyB [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2016, 19:05
GuyM142's Avatar
GuyM142 GuyM142 is offline
Registered User
AKA: Guy
FRC #3339 (BumbleBee)
Team Role: Mentor
 
Join Date: Jul 2013
Rookie Year: 2012
Location: Israel
Posts: 158
GuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really nice
Exclamation Problems with Automatic Target Alignment

Hey everyone,
my team has been working on vision processing code in order to align the robot to the target automatically during auto and teleop.
From the vision code we get a number ranging from -1 to 1 where 0 is the center of the image, using this number we have tried to apply some sort of PID with an additional force to overcome static friction, but we couldn't make it work.
The force sent to the motor was either to weak which didn't move the robot or too strong making it oscillate uncontrollably around the center.

So I have 2 questions:
1. Is there a good method to overcome this problem according to your past experience?
2. After calibrating the code to work at home, what is the best way to make sure it will work on the actual filed? (With a brand new carpet, etc.)

Thank you!
__________________
2016-2017 - Programming Mentor
Curie Sub-Division Champions with 694, 379 & 1511
2015 - Team Captain & Head of Programming Crew
Carson Sub-Division Champions with 1325, 20 & 1711
First ever Israeli team on Einstein
2014 - Team Captain & Head of Programming Crew
2013 - Head of Programming Crew
2012 - Member of Programming Crew

Last edited by GuyM142 : 15-02-2016 at 19:54.
  #2   Spotlight this post!  
Unread 15-02-2016, 21:56
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Problems with Automatic Target Alignment

PID uses the I term to push harder if the mechanism doesn't move right away. Set the P constant just low enough to avoid oscillation, then crank up the I until it moves reliably. Use the D term to compensate for rotational momentum so you won't keep accelerating once it gets moving "fast enough" and you'll give the robot a chance to slow down as it approaches the target.

You might have to do some back and forth adjustment of P and I, as they're both contributing to control in the same direction, and once the robot starts moving they're reinforcing each other.

Watch out for how you're closing the feedback loop, though. You can't just use the vision target output as the feedback signal, because it will be delayed enough to make your robot turning oscillate even with a well-tuned PID controller. Instead, use a gyro to measure your current heading and use the vision system to decide what your desired heading will be. Only take a new vision reading once the robot direction has settled down, so you know you're getting a value that reflects "now" instead of one that was derived while the robot was pointing somewhere else.
  #3   Spotlight this post!  
Unread 19-02-2016, 01:27
mehnadnerd mehnadnerd is offline
Registered User
AKA: Brendan
FRC #1458 (Red Tie Robotics)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2009
Location: Danville
Posts: 5
mehnadnerd is an unknown quantity at this point
Re: Problems with Automatic Target Alignment

I would agree with Alan Anderson, I would make sure that the P term is large enough to avoid friction issues while using D to stop oscillation. The I term is not strictly necessary, it can be left out or replaced with a 2nd Derivative term.

Secondly, make sure that your code does the conversion from location on the image to angle if your PID code is based on angle, you will have to do some trigonometry.

If you encounter difficulties with gyro drift, magnetometers can avoid some of those issues in exchange for accuracy.

Finally, try to get a carpet that is similar to the actual field environment, and competitions will usually provide some time for calibration at the beginning, take advantage to tweak your constants.
  #4   Spotlight this post!  
Unread 19-02-2016, 06:23
fargus111111111's Avatar
fargus111111111 fargus111111111 is offline
Registered User
AKA: Tim W
FRC #0343 (Metal in Motion)
Team Role: Alumni
 
Join Date: Nov 2014
Rookie Year: 2010
Location: South Carolina
Posts: 102
fargus111111111 is on a distinguished road
Re: Problems with Automatic Target Alignment

The other thing to consider is how you are telling it where to stop, you will never be able to make it stop dead center every time. You need a range that is acceptable for it to stop within, then move the robot slowly enough that the camera's refresh rate can keep up and it will catch the range. If you want to be more precise without taking more time you can use multiple "stages" where you have it move faster until it is within a wider range, then it slows down to catch a smaller range.
We are running PID control as well, but we run it separate from everything else so we can use it with any movements we make.
Our auton uses a "2 stage" vision targeting system that has been 100% reliable.
__________________
I didn't break it... this time.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:31.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi