Go to Post We're not behind, the rest of the world is ahead! Yeah. Thats it. - Curtis Williams [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 28-01-2007, 15:21
JohnC's Avatar
JohnC JohnC is offline
my other name is nigel
FRC #0360 (360 Revolution)
Team Role: Programmer
 
Join Date: Mar 2005
Rookie Year: 2005
Location: user_routines.c
Posts: 100
JohnC is a jewel in the roughJohnC is a jewel in the roughJohnC is a jewel in the roughJohnC is a jewel in the rough
Send a message via AIM to JohnC
Using VirtualWindow() ... how?

I'm looking to track two lights to be able to center the robot between them, but I am clueless.

If I tell the camera to use a VW, will it go back to using a full window in the next loop? Will I still be able to use the pan/tilt angles as printed by the default camera code? Where will I find the coordinate values of the bounding box? If I create two VWs in one loop of autonomous code (for two lights), how can I get the coordinates of the bounding box for each?

Also, I'm assuming I don't need to change the camera to Raw Mode because the initialization function does that.

Basically, as is very clear, I'm new to using the camera. Any help is appreciated.
__________________
What place are we at? ... TODAI!
  #2   Spotlight this post!  
Unread 28-01-2007, 17:13
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Using VirtualWindow() ... how?

Quote:
Originally Posted by JohnC View Post
I'm looking to track two lights to be able to center the robot between them, but I am clueless.

If I tell the camera to use a VW, will it go back to using a full window in the next loop? Will I still be able to use the pan/tilt angles as printed by the default camera code? Where will I find the coordinate values of the bounding box? If I create two VWs in one loop of autonomous code (for two lights), how can I get the coordinates of the bounding box for each?

Also, I'm assuming I don't need to change the camera to Raw Mode because the initialization function does that.

Basically, as is very clear, I'm new to using the camera. Any help is appreciated.
The Virtual Window command tells the camera to ignore information outside the window you specify in the command. If the camera is streaming t-packets, you'll need to call the Camera_Idle( ) function first, wait for an ACK, then call Virtual_Window( ), wait for another ACK, then call Track_Color( ) if needed. There are two global variables in camera.c that count the number of ACKs and NCKs the camera has sent. When they increment, you know the camera has acknowledged (or not acknowledged) your command. You'll need to add these lines to camera.h before they'll be visable to other source code files:

extern unsigned int camera_acks;
extern unsigned int camera_ncks;

The new virtual window is persistent until the camera is reset, at which point the camera will revert back to using the full frame.

You do not need to call Raw_Mode( ) again.

The coordinant frame is discussed in the command dictionary, which is available at http://kevin.org/frc. If you mounted the camera using the instructions in the workbook, pixel 1,1 in in the upper left corner, otherwise it's located in the lower right corner.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #3   Spotlight this post!  
Unread 28-01-2007, 23:01
abrockhoff abrockhoff is offline
Team 11 Programming Captain
AKA: Alex Brockhoff
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: New Jersey
Posts: 16
abrockhoff will become famous soon enough
Send a message via AIM to abrockhoff
Re: Using VirtualWindow() ... how?

Today we just got it (somewhat) working, and we found it helpful to call Pole Mode (as mentioned by JT250 in the sticky) which is a command that causes the camera to only return 1 packet when track color is called.

So basically, after calling camera idle the we first put the camera in pole mode, and then get out of it after we are done splitting and checking our virtual windows.

Just a suggestion, it might not be necessary.

Code:
void Pole_Mode(unsigned char x)
{
     Write_Camera_Serial_Port('P');
     Write_Camera_Serial_Port('M');
     Write_Camera_Serial_Port(1);
     Write_Camera_Serial_Port(x);    
}
Input a 0 to turn it off.

Last edited by abrockhoff : 28-01-2007 at 23:05. Reason: typos
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
poll: how many teams are using ramps? Aaron Harvey Rules/Strategy 4 26-01-2007 01:26
How many teams are using the Camera? Matt Goulart Programming 5 06-02-2005 15:06
How many teams are using the Camera? Matt Goulart Electrical 3 30-01-2005 09:29
How many motors are you using to drive? Joseph F Motors 18 16-10-2002 21:24
How fast, how strong, how long? Wayne C. General Forum 6 24-01-2002 21:32


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

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