View Full Version : Simple Custom Video Dashboard 30+ FPS
TheDominis
11-02-2010, 18:06
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
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
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
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
I know I made a UDP video server and the GDC said it was illegal.
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
Can you please post a Ubuntu-Mono friendly version?
byteit101
13-02-2010, 08:04
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
Can you please post a Ubuntu-Mono friendly version?
Seriously???
Great program! Works really well for the COMETS!
Robototes2412
13-02-2010, 13:30
deleted
TheDominis
13-02-2010, 14:42
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
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
can you please post a version that is compatible with mono?
byteit101
13-02-2010, 18:55
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
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
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
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
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.
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
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
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
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
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
thats about the bandwidth of USB, sorry, but you guys are SOL
byteit101
05-03-2010, 20:37
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/showthread.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
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
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
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
I use my dashboard on the classmate and get 30+ FPS...
Robototes2412
08-03-2010, 14:04
Can you please make it wine-compatible?
TheDominis
08-03-2010, 14:07
Sure...
It'll take me about 30 minutes or less...
or maybe longer... not much though
Robototes2412
08-03-2010, 14:16
thanks
byteit101
08-03-2010, 16:02
thanks
my ZomB .net 2 port *SHOULD* be mono AND wine friendly (have not tested however)
http://www.chiefdelphi.com/forums/showthread.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
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
I read with some surprise the following thread:
http://www.chiefdelphi.com/forums/showthread.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
I read with some surprise the following thread:
http://www.chiefdelphi.com/forums/showthread.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
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
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
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
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
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
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
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
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
I use only the following code :
AxisCamera &camera = AxisCamera::GetInstance();
camera.WriteResolution(AxisCameraParams::kResoluti on_320x240);
camera.WriteBrightness(50);
As you can tell I used 320x240 at default compression (0 - I believe).
Greg McKaskle
13-03-2010, 12:28
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
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
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
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.