Go to Post Sometimes it's not what you know going into a battle, but who you know. - Elgin Clock [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 11-01-2013, 21:23
Johnbot's Avatar
Johnbot Johnbot is offline
Es Brokein!
AKA: John Westhoff
FRC #4791 (Pandroids)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Horsham, PA
Posts: 92
Johnbot is just really niceJohnbot is just really niceJohnbot is just really niceJohnbot is just really niceJohnbot is just really nice
Re: Camera Tracking help please

What you want to do is repeatedly re-run that code as you rotate your robot to face the target. Look at the reports[i].center_mass_x, as that will tell you the center of the target. Generally, the index, i, goes from 0 being the highest target to the left, and reports.length-1 being the lowest to the right.

You will want the center_mass_x value to be your video resolution divided by two.

You can go about this by using a PID loop for accurate results, though that requires tuning. If you don't need it to be super precise, you can just have it turn the robot at a speed proportional to the distance between the center_mass_x value and the center of your camera, and stop turning when you are within, say, 10 pixels.
__________________

2011-2014 - FRC 2607 - Student
2012-2012 - FLL 2249 - Coach
2015- ???? - FRC 4791 - Mentor
Reply With Quote
 


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 10:14.

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