Go to Post Step 1: Get a blue banner. Step 2: Wave it everywhere until your School Board acknowledges your existence. We haven't gotten to Step 1 yet, unfortunately. - Chris is me [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-21-2016, 08:55 AM
2172Stew 2172Stew is offline
"Don't worry, that error is ok."
AKA: Stew
FRC #2172 (Street Legal)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Ohio
Posts: 5
2172Stew is an unknown quantity at this point
For Those Having Trouble Getting a USB Camera Feed into RoboRealm

Here at team 2172 we have had a great deal of trouble getting a USB camera to feed into RoboRealm through the rio. After 4 days of working (and late nights of research) I determined that our problem was that the AutomaticCapture() function, although it was feeding frames to the smart dash, was not feeding frames to RoboRealm. To solve this problem I copied the code from the Intermediate Vision example program (removing line 39). This code sends a frameevery time the teleop loop loops. It does this by calling the SetImage() function.

To conclude, if you are having trouble with a usb camera outputting to the smart dash be sure that you are using Camera Server code which sets the image using SetImage().
Reply With Quote
  #2   Spotlight this post!  
Unread 01-26-2016, 09:42 PM
razar51 razar51 is offline
Registered User
AKA: John Faulkner
FRC #1288 (Raven Robotics)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2007
Location: St. Charles, MO
Posts: 10
razar51 is an unknown quantity at this point
Re: For Those Having Trouble Getting a USB Camera Feed into RoboRealm

I don't have access to those examples. Could you post that file?
Reply With Quote
  #3   Spotlight this post!  
Unread 01-28-2016, 01:36 PM
2172Stew 2172Stew is offline
"Don't worry, that error is ok."
AKA: Stew
FRC #2172 (Street Legal)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Ohio
Posts: 5
2172Stew is an unknown quantity at this point
Re: For Those Having Trouble Getting a USB Camera Feed into RoboRealm

This is the code directly copied:

#include "WPILib.h"

/**
* Uses IMAQdx to manually acquire a new image each frame, and annotate the image by drawing
* a circle on it, and show it on the FRC Dashboard.
*/
class IntermediateVisionRobot : public SampleRobot
{
IMAQdxSession session;
Image *frame;
IMAQdxError imaqError;

public:
void RobotInit() override {
// create an image
frame = imaqCreateImage(IMAQ_IMAGE_RGB, 0);
//the camera name (ex "cam0") can be found through the roborio web interface
imaqError = IMAQdxOpenCamera("cam0", IMAQdxCameraControlModeController, &session);
if(imaqError != IMAQdxErrorSuccess) {
DriverStation::ReportError("IMAQdxOpenCamera error: " + std::to_string((long)imaqError) + "\n");
}
imaqError = IMAQdxConfigureGrab(session);
if(imaqError != IMAQdxErrorSuccess) {
DriverStation::ReportError("IMAQdxConfigureGrab error: " + std::to_string((long)imaqError) + "\n");
}
}

void OperatorControl() override {
// acquire images
IMAQdxStartAcquisition(session);

// grab an image, draw the circle, and provide it for the camera server which will
// in turn send it to the dashboard.
while(IsOperatorControl() && IsEnabled()) {
IMAQdxGrab(session, frame, true, NULL);
if(imaqError != IMAQdxErrorSuccess) {
DriverStation::ReportError("IMAQdxGrab error: " + std::to_string((long)imaqError) + "\n");
} else {
CameraServer::GetInstance()->SetImage(frame);
}
Wait(0.005); // wait for a motor update time
}
// stop image acquisition
IMAQdxStopAcquisition(session);
}
};

START_ROBOT_CLASS(IntermediateVisionRobot)
Reply With Quote
Reply


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


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

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