Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   New Camera Class (http://www.chiefdelphi.com/forums/showthread.php?t=81158)

slavik262 01-02-2010 11:28

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.

jhersh 01-02-2010 12:17

Re: New Camera Class
 
It looks like what they really said is no to UDP... can you make it work over TCP?

slavik262 01-02-2010 14:14

Re: New Camera Class
 
Quote:

Originally Posted by jhersh (Post 911154)
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.

TheDominis 01-02-2010 14:26

Re: New Camera Class
 
They said no to UDP on port 1180. This makes perfect sense as our packets would corrupt the driver station's packets. Currently, the video server works off of port 1234 (25FPS@160x120 resized to 640x480). However, I see a lot of erroneous packets as the robot gets farther away.

TCP hates not being acknowledged...

The GDC does not mention that UDP couldn't be used on another port. They do mention custom TCP protocols are allowed, but not UDP. They do not mention no UDP for all ports or just 1180.

slavik262 01-02-2010 14:36

Re: New Camera Class
 
We'd need to have clearance to use a port though, because the FMS firewalls off any ports not cleared for use by the robot and driver station.

Also, the video feed and the rest of the driver station data run on different ports. The video uses a TCP connection to port 1180, while the rest of the dashboard data sends 1018 byte packets through UDP on port 1165. They wouldn't corrupt each other at all.

I'll have to post the whitepaper I made about the rest of the dashboard data some time.

jhersh 01-02-2010 14:40

Re: New Camera Class
 
Quote:

Originally Posted by TheDominis (Post 911212)
The GDC does not mention that UDP couldn't be used on another port. They do mention custom TCP protocols are allowed, but not UDP. They do not mention no UDP for all ports or just 1180.

You should ask for official clarification on this, but my understanding is that UDP is not provisioned on any port on the FMS except for the official control and status packets, and you certainly can't use those.

jhersh 01-02-2010 14:41

Re: New Camera Class
 
Quote:

Originally Posted by slavik262 (Post 911218)
I'll have to post the whitepaper I made about the rest of the dashboard data some time.

That would be great!

jhersh 01-02-2010 15:37

Re: New Camera Class
 
Quote:

Originally Posted by slavik262 (Post 911204)
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.

I believe you (or someone else) mentioned sending video over the UserData dashboard data mechanism last year... it is implemented as UDP transfers, and only marginally smaller packets that you get with raw datagrams. I'm not aware of any changes that would have made this stop working. Is this method no longer feasible or desirable for some reason? This method has about 47kBytes/s throughput.

-Joe

TheDominis 01-02-2010 16:56

Re: New Camera Class
 
Quote:

Originally Posted by jhersh (Post 911257)
I believe you (or someone else) mentioned sending video over the UserData dashboard data mechanism last year... it is implemented as UDP transfers, and only marginally smaller packets that you get with raw datagrams. I'm not aware of any changes that would have made this stop working. Is this method no longer feasible or desirable for some reason? This method has about 47kBytes/s throughput.

-Joe

Our team implemented this last year. We were trying to get a good video stream this year at high FPS with good quality. Each frame at 0 compression takes 5 packets. That's 10 FPS . We did something high around 70-80 and got 16 FPS, but the quality couldn't be used for image tracking.

The stream uses 100KB/s at 160x120 and we resize it to 640x480. It looks good actually.

slavik262 01-02-2010 17:01

Re: New Camera Class
 
Quote:

Originally Posted by jhersh (Post 911257)
I believe you (or someone else) mentioned sending video over the UserData dashboard data mechanism last year... it is implemented as UDP transfers, and only marginally smaller packets that you get with raw datagrams. I'm not aware of any changes that would have made this stop working. Is this method no longer feasible or desirable for some reason? This method has about 47kBytes/s throughput.

-Joe

We could definitely try using the user data to send video; the obvious drawback is it leaves less room for other data. From the testing my team has done with the user data stream, the data it sends is often redundant, so the actual useful bytes/second value is lower than the potential.

jhersh 01-02-2010 17:05

Re: New Camera Class
 
Quote:

Originally Posted by slavik262 (Post 911336)
We could definitely try using the user data to send video; the obvious drawback is it leaves less room for other data. From the testing my team has done with the user data stream, the data it sends is often redundant, so the actual useful bytes/second value is lower than the potential.

I only see redundant data sent if the user data is updated by a task that is not synchronized with the control packets.

slavik262 02-02-2010 08:37

Re: New Camera Class
 
We'll have to check it out. Right now we're putting this project on the backburner for a week or so until this supposed update comes out.

jhersh 05-02-2010 15:49

Re: New Camera Class
 
Quote:

Originally Posted by slavik262 (Post 911717)
We'll have to check it out. Right now we're putting this project on the backburner for a week or so until this supposed update comes out.

Have you tried out the new update yet?

TheDominis 05-02-2010 18:13

Re: New Camera Class
 
I get about 150-250ms delay on the new camera.

jhersh 05-02-2010 21:00

Re: New Camera Class
 
Quote:

Originally Posted by TheDominis (Post 914188)
I get about 150-250ms delay on the new camera.

Is that something that you are happy with? It seems to be a lot better than you were getting before. How about frame rate?

Also, if you look at the code and have any suggestions for improvement, please let me know.

Joe


All times are GMT -5. The time now is 12:31.

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