Go to Post Honor is doing the right thing when nobody is watching. - Daniel_LaFleur [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 26-01-2012, 10:08
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Re: Camera GetImage not getting image

Quote:
Originally Posted by bob.wolff68 View Post
I might suggest a couple things...

Set your resolution, brightness, and compression before getting any images. Shouldn't be some major failure point, but....good practice.

Also, I thought that GetImage returned a ColorImage and while HSLImage is related, I'd give a shot at going to the basics that way.

Otherwise, I might suspect config issues - have you tried NI Vision assistant and is it able to grab images?

Lastly - after looking once again - I would suggest using a standard while(isOperatorControl()) {} and place your if (isFreshImage()) inside there. Remember, this is a realtime gig and while your desktop is faster than the cRio, the cRio is 400MHz and so it'll crank through the camera items very quickly. It is possible that after gaining access to the camera, it isn't ready for you to grab an image. I'd suggest sometime like:

Code:
...OperatorControl() {
int iWidth = 0;
Error &err;
ColorImage *image;	

AxisCamera &m_camera = AxisCamera::GetInstance("10.12.51.11");
m_camera.WriteResolution(AxisCamera::kResolution_3 20x240);
m_camera.WriteCompression(20);
m_camera.WriteBrightness(0);

while (isOperatorControl())
{
  if (m_camera.isFreshImage())
  {
    image = m_camera.GetImage();

    err = m_camera.GetError();	
    if (err.GetLineNumber() != 0)
    {
  // Might this supposed to be err.GetCode() for a code value?
  // Not going to fix the problem - but will be more informative I think.
      printf("AxisCamera error number %f \n", err.GetLineNumber());
      printf(err.GetMessage());
    }
    else
    {
      iWidth = image->GetWidth();
    }

  delete image;
  }
}

return;
}
This will test to make sure that you're REALLY waiting on the camera to become ready and grabbing an image, checking errors, and width etc. If you have are actively debugging, I'd breakpoint on 'iWidth=' line or do a printf() or something to alert yourself that you really did get a valid image at some point.

bob
P.S. This is being typed @ work - no compilers involved. Likely has minor issues or more...
Ok I tried this code, but isFreshImage is always false.
also. I had to use HSLImage *image; instead of ColorImage *image; in order to compile with no type mismatch.

Last edited by enrique : 26-01-2012 at 10:10. Reason: more info
Reply With Quote
  #2   Spotlight this post!  
Unread 26-01-2012, 10:20
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Re: Camera GetImage not getting image

Here is the console:
Default RobotInit() method... Override me!
Initializing PIDController
Task spawned: id = 0x2948e48, name = t2
Getting camera instance
Setting camera parameters
Starting operator control loop
task 0xe73c40 (FRC_cameraTask) deleted: errno=0 (0) status=0 (0)
task 0x25b3d18 (System Web Services Load Thread) deleted: errno=0 (0) status=0 (0)
task 0x2b787b0 (mDNS resolve) deleted: errno=0 (0) status=0 (0)
task 0x2bbb238 (mDNS resolve) deleted: errno=0 (0) status=0 (0)
Reply With Quote
  #3   Spotlight this post!  
Unread 26-01-2012, 12:24
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 157
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Camera GetImage not getting image

I'm not familiar with console output for such a situation and I can't tell what code you're using to get this output either. But I don't see any errors. Obviously the 'override me', but no errors...is there something in particular that is suspicious in your view of this?

Can someone with more console output experience weigh in?

bob
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote
  #4   Spotlight this post!  
Unread 26-01-2012, 15:56
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Re: Camera GetImage not getting image

I'm using the netconsole utility that was provided to do the ssh connection to the crio. its like using the serial console output with telnet.
Reply With Quote
  #5   Spotlight this post!  
Unread 17-02-2012, 19:01
gr8dragon's Avatar
gr8dragon gr8dragon is offline
Registered User
AKA: Parth Patel
no team
Team Role: Alumni
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Toronto,Canada
Posts: 39
gr8dragon is a glorious beacon of lightgr8dragon is a glorious beacon of lightgr8dragon is a glorious beacon of lightgr8dragon is a glorious beacon of lightgr8dragon is a glorious beacon of light
Re: Camera GetImage not getting image

We are having the same issue. And as for the console output what sticks
Out to me is the frccameratask deleted line.
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 03:01.

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