Go to Post FIRST is not all about the competitions. FIRST is about what you learn to get to wherever you got to, whether that be first seed or last. - StephLee [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
  #16   Spotlight this post!  
Unread 07-02-2006, 20:21
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: New version of WPILib

Quote:
Originally Posted by Kruuzr
Hi Brad...

I started coding up our full application using WPILib but I ran across a big difference between the documentation and what I assume are new functions. In the userAPI.h file, there are two camera functions:

void InitCamera(unsigned char cameraInitIndex);
void CaptureTrackingData(
unsigned char *centerX,
unsigned char *centerY,
unsigned char *x1,
unsigned char *y1,
unsigned char *x2,
unsigned char *y2,
unsigned char *regionSize,
unsigned char *confidence,
unsigned char *pan,
unsigned char *tilt);

The first is obviously a changed version of InitializeCamera() and the second must be new. Could you give a quick rundown of how they work, especially the 'cameraInitIndex' parameter of InitCamera() ? And how do we set camera parameters as there is no place to set up a CameraInitializationData struct.

Thanks
You caught me! I just put up a new version with the function definition included in the BuiltIns.h file.

There are a few functions in WPILib which are hard for programmers to use, but easy for EasyC to automatically generate. These are two of those functions.

The function:

InitializeCamera(CameraInitializationData *c);

that you can call passing the address of the camera initialization structure. This is probably easiest for you to use. The other function:

InitCamera(unsigned char cameraInitIndex);

was intended for EasyC. It assumes that there is an array of those structs and the argument is the index to the one you want to use.

My suggestion is to initialize a structure with the camera parameters you want to use and call InitializeCamera. It's actually called from inside of InitCamera anyway.

The other functions to use the camera data are:

CaptureTrackingData(...) - this is the one you described

and

TPacket *CopyTrackingData(void);

Is the function that I intended hand-coding programmers to use. This returns a pointer to a static structure containing a TPacket inside of WPILib. When you call the function, it turns off interrupts, grabs the most recent packet, and puts it into the static structure - then returns its address.

Then you can write code like this:

TPacket t = CopyTrackingData();
conf = t->confidence;

which seemed to be pretty convenient.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute

Last edited by BradAMiller : 07-02-2006 at 20:30.
  #17   Spotlight this post!  
Unread 07-02-2006, 22:14
Kruuzr Kruuzr is offline
Mentor - electrical, software
AKA: Steve Cote
FRC #1922 (Ozram)
Team Role: Engineer
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Henniker, NH
Posts: 33
Kruuzr has a spectacular aura aboutKruuzr has a spectacular aura about
Re: New version of WPILib

Quote:
Originally Posted by BradAMiller
You caught me! I just put up a new version with the function definition included in the BuiltIns.h file.

There are a few functions in WPILib which are hard for programmers to use, but easy for EasyC to automatically generate. These are two of those functions.

The function:

InitializeCamera(CameraInitializationData *c);

that you can call passing the address of the camera initialization structure. This is probably easiest for you to use. The other function:

InitCamera(unsigned char cameraInitIndex);

was intended for EasyC. It assumes that there is an array of those structs and the argument is the index to the one you want to use.

My suggestion is to initialize a structure with the camera parameters you want to use and call InitializeCamera. It's actually called from inside of InitCamera anyway.

The other functions to use the camera data are:

CaptureTrackingData(...) - this is the one you described

and

TPacket *CopyTrackingData(void);

Is the function that I intended hand-coding programmers to use. This returns a pointer to a static structure containing a TPacket inside of WPILib. When you call the function, it turns off interrupts, grabs the most recent packet, and puts it into the static structure - then returns its address.

Then you can write code like this:

TPacket t = CopyTrackingData();
conf = t->confidence;

which seemed to be pretty convenient.

Thanks for the info Brad...
I think the time lag between coding and documentation is a law of physics.

Steve
  #18   Spotlight this post!  
Unread 07-02-2006, 22:43
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: New version of WPILib

Quote:
Originally Posted by Kruuzr
Thanks for the info Brad...
I think the time lag between coding and documentation is a law of physics.

Steve
The laws of physics change somewhat during the 6 week build season. Then they go back to normal.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #19   Spotlight this post!  
Unread 18-02-2006, 19:00
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: New version of WPILib

There is a new version of WPILib that has better error handling for the CMUCam. It will now fail more quickly if the camera is not detected and there is a function to get the status from the camera after initialization.

You can get it at the usual place.

Please post something with your results. I have tested it on a 2006 controller with the camera disconnected from the serial adapter and also with the serial adapter disconnected from the robot and both seem to work.

Be sure to save the old version this close to shipping in case you don't like the results.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #20   Spotlight this post!  
Unread 15-01-2007, 16:23
michael714's Avatar
michael714 michael714 is offline
Registered User
FRC #3863 (Pantherbotics)
Team Role: Teacher
 
Join Date: Apr 2006
Rookie Year: 2007
Location: Newbury Park, CA
Posts: 46
michael714 is on a distinguished road
Re: New version of WPILib

Hey Brad,
Where do you find BuiltIns.h ?

Your efforts are appreciated.
  #21   Spotlight this post!  
Unread 16-01-2007, 13:50
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: New version of WPILib

Whoops...

It's fixed now. There was a problem with the automatic build stuff and some stuff didn't update properly.

The new version is in the usual place.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #22   Spotlight this post!  
Unread 16-01-2007, 14:19
Kruuzr Kruuzr is offline
Mentor - electrical, software
AKA: Steve Cote
FRC #1922 (Ozram)
Team Role: Engineer
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Henniker, NH
Posts: 33
Kruuzr has a spectacular aura aboutKruuzr has a spectacular aura about
Re: New version of WPILib

Not quite fixed yet!!!

I get :
You don't have permission to access /~bamiller/WPILib/WPILib2007011601.zip on this server.

Kruuzr

Quote:
Originally Posted by BradAMiller View Post
Whoops...

It's fixed now. There was a problem with the automatic build stuff and some stuff didn't update properly.

The new version is in the usual place.

Brad
  #23   Spotlight this post!  
Unread 16-01-2007, 19:39
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: New version of WPILib

Same here. I'm getting the "You don't have permission to access /~bamiller/WPILib/WPILib2007011601.zip on this server." as well
  #24   Spotlight this post!  
Unread 17-01-2007, 07:49
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: New version of WPILib

Quote:
Originally Posted by slavik262 View Post
Same here. I'm getting the "You don't have permission to access /~bamiller/WPILib/WPILib2007011601.zip on this server." as well
Fixed... sorry about that.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #25   Spotlight this post!  
Unread 18-01-2007, 22:21
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Talking Re: New version of WPILib

Quote:
Originally Posted by BradAMiller View Post
Fixed... sorry about that.
Thanks as always
__________________
  #26   Spotlight this post!  
Unread 22-01-2007, 11:47
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: New version of WPILib

I put up a new version of WPILib that exposes some of the internal functions that can reset the camera and send commands to it. Should make it easy to use the Virtual Window stuff.

http://users.wpi.edu/~bamiller/WPILib/Versions.html

When you reset the camera, then send commands, tracking is turned off. You need to restart tracking by calling StartCamera(). Also you can set the camera debug mode by calling SetCameraDebugMode(1) and the commands to/from the camera will be echoed in the terminal window so you can see what it is doing.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #27   Spotlight this post!  
Unread 27-01-2007, 15:49
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: New version of WPILib

Good Stuff. Thank you.
__________________
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
Welcome to the WPILib forum BradAMiller Programming 22 25-03-2008 22:44
WPILib - Library for robot programming BradAMiller Programming 7 21-06-2006 03:12
openFIRST Project Announces Pending Deadline for End of Support for Old Versions Timothy D. Ginn FIRST-related Organizations 0 11-07-2005 22:40
Flash Version of Playing Field Conor Ryan General Forum 49 30-01-2005 20:08
Does anyone know if we can use the version of Backburner from the 3DSMax trial ver? lnxpenguin4ever 3D Animation and Competition 2 26-01-2005 19:58


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

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