Go to Post Regardless on how you feel about any team--respect should be paramount. - MeGuttieri [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-26-2010, 08:22 AM
TheDominis TheDominis is offline
Registered User
FRC #2152
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Port Orange, Florida
Posts: 88
TheDominis has a spectacular aura aboutTheDominis has a spectacular aura about
New Camera Class

BETA

I've heavily modified some camera code. There is slightly different functionality in smash_camera.cpp in GetJpegImageBlocking. It blocks with different functionality. It will not always succeed. You can change the functionality by copying the original method from PCVideoServer.cpp. Also, for now, you must manually set the IP to the computer to want to receive video from. You must do this in the method VideoServerHelper on line 65 in smash_video_server.cpp.

Required Code:

Code:
#include "smash_camera.h"

smash::AxisCamera& camera = smash::AxisCamera::getInstance();
camera.writeResolution(smash::k160x120);
camera.writeBrightness(0);
The Dashboard will fill a drop down box with all available IP addresses that are IPv4. This will automatically detect the data and start the server. If you want to stop the server, close the program. There is a timeout period of 250ms and the server status will be "waiting". The dashboard supports any Jpeg size. However, it seems to be slightly buggy on 320x240 and very buggy on 640x480. I'll be working on this.

I didn't try to 2Go PC, but I got 20+ FPS on 160x120.

I'll upload dashboard later.... must go!
Attached Files
File Type: rar SmashCameraCode.rar (7.7 KB, 39 views)

Last edited by TheDominis : 01-26-2010 at 08:25 AM. Reason: Upload Limit
Reply With Quote
  #2   Spotlight this post!  
Unread 01-26-2010, 11:34 AM
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 Camera Class

I'm sorry if I'm not getting this, but what does this do? Does it give an increased framerate or is it just designed to let the user customize what IP they want to use to receive video data?

Does this run on a LabVIEW dashboard, or some custom implementation of your own?
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 01-26-2010, 12:36 PM
TheDominis TheDominis is offline
Registered User
FRC #2152
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Port Orange, Florida
Posts: 88
TheDominis has a spectacular aura aboutTheDominis has a spectacular aura about
Re: New Camera Class

I didn't know that the zip limit was greater than the rar format. It failed for that reason.

The Dashboard frame rates at 160x120 were 20+ on the laptop I tested it on (not the 2Go computer). The other formats were less, but I think that was due to an error in the dashboard.

You will need 3.5 .NET Framework for this to work. Perhaps even SP1 for 3.5 .NET.
Attached Files
File Type: zip SmashBinaries.zip (188.7 KB, 22 views)
File Type: zip MagicDashboard.zip (314.6 KB, 23 views)

Last edited by TheDominis : 01-26-2010 at 12:42 PM. Reason: Requirements
Reply With Quote
  #4   Spotlight this post!  
Unread 01-26-2010, 04:42 PM
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 Camera Class

You still didn't really answer my question. Is this just a custom video dashboard? What advantages does this have over the standard code?
__________________
Reply With Quote
  #5   Spotlight this post!  
Unread 01-26-2010, 05:25 PM
TheDominis TheDominis is offline
Registered User
FRC #2152
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Port Orange, Florida
Posts: 88
TheDominis has a spectacular aura aboutTheDominis has a spectacular aura about
Re: New Camera Class

Quote:
Originally Posted by slavik262 View Post
You still didn't really answer my question. Is this just a custom video dashboard? What advantages does this have over the standard code?
Opposed to the stock camera server, my server gets 20+ FPS at 160x120. Other image sizes are slightly buggy, but I'll fix that soon. Adding more features later.

Last edited by TheDominis : 01-26-2010 at 05:32 PM.
Reply With Quote
  #6   Spotlight this post!  
Unread 01-26-2010, 05:46 PM
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 Camera Class

Awesome! Without pouring through the code, how did you manage to do this?
__________________

Last edited by slavik262 : 01-26-2010 at 05:48 PM.
Reply With Quote
  #7   Spotlight this post!  
Unread 01-26-2010, 06:30 PM
TheDominis TheDominis is offline
Registered User
FRC #2152
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Port Orange, Florida
Posts: 88
TheDominis has a spectacular aura aboutTheDominis has a spectacular aura about
Re: New Camera Class

Quote:
Originally Posted by slavik262 View Post
Awesome! Without pouring through the code, how did you manage to do this?
Server

Step 1. Acquire Image
Step 2. Calculate how many packets will be required to send the image
Step 3. Send packet(s) via UDP (1032 byes), populate any outdated data
Step 4. Repeat 1 - 3

Receiver

Step 1. Acquire a 1032 byte packet
Step 2. Translate the packet into usable information (i.e Big Endian to Little Endian)
Step 3. Populate "Status" with new information
Step 4. If the image is finished, present it
Step 5. Repeat 1 - 4

This is, of course, a simplified overview.
Reply With Quote
  #8   Spotlight this post!  
Unread 01-26-2010, 06:36 PM
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 Camera Class

So you segment the image into several packets and send it over UDP instead of TCP? I assume you have error-checking built in? I'll have to check it out.
__________________
Reply With Quote
  #9   Spotlight this post!  
Unread 01-26-2010, 06:38 PM
TheDominis TheDominis is offline
Registered User
FRC #2152
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Port Orange, Florida
Posts: 88
TheDominis has a spectacular aura aboutTheDominis has a spectacular aura about
Re: New Camera Class

Quote:
Originally Posted by slavik262 View Post
So you segment the image into several packets and send it over UDP instead of TCP? I assume you have error-checking built in? I'll have to check it out.
I carry very little about errors. I throw them out and wait for a new image.
Reply With Quote
  #10   Spotlight this post!  
Unread 01-26-2010, 08:17 PM
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,509
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: New Camera Class

I'm curious - how does this affect the total bandwidth used by a single Crio and dashboard.

In other words, have you increased 20-fold (or is it 20^2 for an image) the number of packets that are going to be sent to increase your framerate by 20 times?

For some reason I thought the communication protocalls were sancrosanct - that is I thought we weren't allowed to touch them because of bandwidth concerns. I had thought that was why they limited the dashboard to a 1 hz update, though I might be wrong: you know what they say about assuming.
Reply With Quote
  #11   Spotlight this post!  
Unread 01-26-2010, 08:53 PM
TheDominis TheDominis is offline
Registered User
FRC #2152
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Port Orange, Florida
Posts: 88
TheDominis has a spectacular aura aboutTheDominis has a spectacular aura about
Re: New Camera Class

Quote:
Originally Posted by Tom Line View Post
I'm curious - how does this affect the total bandwidth used by a single Crio and dashboard.

In other words, have you increased 20-fold (or is it 20^2 for an image) the number of packets that are going to be sent to increase your framerate by 20 times?

For some reason I thought the communication protocalls were sancrosanct - that is I thought we weren't allowed to touch them because of bandwidth concerns. I had thought that was why they limited the dashboard to a 1 hz update, though I might be wrong: you know what they say about assuming.
I'm not sure either. The TCP stream tries to send an image pretty fast, but fails. Also it implicitly fragments, but I do not know how this affects socket I/O. I know that I use ~1MB/s for 640x480@30Hz with Jpegs drawn on the computer, but they are much larger than the camera's Jpegs at no compression. I'll post bandwidth usage for each image size tomorrow.
Reply With Quote
  #12   Spotlight this post!  
Unread 01-29-2010, 09:54 PM
TheDominis TheDominis is offline
Registered User
FRC #2152
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Port Orange, Florida
Posts: 88
TheDominis has a spectacular aura aboutTheDominis has a spectacular aura about
Re: New Camera Class

The source code can be found by using svn.

Code:
svn checkout http://frc-video-collab.googlecode.com/svn/trunk/ frc-video-collab-read-only
The C++ code will be updated tomorrow morning at around 10:30 EST.
Reply With Quote
  #13   Spotlight this post!  
Unread 02-01-2010, 11:28 AM
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 Camera Class

The GDC got back to us, and their answer is, in a word, no:

http://forums.usfirst.org/showthread.php?t=14284

We'll have to see what this update brings before moving forward.
__________________
Reply With Quote
  #14   Spotlight this post!  
Unread 02-01-2010, 12:17 PM
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: New Camera Class

It looks like what they really said is no to UDP... can you make it work over TCP?
Reply With Quote
  #15   Spotlight this post!  
Unread 02-01-2010, 02:14 PM
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 Camera Class

Quote:
Originally Posted by jhersh View Post
It looks like what they really said is no to UDP... can you make it work over TCP?
Sure, but we think that a lot of the slowness was caused by TCP. For example, if a frame of the video being transmitted gets screwed up, it's not that big of a deal using UDP, especially if you have a high framerate. You can just drop the frame and wait for the next one (no big deal if you're getting a good 20 of them every second - the user will barely notice). If we use TCP and the same thing happens to a packet, the receive() function stops the entire program execution, sends a request to resend the packet, and waits for the packet to get sent again, all for just one frame (or even just one part of a frame). You're making the entire system, which could be better spending its time just displaying the next frame(s), wait on just one frame instead of moving on.

We're also aware that some of the latency is being caused by the Classmate not being enough to keep up with the cRIO, but TCP doesn't help in this respect.
__________________

Last edited by slavik262 : 02-01-2010 at 02:17 PM.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
define a new class(C++) nadavsen2 C/C++ 15 11-02-2010 01:21 PM
Camera using IterativeRobot class Steve Warner C/C++ 2 01-24-2010 09:47 PM
New class for Logitech Dual Action Gamepad Mike Soukup C/C++ 8 02-11-2009 08:08 PM
Camera Help (New to Camera Programming) Idaman323 Programming 6 01-14-2006 03:56 AM
**FIRST EMAIL**/FIRST Announces New Class of Senior Mentors. Billfred FIRST E-Mail Blast Archive 1 12-23-2004 01:32 PM


All times are GMT -5. The time now is 09:30 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