View Single Post
  #5   Spotlight this post!  
Unread 19-10-2010, 23:35
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: MOving toward a circle with camera code

Quote:
Originally Posted by Robototes2412 View Post
it doesn't go autonomously
I'm looking at the sample, and it appears it should track the target left to right, but not produce any forward movment.

The first thing to do is make it drive forward. The simplest way to do this is to change line 48 of CircleTrackerDemo to, where forward_speed is a constant representing the forward speed.
Code:
drive.arcadeDrive(forward_speed, output);
Once that works you need to make it stop. There are a few ways to do that, one way is to do something like this at line 127 of the same file:

Code:
if (targets[0].m_yPos > someValueToIndicateHeightOfTheTarget)
...
OR 

if (targets[0].m_majorRadius > someValueToIndicateTheSizeOfTheTarget)
...

when ... is 
{
    //do stuff other than drive.
}
else {
    turnController.setSetpoint(gyroAngle + targets[0].getHorizontalAngle());
}
You could expand this to use PID to slow down as approaching the target distance, back away if too close, etc, but that is more advanced.


Once you have this working you could make it run in autonomous mode by moving the contents of the else, starting at line 99 in the sample, into the autonomousPeriodic function at line 73.
__________________
Eric Haskins KC9JVH
Reply With Quote