Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Camera Programming (http://www.chiefdelphi.com/forums/showthread.php?t=109518)

2185Bilal 11-13-2012 11:20 PM

Camera Programming
 
So after three years, our team has finally decided to use a camera on the robot.
Since I was in the team three years ago, i dont have a single idea how to program the camera.

So I would like to ask the greater programmers at CD, to help me.

What do I need to program a robot to track the 4 squares (used in rebound rumble), and then move the robot so it aligns straight towards the target.

Like what electrical components do i need and how do I program a camera

thanks for the help

McGurky 11-14-2012 09:42 AM

Re: Camera Programming
 
Electrically, all you need is the camera (axis cam), an Ethernet cord to plug into your bridge, and the power cable wired to 5v on the Power Distribution Board.

For setting up and configuring the camera, refer to this document (search camera)

http://www.usfirst.org/sites/default...20System_2.pdf

There is a great write up on the vision targets here:

http://firstforge.wpi.edu/sf/docman/...ib/docman.root

With Java code examples and an explanation of the theory! (Read all the documentation and you will learn alot, if you have specific questions, ask them here and the community will help!)

2185Bilal 11-14-2012 08:11 PM

Re: Camera Programming
 
Okay thanks,

So I do have one question:

So here I have a snippet of the sample code given for Java programming:
Code:

//ColorImage image = camera.getImage();    // comment if using stored images
ColorImage image;                          // next 2 lines read image from flash on cRIO
image =  new RGBImage("/10ft2.jpg");

BinaryImage thresholdImage = image.thresholdRGB(255, 255, 0, 0, 0, 0);  // keep only red objects
BinaryImage bigObjectsImage = thresholdImage.removeSmallObjects(false, 2);  // remove small artifacts
BinaryImage convexHullImage = bigObjectsImage.convexHull(false);          // fill in occluded rectangles
BinaryImage filteredImage = convexHullImage.particleFilter(cc);          // find filled in rectangles

Now, the part that I have in bold, when I remove the "//" from the "ColourImage image = camera.getImage();" and comment out the other two lines. Netbeans gives me the error saying:
Code:

unreported exception AxisCameraException; must be caught or declared to be thrown
So what does this mean, and am I supposed to get this error, because I want to use my camera to obtain my image, not the sample images.

Also, I was just wondering. If I do happen to use the sample image, how do I get it on the cRIO. I know in the documentations it says, ftp to the root directory. But what does that actually mean, like how do i ftp to the cRIO, which software do I use and etc.

Thanks in advance

~Cory~ 11-15-2012 03:17 PM

Re: Camera Programming
 
camera.getImage() can cause errors (think about if you tried to fetch an image that didn't exist) so you need to surround it with a

try{
//getImage
}
catch (Exception e){
//insert code to log error here, if wanted

//handle the error by notifying the user to fix what ever is throwing the //error.

}

2185Bilal 11-15-2012 04:21 PM

Re: Camera Programming
 
Okay thanks
But how do i download the sample images to the crio via ftp

Could u like tell me how to do it

cgmv123 11-15-2012 07:35 PM

Re: Camera Programming
 
ftp://10.28.15.2/

~Cory~ 11-15-2012 11:14 PM

Re: Camera Programming
 
Use the address that cgmv123 posted (if you are using the default ip set up).

You can use FileZilla which has a graphic user interface or the default ftp

using a CLI FTP
Change to the current directory to the one with the image files
run ftp
type "open 10.28.15.2" and press enter
leave username and password blank
type "bin"
use the "cd" command to move to the directory that you want the files in
the use the "put" command to upload files.


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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi