Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Simple Custom Video Dashboard 30+ FPS (http://www.chiefdelphi.com/forums/showthread.php?t=82422)

TheDominis 11-02-2010 18:06

Simple Custom Video Dashboard 30+ FPS
 
2 Attachment(s)
I've made a dashboard in C# that uses the stock camera code. I get 30 FPS with their newest code.

I've attached the executable and source code.

Requirements

.NET 4.0 Framework

How To Use
Set the drop down list to Tcp as that is currently the only supported format.
Set the text box with "Robot IP Goes Here" to your robot's IP.

Notes
It will take about three seconds to show video.

PranavSathy 12-02-2010 06:17

Re: Simple Custom Video Dashboard 30+ FPS
 
Thank you very much, that code was very useful, but just a few questions, first, why would you use XAML and not a regular windows form, second what is the reason for 2 classes, you can just put the content of Reciever in TcpListener and just use the thread within TcpListener itself.

I hope you dont mind if I use your code in my own program with many modifications ;), I willll be sure to release it with credit :D.

TheDominis 12-02-2010 07:17

Re: Simple Custom Video Dashboard 30+ FPS
 
I'm using Wpf which requires Xaml. Wpf is supposed to be hardware accelerated by direct 2D.

I split up the recievers because I also had a Udp receiver and I still may add that.

PranavSathy 12-02-2010 16:44

Re: Simple Custom Video Dashboard 30+ FPS
 
Thanks for the reply, I dont think you want to add a UDP reciever because UDP is prohibited during matches, the block the network (UDP network), or atleast I heard so. They use UDP to switch Autonomous from OperatorControl and so they dont want any UDP traffic other than their own.

TheDominis 12-02-2010 16:55

Re: Simple Custom Video Dashboard 30+ FPS
 
I know I made a UDP video server and the GDC said it was illegal.

MattD 12-02-2010 17:07

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by PranavSathy (Post 918757)
Thanks for the reply, I dont think you want to add a UDP reciever because UDP is prohibited during matches, the block the network (UDP network), or atleast I heard so. They use UDP to switch Autonomous from OperatorControl and so they dont want any UDP traffic other than their own.

It's still useful if you want to read userdata sent from the cRIO to a custom dashboard. That data is sent over UDP as part of the "official" communications protocol.

Robototes2412 12-02-2010 19:06

Re: Simple Custom Video Dashboard 30+ FPS
 
Can you please post a Ubuntu-Mono friendly version?

byteit101 13-02-2010 08:04

Re: Simple Custom Video Dashboard 30+ FPS
 
why it is using .Net 4? I like to try to make my programs use .net 2 for greatest compatibility. You can use 3.0 for WPF

GGCO 13-02-2010 08:45

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Robototes2412 (Post 918859)
Can you please post a Ubuntu-Mono friendly version?

Seriously???

Great program! Works really well for the COMETS!

Robototes2412 13-02-2010 13:30

Re: Simple Custom Video Dashboard 30+ FPS
 
deleted

TheDominis 13-02-2010 14:42

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by byteit101 (Post 919125)
why it is using .Net 4? I like to try to make my programs use .net 2 for greatest compatibility. You can use 3.0 for WPF

I don't know what version of .NET the computer came with so I installed 4.0. I believe that the computer I tested it on only has 3.5, but I am not sure.

PranavSathy 13-02-2010 18:15

Re: Simple Custom Video Dashboard 30+ FPS
 
He is probably using Visual Studio 2010 like me, its default configuration is to make .NET 4.0 applications, but there is an option during the Project Wizard on which .NET to use, as low as 2.0 or 1.0 I believe, but I forget :D.

Robototes2412 13-02-2010 18:40

Re: Simple Custom Video Dashboard 30+ FPS
 
can you please post a version that is compatible with mono?

byteit101 13-02-2010 18:55

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Robototes2412 (Post 919523)
can you please post a version that is compatible with mono?

although I applaud your open-sourceness, Mono has no (current) desire to implement WPF (http://mono-project.com/WPF), so you would have to do a lot of work

TheDominis 13-02-2010 21:20

Re: Simple Custom Video Dashboard 30+ FPS
 
2 Attachment(s)
I've commented the code. I'm just slightly confused as to why you want to run it on Ubuntu especially since we all got tiny little 2Go computers with XP.

TheDominis 13-02-2010 21:23

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by PranavSathy (Post 919511)
He is probably using Visual Studio 2010 like me, its default configuration is to make .NET 4.0 applications, but there is an option during the Project Wizard on which .NET to use, as low as 2.0 or 1.0 I believe, but I forget :D.

I am using Visual Studio 2008. I used beta Visual Studio 2010 when it was extremely slow and have no interest in returning until official release.

Robototes2412 15-02-2010 00:03

Re: Simple Custom Video Dashboard 30+ FPS
 
Thanks a lot. I choose to use Ubuntu because I do not want to have programs I make today compatible with computers that run in 40 years, m$ probably will not survive if Linux really takes off.

slavik262 15-02-2010 08:58

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Robototes2412 (Post 920264)
Thanks a lot. I choose to use Ubuntu because I do not want to have programs I make today compatible with computers that run in 40 years, m$ probably will not survive if Linux really takes off.

Don't turn this into a Microsoft v. Linux flamewar. It has nothing to do with the dashboard.

oddjob 15-02-2010 10:34

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Robototes2412 (Post 920264)
Thanks a lot. I choose to use Ubuntu because I do not want to have programs I make today compatible with computers that run in 40 years, m$ probably will not survive if Linux really takes off.


That was my first concern, making sure the 2010 Breakway Dashboard runs in year 2050 under Linux version 35.6. What?

slavik262 15-02-2010 14:09

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Robototes2412 (Post 920510)
where does your code use wpf? I would like to comment that out and see if it works then.

Unless you have anything useful to say, go dump on Microsoft somewhere else. Remember that you're representing your team here to the entire FIRST community.

Robototes2412 15-02-2010 14:23

Re: Simple Custom Video Dashboard 30+ FPS
 
I am not trying to dump on microsoft, it is an unintended side effect. I would like to try to port this code to an open framework, such as GTK/Gstreamer. VLC would possibly be a good candidate for this too. If anyone can help me with porting this, can you please contact me? I dont mean to sound rude by saying those last few posts, but I do not use windows and dislike it b/c it crashes very often when i use it (my laptop crashed when i opened google with IE).

slavik262 15-02-2010 14:35

Re: Simple Custom Video Dashboard 30+ FPS
 
This dashboard is written in C# and uses both the .NET framework and the WPF, all Windows technologies. Porting it wouldn't be far from rewriting it completely. If you'd like to write your own video dashboard, contact me or TheDominis and we'd be happy to explain how the video system works.

tutkows1 04-03-2010 23:01

Re: Simple Custom Video Dashboard 30+ FPS
 
For my team, this seemed to cennect unreiable. The fps was below 5, and you had to resart it several times for the video feed to come. Do you have to turn off firewalls, or do something special? We are running this off a computer connected via usb to ethernet adapter. to a windoes XP professional machine.

Robototes2412 05-03-2010 18:56

Re: Simple Custom Video Dashboard 30+ FPS
 
thats about the bandwidth of USB, sorry, but you guys are SOL

byteit101 05-03-2010 20:37

Re: Simple Custom Video Dashboard 30+ FPS
 
I ported (different front end) this to .net 2, and integrated it with our ZomB Dashboard, which you can download here: http://www.chiefdelphi.com/forums/sh...d.php?p=931845
It gets the same as the original, but easier for non WPF users (like Ubuntu users) to use.

slavik262 08-03-2010 10:21

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Robototes2412 (Post 931810)
thats about the bandwidth of USB, sorry, but you guys are SOL

What on earth do you mean by that?

Tom Line 08-03-2010 11:44

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by tutkows1 (Post 931606)
For my team, this seemed to cennect unreiable. The fps was below 5, and you had to resart it several times for the video feed to come. Do you have to turn off firewalls, or do something special? We are running this off a computer connected via usb to ethernet adapter. to a windoes XP professional machine.

I had a question for Dominis regarding that.

As far as I can tell I get around 5 FPS as well, with the stock dashboard OR his dashboard.

That makes me believe that the framerate you see on your dashboard is also affected by the framerate the crio is processing.

I wonder why that is if it's the case - couldn't we decouple the two and have new pictures sent to the dashboard as quickly as possible while doing the image processing in a parallel loop? I'm going to post the question for the NI guys because I don't see any obvious reasons it wouldn't work.

slavik262 08-03-2010 12:12

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Tom Line (Post 933575)
I had a question for Dominis regarding that.

As far as I can tell I get around 5 FPS as well, with the stock dashboard OR his dashboard.

That makes me believe that the framerate you see on your dashboard is also affected by the framerate the crio is processing.

I wonder why that is if it's the case - couldn't we decouple the two and have new pictures sent to the dashboard as quickly as possible while doing the image processing in a parallel loop? I'm going to post the question for the NI guys because I don't see any obvious reasons it wouldn't work.

I've gotten 30 fps running on TheDominis's dashboard on a laptop besides the Classmate. The entire reason the FPS is slow low is because the Classmate's processor is too slow to handle the image processing any faster. The bottleneck is not in the cRIO, but the Classmate.

I'm developing my own video display (using C++ instead of a .NET language) with some hardware acceleration (Direct3D 9). I'll let you know if there's any speed increase.

TheDominis 08-03-2010 14:04

Re: Simple Custom Video Dashboard 30+ FPS
 
I use my dashboard on the classmate and get 30+ FPS...

Robototes2412 08-03-2010 14:04

Re: Simple Custom Video Dashboard 30+ FPS
 
Can you please make it wine-compatible?

TheDominis 08-03-2010 14:07

Re: Simple Custom Video Dashboard 30+ FPS
 
Sure...

It'll take me about 30 minutes or less...

or maybe longer... not much though

Robototes2412 08-03-2010 14:16

Re: Simple Custom Video Dashboard 30+ FPS
 
thanks

byteit101 08-03-2010 16:02

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Robototes2412 (Post 933677)
thanks

my ZomB .net 2 port *SHOULD* be mono AND wine friendly (have not tested however)
http://www.chiefdelphi.com/forums/sh...ad.php?t=82612

EDIT: Mono migration tool says one error, but it is easily fixed, I'll post a mono-friendly version in about 3 minutes. void Receiver_OnImageUpdate () Image Image.FromStream (Stream, bool, bool) useEmbeddedColorManagement and validateImageData aren't supported.
EDIT2: posted at above url

TheDominis 08-03-2010 16:17

Re: Simple Custom Video Dashboard 30+ FPS
 
1 Attachment(s)
I have ported the video dashboard to 2.0 .NET as well as made it (most likely) Wine friendly. I also made the program more robust -- probably.

Please report any issues.

buchanan 10-03-2010 12:50

Re: Simple Custom Video Dashboard 30+ FPS
 
I read with some surprise the following thread:
http://www.chiefdelphi.com/forums/sh...ad.php?t=84087

I'll ask here: for the developers and users of this video dashboard, what networking setup are you using between the classmate and the machine displaying the video? Is it known to work under a real FMS?

TheDominis 10-03-2010 14:13

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by buchanan (Post 935198)
I read with some surprise the following thread:
http://www.chiefdelphi.com/forums/sh...ad.php?t=84087

I'll ask here: for the developers and users of this video dashboard, what networking setup are you using between the classmate and the machine displaying the video? Is it known to work under a real FMS?

The classmate displays my video. I get 30+ FPS.

hamosad1657 10-03-2010 14:49

Re: Simple Custom Video Dashboard 30+ FPS
 
How you get the screen on the "Driver" Account?
I opened it on the "Developer" account, and I got 5fps....

TheDominis 10-03-2010 14:55

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by hamosad1657 (Post 935253)
How you get the screen on the "Driver" Account?
I opened it on the "Developer" account, and I got 5fps....

Are you running the right executable on the developer account? If so, 5 fps makes no sense as we all have the same computer...

Vikesrock 10-03-2010 14:59

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by TheDominis (Post 935261)
Are you running the right executable on the developer account? If so, 5 fps makes no sense as we all have the same computer...

What resolution are you getting the 30FPS at? That may be one possible difference between your setup and theirs.

EDIT: Also how tough would it be to implement command line parameters for robot IP, and starting size and location of the window? I am looking at calling this from a Labview dashboard and while we could position it and enter the IP every time that seems a bit cumbersome. I would try it myself if I knew C#...

TheDominis 10-03-2010 20:42

Re: Simple Custom Video Dashboard 30+ FPS
 
1 Attachment(s)
Quote:

Originally Posted by Vikesrock (Post 935264)
What resolution are you getting the 30FPS at? That may be one possible difference between your setup and theirs.

EDIT: Also how tough would it be to implement command line parameters for robot IP, and starting size and location of the window? I am looking at calling this from a Labview dashboard and while we could position it and enter the IP every time that seems a bit cumbersome. I would try it myself if I knew C#...

I can make it take an IP from a file. I'll have a new binary posted in a few minutes.

Just create a file called smash-ip.txt in the start up directory and the first line will be the IP.

hamosad1657 11-03-2010 07:27

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by TheDominis (Post 935261)
Are you running the right executable on the developer account? If so, 5 fps makes no sense as we all have the same computer...

I have an Edimax router, maby it impressive the communication?

And how can I get it running on the Driver account?

TheDominis 11-03-2010 08:59

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by hamosad1657 (Post 935555)
I have an Edimax router, maby it impressive the communication?

And how can I get it running on the Driver account?

You'll have to set it as a start up program with Windows. As far as the router, I wouldn't have any idea.

All I can report is that I get 30+ FPS on our team's classmate. Perhaps you can change power saving options so that they are on performance.

Kingofl337 11-03-2010 21:27

Re: Simple Custom Video Dashboard 30+ FPS
 
What settings are you running on the crio? 320x240? Any compression?

Thank your for making this, the LV dashboard kills the poor classmate cpu.

buchanan 11-03-2010 21:52

Re: Simple Custom Video Dashboard 30+ FPS
 
For those getting mysteriously low frame rates one thing to check is the camera configuration. The Axis camera's video server has an option to limit the frame rate, and there may be (or have been) software floating around that reconfigures it without your direct intent..

Connect the camera directly to a computer that's configured with a 192.168.0.X IP address, and open the camera IP (192.168.0.90) in a web browser. Go to the video configuration page and see if the frame rate limiting is set.

This happened to us. When we first tried the camera, running direct to a web browser, it was real-time video fast. Later in the build season, running through the cRIO/classmate/video dashboard we were stuck at 2 FPS no matter what we did. Looking at the config page, guess what we found? We have no idea how it got that way.

TheDominis 12-03-2010 07:15

Re: Simple Custom Video Dashboard 30+ FPS
 
I use only the following code :

Code:

AxisCamera &camera = AxisCamera::GetInstance();
camera.WriteResolution(AxisCameraParams::kResolution_320x240);
camera.WriteBrightness(50);

As you can tell I used 320x240 at default compression (0 - I believe).

Greg McKaskle 13-03-2010 12:28

Re: Simple Custom Video Dashboard 30+ FPS
 
The default camera compression when the camera is reset is definitely not zero. I've seen a number of threads saying to set compression to zero or saying it is best to set compression to zero. As with any advice, verify a before and after. I definitely do not see best performance with compression at zero.

As for the LV dashboard killing the Classmate CPU. You have access to the source, and in fact there are a few things that drastically lower the CPU usage. The simplest change is to click on the image display and in Visible Items, hide the Image Information element. There is another thing you can do, but it was really the combination of these two things that was causing lots of excessive drawing. I'll write up more on this once I have a chance to test it on an actual classmate.

Greg McKaskle

TheDominis 13-03-2010 18:24

Re: Simple Custom Video Dashboard 30+ FPS
 
Quote:

Originally Posted by Greg McKaskle (Post 936289)
The default camera compression when the camera is reset is definitely not zero. I've seen a number of threads saying to set compression to zero or saying it is best to set compression to zero. As with any advice, verify a before and after. I definitely do not see best performance with compression at zero.

As for the LV dashboard killing the Classmate CPU. You have access to the source, and in fact there are a few things that drastically lower the CPU usage. The simplest change is to click on the image display and in Visible Items, hide the Image Information element. There is another thing you can do, but it was really the combination of these two things that was causing lots of excessive drawing. I'll write up more on this once I have a chance to test it on an actual classmate.

Greg McKaskle

I'm pretty sure that the default compression is 0 or 10. I'm pretty sure that it is 0 at least in C++.

Greg McKaskle 13-03-2010 23:02

Re: Simple Custom Video Dashboard 30+ FPS
 
I'm referring to the default of the Axis camera, not the default of the WPI code. The default LV compression was five this year in order to minimize noise in the image, but this does affect loop rate at medium and large image sizes.

Greg McKaskle


All times are GMT -5. The time now is 21:26.

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