Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Dashboard Robot SDRead Communication Problems (http://www.chiefdelphi.com/forums/showthread.php?t=128665)

nstephenh 09-04-2014 19:35

Dashboard Robot SDRead Communication Problems
 
We are having some difficulties reading variables from the smart dashboard. The SD Write vi's are working fine, and from the "Variables" tab of the dashboard we can verify that the variables' values are updating, but when we run the SD Read vi's in the robot code, we get either old or default values. This does not happen consistently, and when it does it only happens with some variables. Our robot can drive with no problems, and closing and reopening the dashboard fixes the issue. Any ideas?

Kevin Phan 09-04-2014 21:50

Re: Dashboard Robot SDRead Communication Problems
 
You might want to post a screenshot of your code so we can see if it is correct. You need a while loop to continually update your sensor value. It should be placed in periodic task with a delay of either 10 or 100 ms.

nstephenh 10-04-2014 07:34

Re: Dashboard Robot SDRead Communication Problems
 
We only write our sensor value once, because it is an image from our camera and we are concerned with bandwidth issues.

We have read that we are not supposed to write to the dashboard from the dashboard, and instead update a control. We will try this, and post our result.

Alan Anderson 10-04-2014 08:56

Re: Dashboard Robot SDRead Communication Problems
 
I can't think of any reason for wanting to write a camera image as a Smart Dashboard variable. Why are you trying to do that? What do you use the image for?

nstephenh 10-04-2014 15:16

Re: Dashboard Robot SDRead Communication Problems
 
Our robot writes the value it gets from the camera to the dashboard, so we can do vision processing on a laptop. The robot then reads the value from the dashboard and uses that data to tell if the goal is hot.

Alan Anderson 10-04-2014 16:23

Re: Dashboard Robot SDRead Communication Problems
 
Quote:

Originally Posted by nstephenh (Post 1372158)
Our robot writes the value it gets from the camera to the dashboard, so we can do vision processing on a laptop.

That is not a very good way to do it. Given the network architecture we use, I would go so far as to call it a spectacularly poor way to do it.

Your dashboard program should be getting the image directly from the camera, without forcing the robot program and Smart Dashboard communication to be an intermediary. The default Dashboard already connects to the camera and reads the image. You just need to feed that image to your vision processing.

prometheusLKR 10-04-2014 18:01

Re: Dashboard Robot SDRead Communication Problems
 
Quote:

Originally Posted by Alan Anderson (Post 1372189)
That is not a very good way to do it. Given the network architecture we use, I would go so far as to call it a spectacularly poor way to do it.

Your dashboard program should be getting the image directly from the camera, without forcing the robot program and Smart Dashboard communication to be an intermediary. The default Dashboard already connects to the camera and reads the image. You just need to feed that image to your vision processing.

We tried doing that, and because of the internal buffering of the camera, if we use the dashboard Read MJPG just when we want to get a new image, the image is not current, and if we read from the camera continuously, we have bandwidth issues (even at low resolution and frame rate, it resulted in our robot losing communication with the field at the NC Regional). We seem to have been able to solve this issue by running the "MJPG Loop" vi in Periodic Tasks, and when we need an image, we get the image string and communicate it using a network tables variable. This has resulted in being able to consistently get a current image, something we were never able to accomplish getting the image directly from the camera in dashboard code.

This is, however, not the problem being discussed in the thread, and as an update on that issue (not getting correct values with SD Read Boolean and Read Numeric), we seem to have been able to fix the problem by switching from SD Read and Write vi's to NT Read and Write vi's.

~another programmer from OP's team

Greg McKaskle 12-04-2014 06:40

Re: Dashboard Robot SDRead Communication Problems
 
Just to clarify a few things. The SD and NT functions work almost identically except that the SD functions automatically add "SmartDashboart/" to the variable name in order to keep it separate from the other types of Network Table variables. The storage, transmission approach and other aspects are the same.

I believe the size limit of strings is actually pretty small. It is implementation dependent, but cannot be larger than 65k characters. So in some implementations you may be able to store an image, but that may not work consistently.

I'm not sure I have enough info to give a suggestion on how to setup your camera, but the camera supports both JPG read of a single image and an MJPG session which sends images without asking for each. If using MJPG, you need to read them as fast as they are sent or they will lag behind. You can ask the camera for a very low framerate. Because it was not often needed and caused confusion, I believe the JPG option is in vi.lib, but not in the palettes. If you want to use it, it is in the same folder as the other camera VIs.

Greg McKaskle

prometheusLKR 12-04-2014 22:05

Re: Dashboard Robot SDRead Communication Problems
 
Quote:

Originally Posted by Greg McKaskle (Post 1372815)
Just to clarify a few things. The SD and NT functions work almost identically except that the SD functions automatically add "SmartDashboart/" to the variable name in order to keep it separate from the other types of Network Table variables. The storage, transmission approach and other aspects are the same.

I believe the size limit of strings is actually pretty small. It is implementation dependent, but cannot be larger than 65k characters. So in some implementations you may be able to store an image, but that may not work consistently.

I'm not sure I have enough info to give a suggestion on how to setup your camera, but the camera supports both JPG read of a single image and an MJPG session which sends images without asking for each. If using MJPG, you need to read them as fast as they are sent or they will lag behind. You can ask the camera for a very low framerate. Because it was not often needed and caused confusion, I believe the JPG option is in vi.lib, but not in the palettes. If you want to use it, it is in the same folder as the other camera VIs.

Greg McKaskle

OK, thanks. I'll try and see if I can get the JPG option working sometime, although I think we're going to stick with network tables for championships since it's been working consistently and we wouldn't have much time to test out a new approach before championships.


All times are GMT -5. The time now is 08:55.

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