Picture Snapshots

So I have found that you can in fact take pictures with your camera then save them onto the cRIO’s solid-state memory, then retrieve them with FTP; but my team mates and I were wondering if you could skip that last step. Is there anyway you could have an interface that would accept a thumb drive (standard USB2.0 connection) on or connected to your cRIO that your code could download the images directly too, kind of like mirroring them over, so you could just unplug the thumb drive after matches and throw it in your laptop for quick viewing, that way you don’t have to bother with the FTP.

Since your cRIO will often connect to a computer in the pits, you can pretty easily automate the ftp to grab files and store them on your PC, mem stick, iPod, or wherever you like. If you want to do this in LV, try googling for free ftp VIs. I was surprised I couldn’t find them in the palettes. Of course you can write this script in anything you like that lets you access an ftp server.

Greg McKaskle

OK so I had my buddy write me an autograbber (just for ease, if anyone wants a copy I’ll be happy to supply you with it) that you enter in the file names you want as well as the servo info and it will quickly grab all the files in the config file automatically.

My next question is, where can I find the FTP info to actually nab the files from the cRIO? Is there an FTP server setup already on the cRIO or do we have to set one up ourselves?

ftp://10.15.2.2/
how do you save the images to the cRIO?

I’m not sure how someone using LV would do it, but I found some code in I think the DefaultCamera example for WR that had functions to adjust camera settings and to take snapshots.
Here is just the snapshot function, not entirely sure what includes it needs however.


	/** 
	 * Store an image on the cRIO 
	 * @param imageName stored on home directory of cRIO ( "/" )
	 **/
	void snapshot(char* imageName)	
	{
		/* this will take one picture and save it to a file
		 */
		DPRINTF(LOG_DEBUG, "taking a SNAPSHOT ");
		Image* cameraImage = frcCreateImage(IMAQ_IMAGE_HSL);
		if (!cameraImage) {
			dprintf (LOG_INFO,"frcCreateImage failed - errorcode %i",GetLastVisionError()); 
		}
		Wait(1.0);
		if ( !GetImage (cameraImage,NULL) ) {
			  dprintf (LOG_INFO,"
Camera Acquisition failed %i", GetLastVisionError());
		} else { 
			  if (!frcWriteImage(cameraImage, imageName) ) { 
					dprintf (LOG_INFO,"frcWriteImage failed - errorcode %i",GetLastVisionError());
			  } else { 
				  	dprintf (LOG_INFO,"
>>>>> Saved image to %s", imageName);	
					// always dispose of image objects when done
					frcDispose(cameraImage);
			  }
		}
	}

I just tried FTPing to the cRIO with ftp://10.15.2.2/ with FileZilla and I got the following errors


Status:	Connecting to 10.15.2.2:20...
Status:	Connection attempt failed with "ECONNREFUSED - Connection refused by server".
Error:	Could not connect to server
Status:	Waiting to retry...

try ftp://10.15.02.2/ (assuming your team 1502)

Is there any extra username/password data I need? I tried connecting with just that FTP IP and it was refusing connection - do I have to use a crossover cable directly from the cRIO to the laptop?

If you can download code to it you should be able to ftp to it through a web browser (you use ftp to load code on it in the first place)
Just make sure your robot is configured correctly and everything (it should be)