Go to Post If you don't have a butt to fill that seat, you don't need it. When the butt arrives, we'll make room. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 22-04-2011, 22:22
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
2010 Vision targetting code

Now that our team is done for the season, we are starting to look at some of the post season projects. One of such projects is to resurrect the 2010 Breakaway bot and update it with this year's code library. The reason why we want to do that is we like our 2010 bot and want to use it for demos. Because of time constraint last year, we did not quite get the vision targetting code debugged plus the fact that our 2011 library code has a new feature that allows PID controlled vision targetting. So you can drive the robot around with mecanum wheels forward, backward and sideways and PID control will take care of always facing the robot to the goal. We debugged the PID control code and it seemed it was working "in theory". It means when we moved the target to the left, the robot would turn left. If we moved the target to the right, it would turn right. However, the turn was delayed for about half a second. Eventually, we time-stamped our calls to the targetting code provided by FIRST and found that calling GetImage() and FindCircularTargets() together took somewhere between 500 to 1000 msec. It got worse if the room was dimly lit (could be up to 3 seconds). Is this a known problem with the vision targetting code? I remember when we tested that last year, we did not see this issue? Just to make it clear, we did not change a line in the provided vision targetting code. If it is a known issue with the provided code, did somebody fix it in a newer version. If not, I may have to dig into the vision targetting code and figure out why it took so long. At first, we didn't realize it took a long time but when we saw the WatchDog was starving, then we suspected the time it took was long and thus put in the code to time it.
Code:
if (m_camera.IsFreshImage())
{
    UINT32 timeStart = GetMsecTime();
    // find FRC targets in the image
    HSLImage *image = m_camera.GetImage();
    vector<Target> targets = Target::FindCircularTargets(image);
    delete image;
    if ((targets.size() > 0) &&
        (targets[0].m_score >= MIN_TARGET_SCORE))
    {
        input = targets[0].GetHorizontalAngle();
        prevInput = input;
        m_dsLCD->PrintfLine(DriverStationLCD::kUser_Line3,
                                     "Target found at %f", input);
    }
    m_dsLCD->PrintfLine(DriverStationLCD::kUser_Line4,
                                 "Time: %d", GetMsecTime() - timeStart);
}
__________________

Last edited by mikets : 23-04-2011 at 01:25.
Reply With Quote
  #2   Spotlight this post!  
Unread 23-04-2011, 11:20
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: 2010 Vision targetting code

Check the image size and the rake parameters to the FindEllipse. Also keep in mind that the camera exposure time goes up in low light --if using auto exposure.

Greg McKaskle
Reply With Quote
Reply


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 12:59.

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