Go to Post It is not necessary to draw 200 amps to move a robot through a two minute match. Rule of thumb is you robot should be able to compete for three matches without a battery change. - Al Skierkiewicz [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 29-03-2006, 04:03
cdennisxlx2's Avatar
cdennisxlx2 cdennisxlx2 is offline
Team San Diego Web Liaison
AKA: Cameron Dennis
FRC #1266 (The Devil Duckies)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: San Diego
Posts: 188
cdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to behold
CMU Cam Autonomy code? NEED HELP B4 FRIDAY!

I am really confused on how to write an auton code that uses the camera to find the green and then drive to it and aquire our angle with our tilt motor and then shoot the balls, i keep looking and looking on how to do so but i have no idea what to do, and i need to have this done by friday, preferably thursday (because we will be at the vegas regional). but if anyone can help me or if someone is really generous to accually write me one that i can manipulate to work for me im using the latest cmu cam coding from kevins site. thank you
__________________
Team San Diego Robotics Web Liaison
Webmaster and Technical Advisor for the San Diego Regional Planning Committee.
Official Score Keeper for the San Diego Regional
www.sandiegoregional.com
www.frc1266.com
  #2   Spotlight this post!  
Unread 29-03-2006, 09:08
MacFlightSierra MacFlightSierra is offline
Registered User
FRC #0912 (Iron Lyons)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Toronto
Posts: 19
MacFlightSierra is an unknown quantity at this point
Re: CMU Cam Autonomy code? NEED HELP B4 FRIDAY!

Well, there are several steps to this. Let me assume that you are using MPLab and have the camera code in your project. If so:

- the auto code is coded in user_routines_fast.c, in the userAutonomousCode routine
- make use of the 3 functions that Kevin uses to track the light (info terminal, camera handler, servo track) - in that order.
- you will have full access to all the variables that you need, especially the getTrackingState function from tracking.c
- establish a path in which you want the robot to move, and use the 26.2 ms loop timer as a rough estimate (38 loops per second). Code that motion first - make it move in the direction you want (probably forward), and stop
- then, start calling the camera functions. You will have the getTrackingState info to establish when the camera is locked on the target
- once the camera is locked, you can manipulate and adjust your shooter/robot to whatever positions you want - use the pan servo and tilt servo aliases from tracking.h as reference


for example (my code is very simplistic, since we dont use any other sensors):

////////////// move forward //////////////////

if (AutoClock < 10) //AutoClock is a timer that counts every 10 loops
{
FWD(); //bot moves forward
}
else if (AutoClock < 35)
{
Stop(); //bot stops
AimFire(); //calls the camera aim routine [see below]
}
else
{
Stop(); //stop robot
//stop shooter
}

/////////////////// use camera to light up and fire /////////////
/* Camera Controls */
// send diagnostic information to the terminal
Tracking_Info_Terminal();

// This function is responsable for camera initialization
// and camera serial data interpretation. Once the camera
// is initialized and starts sending tracking data, this
// function will continuously update the global T_Packet_Data
// structure with the received tracking information.
Camera_Handler();

// This function reads data placed in the T_Packet_Data
// structure by the Camera_Handler() function and if new
// tracking data is available, attempts to keep the center
// of the tracked object in the center of the camera's
// image using two servos that drive a pan/tilt platform.
// If the camera doesn't have the object within it's field
// of view, this function will execute a search algorithm
// in an attempt to find the object.
Servo_Track();
/***************************************/

if (Get_Tracking_State() == SEARCHING)
{
AutoCMULookingForTarget = 1; //indicate if camera is locked or searching
AutoCMULockedOnTarget = 0;
}
else if (Get_Tracking_State() == TARGET_IN_VIEW | Get_Tracking_State() == CAMERA_ON_TARGET)
{
AutoCMULookingForTarget = 0;
AutoCMULockedOnTarget = 1;
}

if (AutoCMULockedOnTarget) //Line up if Locked
{
if (PanAngle < LeftLockLimit) //Camera is pointed LEFT -> turn LEFT
{
Left();
}
else if (PanAngle > RightLockLimit) //Camera is pointed RIGHT -> turn RIGHT
{
Right();
}
else //Robot is Horizonally Locked on target -> STOP Auto Alignment Procedure
{
Stop(); //stop robot
//Shoot
}
}
else //CMU Searching
{
Stop(); //stop robot
}


sorry for the messy code and long post

best of luck
  #3   Spotlight this post!  
Unread 29-03-2006, 10:59
cdennisxlx2's Avatar
cdennisxlx2 cdennisxlx2 is offline
Team San Diego Web Liaison
AKA: Cameron Dennis
FRC #1266 (The Devil Duckies)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: San Diego
Posts: 188
cdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to behold
Re: CMU Cam Autonomy code? NEED HELP B4 FRIDAY!

Thank you, this should help me. Are all the variables initialized in the base CMU cam coding?
__________________
Team San Diego Robotics Web Liaison
Webmaster and Technical Advisor for the San Diego Regional Planning Committee.
Official Score Keeper for the San Diego Regional
www.sandiegoregional.com
www.frc1266.com
  #4   Spotlight this post!  
Unread 29-03-2006, 11:19
MacFlightSierra MacFlightSierra is offline
Registered User
FRC #0912 (Iron Lyons)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Toronto
Posts: 19
MacFlightSierra is an unknown quantity at this point
Re: CMU Cam Autonomy code? NEED HELP B4 FRIDAY!

The variables you see there are my own aliases. All the variables that you use from the CMU code are in tracking.h and camera.h - I just aliased them to names more meaningful to me (i.e. PAN_SERVO is PanAngle). The counters and shooter controls are also my own of course. Your best bet is to look through tracking.h and read Kevin's comments about every variable, then alias them to names that you can easily understand.
  #5   Spotlight this post!  
Unread 08-12-2006, 15:03
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: CMU Cam Autonomy code? NEED HELP B4 FRIDAY!

Here is a program I made for the camera workshop team 40 held. Its in easyC but it works great.

Check the easyC forum to download easyC for FRC.
Attached Files
File Type: zip 4.3.2 Autonomous Tracking the Camera.zip (1.6 KB, 38 views)
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Out of the Box Camera Code russell Programming 9 21-10-2009 05:28
our own allternative code for the cmu camera Gili Programming 16 17-02-2006 00:16
Problem with idata_user_routines.o? Adrien Programming 3 12-02-2006 01:33
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 31-01-2005 22:28
heres the code. y this not working omega Programming 16 31-03-2004 15:18


All times are GMT -5. The time now is 23:00.

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