Go to Post a Victor is a Victor is a Victor. - Billfred [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 17-03-2009, 15:37
H0WSY0URCAT H0WSY0URCAT is offline
Baumler
AKA: Baumler
FRC #0093 (N.E.W. Apple Corps.)
Team Role: Driver
 
Join Date: Jan 2009
Rookie Year: 2006
Location: Appleton
Posts: 2
H0WSY0URCAT is an unknown quantity at this point
Re: Live Video on Dashboard

I would really like to get a look at the code when you get time to post it. I do not really get what everything means but I want to learn, and our programmers are going to start on a code to try to get this to work and we are prolly gonna need all the help we can get.
  #17   Spotlight this post!  
Unread 17-03-2009, 21:17
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Live Video on Dashboard

Everybody seems to be doing great on this thread. I only have a few things to add. I've seen the camera timing get flaky when compression is set too high. I'm not sure where the threshold is or if it involves images size or is simply affected by compression factor. By flaky I mean that the image framerate will drop because some frames will take two periods to be sent.

Also, modifying the image and recompressing on the cRIO doesn't seem like a good use of CPU time. If you can find a single camera setting so that the image can be piped to the dashboard, that will have minimal impact on other tasks and will get the highest framerate to the dashboard.

Greg McKaskle
  #18   Spotlight this post!  
Unread 18-03-2009, 04:38
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Live Video on Dashboard

Quote:
Originally Posted by writchie View Post
Depending on how good the jpg encoder is, i.e. speed and file size at high compression settings, it looks like it might be possible to handle higher quality 320x240 images (for better tracking), scale them to 160x120, compress them with a high setting, and ship them off to the dashboard while maintaining 25 fps.

Since the jpg decoding speed is pretty slow, I would expect the encoding speed to have similar issues. Have you measured how much processor time is required to encode at high compression settings?
Since our entire set-up was implemented on the Thursday night/Friday morning of the competition, I didn't have an opportunity to do extensive testing. As soon as I get access to the code I'll try to do some benchmarking.

Quote:
Originally Posted by Greg McKaskle View Post
Everybody seems to be doing great on this thread. I only have a few things to add. I've seen the camera timing get flaky when compression is set too high. I'm not sure where the threshold is or if it involves images size or is simply affected by compression factor. By flaky I mean that the image framerate will drop because some frames will take two periods to be sent.
In what we were doing, the video didn't necessarily have to be 25 fps, we settled for 3-5 fps (also probably because of time constraints. along the lines of "does it work?" "yes" "ok awesome don't break it"); all of our images were being split across multiple frames. We had a some problem with dropped UDP packets (probably somewhere along the line of 1 out of every 50 or so), which means we would drop a frame every 2-3 seconds, but it didn't seem to be a problem.

It should be noted that our application was essentially a monitor to tell our operator if he should push the "dump" button, since our robot was tall and opaque; we weren't actually trying to drive the robot real time with this. It's my opinion that basically no matter how good you get the video framerate/quality, it's not going to be able to beat just watching the field for driving ability, due to the camera's relatively narrow field of view. I don't say this to discourage anyone, just to make sure teams are being reasonable about what this can accomplish.

Quote:
Originally Posted by Greg McKaskle View Post
Also, modifying the image and recompressing on the cRIO doesn't seem like a good use of CPU time. If you can find a single camera setting so that the image can be piped to the dashboard, that will have minimal impact on other tasks and will get the highest framerate to the dashboard.
I agree, I'll have to do some experimenting with the camera compression settings.

However, I was finding that by using parallel while loops, I could keep the bottle neck as the network transfer speed (granted we were still using 10 frames to transfer one image). Again, I'll have to do more rigorous testing, but it seems like most teams won't be doing much else with CPU time than running a basic driver control loop, and using parallel whiles with appropriate considerations for timing should keep this running smoothly.

--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
  #19   Spotlight this post!  
Unread 19-03-2009, 18:44
Patrick Chiang Patrick Chiang is offline
Programming
FRC #3070 (Team Pronto)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Seattle
Posts: 162
Patrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to all
Re: Live Video on Dashboard

I'm extremely new to LabVIEW programming, and I'm wondering if I can have a copy of your Dashboard code if you actually got it working. Thanks.
  #20   Spotlight this post!  
Unread 24-03-2009, 23:37
xtreampb's Avatar
xtreampb xtreampb is offline
Lead Programmer 2642
FRC #2642 (Pitt Pirates)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Snow Hill
Posts: 21
xtreampb is an unknown quantity at this point
Send a message via AIM to xtreampb Send a message via Yahoo to xtreampb
Re: Live Video on Dashboard

I am new to programming things to send over a network. How do you compress files and images in the C++ code. How would i uncompress the files and images in VB.NET. I would love to see the hard code of the camera feed functions.
__________________
~Xtreampb~

Pitt Pirates 2642

Lead Programmer
  #21   Spotlight this post!  
Unread 25-03-2009, 17:20
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Live Video on Dashboard

Quote:
Originally Posted by RyanCahoon View Post
Unfortunately I won't have access to the code for another week or so, but I can post the code then if anyone is interested.
I still haven't had access to a computer with LabVIEW on it (I was short sighted and didn't get it on my personal laptop), but I got our coach to send the code to me. This is hack-quality code, so it's not the smoothest, but regard it as a proof of concept. When I get some time to work on it, I'll try to clean it up, but I thought I'd post it so people could experiment if they want to.

Basic Robot Main.vi

Computer Dashboard

Note that the critical parts of the robot code are the two while loops at the top of the program. The rest is just drive code etc. For people who want to experiment, I'd recommend copying those two loops into their own code. Some changing of IP addresses might be required, I'm not sure if I hard coded any in. Again apologies for the sloppy code.

--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
  #22   Spotlight this post!  
Unread 25-03-2009, 18:05
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Live Video on Dashboard

Quote:
Originally Posted by xtreampb View Post
I am new to programming things to send over a network. How do you compress files and images in the C++ code. How would i uncompress the files and images in VB.NET. I would love to see the hard code of the camera feed functions.
You can use the imaqFlatten(...) method from nivision.h to compress images in C++, but this puts it into what's probably best called a proprietary format. It supposedly can be set to use JPEG to compress the image, so you could probably extract a JPEG from it somehow, but it's most likely going to be padded with extra data.

There's also a series of imaqWriteTYPEFile functions, but these write to the filesystem, so you would then have to read in the file again in order to send it over the network. Unless of course someone knows if there are/how to use pipes in VxWorks.

Assuming you've gotten your JPEG over the network unconvoluted

Code:
Dim im = New Bitmap(stream)
where stream is the stream coming from your network connection, or if you had to reconstruct the data because it was packetized to fit in the 984 byte constraint, you can use

Code:
Dim im = New Bitmap(New IO.MemoryStream(byteArray))
--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
  #23   Spotlight this post!  
Unread 27-03-2009, 14:57
dwodrich dwodrich is offline
Registered User
FRC #1706
 
Join Date: Dec 2008
Location: Wentzville
Posts: 45
dwodrich has a spectacular aura aboutdwodrich has a spectacular aura aboutdwodrich has a spectacular aura about
Re: Live Video on Dashboard

Quote:
Originally Posted by RyanCahoon View Post
I still haven't had access to a computer with LabVIEW on it (I was short sighted and didn't get it on my personal laptop), but I got our coach to send the code to me. This is hack-quality code, so it's not the smoothest, but regard it as a proof of concept. When I get some time to work on it, I'll try to clean it up, but I thought I'd post it so people could experiment if they want to.

Basic Robot Main.vi

Computer Dashboard

Note that the critical parts of the robot code are the two while loops at the top of the program. The rest is just drive code etc. For people who want to experiment, I'd recommend copying those two loops into their own code. Some changing of IP addresses might be required, I'm not sure if I hard coded any in. Again apologies for the sloppy code.

--Ryan
Thanks for the code. I see where you are enqueueing the data, but where does in get dequeued and sent to the dashboard? the question may be because I'm not real familiar with the basic robot project.
Thanks for your help!
  #24   Spotlight this post!  
Unread 28-03-2009, 01:14
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Live Video on Dashboard

Quote:
Originally Posted by dwodrich View Post
Thanks for the code. I see where you are enqueueing the data, but where does in get dequeued and sent to the dashboard? the question may be because I'm not real familiar with the basic robot project.
I'm actually not sure where this happens either. I suspect somewhere deep in the code (similar to the code that's responsible for transferring back camera images to the computer that doesn't work in competition, as you don't have to enable that anywhere that I know of either) there's a loop running that takes whatever is stored in the queue called "Dashboard Data" and passes it over the network.

This part of the code isn't mine; if you open up the default Build DashBoard Data.vi, you'll see a similar thing happening, which is where I got the code from.

Let me know if you have any other questions.

--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
Closed Thread


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
LabView dashboard/live telemetry smcmahon National Instruments LabVIEW and Data Acquisition 8 19-01-2009 19:45
New Video Blog Entry: "Video from Live LabVIEW Session for FRC Competitors in Toronto LVMastery NI LabVIEW 0 13-12-2008 08:09
Labview Video Tutorial? Dashboard Chris_Elston National Instruments LabVIEW and Data Acquisition 21 25-01-2008 00:29
Live video with Kit Camera BobcatProgramer Electrical 10 11-01-2005 10:43
Live Action Video - 3D Animation Combination Ryan Dognaux 3D Animation and Competition 18 06-08-2003 19:33


All times are GMT -5. The time now is 02:00.

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