Go to Post Such reasonableness will not be tolerated! This is teh interwebz! - pfreivald [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-03-2010, 03:05
Travis Hoffman's Avatar Unsung FIRST Hero
Travis Hoffman Travis Hoffman is offline
O-H
FRC #0048 (Delphi E.L.I.T.E.)
Team Role: Engineer
 
Join Date: Sep 2001
Rookie Year: 2001
Location: Warren, Ohio USA
Posts: 4,047
Travis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond repute
Enabling Default Dashboard in C++

I'm trying to get the default LabVIEW dashboard indicators to update (so I can then pursue some customizations). I'm using WindRiver C++. I'm borrowing our code template we used last season (shared online so it's rules-friendly, not that anyone would want to use it ). On the surface, I think I ported over the dashboard specific code from this year's template properly. I did get the dashboard to display the camera feed, but the IO status indicators are not updating. Can anyone set me down the right path? I use the IterativeRobot class.

Code:
 
//Stuff in .h file
 
#include"DashboardDataSender.h"
 
DashboardDataSender *dds;
Code:
 
//Stuff in .cpp file
 
#include"DashboardDataSender.h"
 
//Dashboard Data Sender
dds = new DashboardDataSender();
//Update Dashboard Data
dds->sendIOPortData();
Should I be calling the sendIOPortData() method in a specific location? Am I missing anything else?


Thanks,
__________________

Travis Hoffman, Enginerd, FRC Team 48 Delphi E.L.I.T.E.
Encouraging Learning in Technology and Engineering - www.delphielite.com
NEOFRA - Northeast Ohio FIRST Robotics Alliance - www.neofra.com
NEOFRA / Delphi E.L.I.T.E. FLL Regional Partner
Reply With Quote
  #2   Spotlight this post!  
Unread 16-03-2010, 10:05
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Enabling Default Dashboard in C++

I've been meaning to create and release a whitepaper on how we do our dashboard customization, but haven't had time this season. Maybe in our off week next week I'll get around to it.

It sounds like you're in the beginning stages, so lets start there and learn from the example code. Based on your question, I think you did this already, but if not, create a new dashboard sample project if you haven't already (File->New->Example ... Downloadable Kernel Module Sample Project ... FRC Dashboard Data Example) The way packing the data up changed from last year, so you'll want to take a look.

Let's work from the top down and look at the key sections. The RobotMain method makes callse to sendIOPortData() and sendVisionData(). These functions are in DashboardDataFormat.cpp. Calling these functions does everything you need to interface with the default dashboard. So the quick answer to your original question is yes. Make a call to both of these functions every time through your loop. If you're not using vision data, you don't have to make the call, but you have to update the Labview side to not be expecting that data.

So, to dig deeper, lets look at the internals of sendIOPortData(). The first thing it does is get a reference to the low priority dashboard packer. The packer contains the data that will be pushed onto the bit stream. My understanding that the low and high priority packers don't actually have different priorities in the data stream itself. On the receiver side, if the buffer is too large, the low priority packet is truncated.

Once the reference is obtained, it is populated. If you're not familiar with Labview, a Cluster is the equivalent to a structure in C++. Calling AddCluster designates the start of a cluster. It is closed out when FinalizeCluster is called. Calls may be nested to create more complex data types. The AddFloat and AddU8 calls add a float or UINT8 variable type to the packer.

When everything has been added and all clusters have been finalized, Finalize() is called on the dashboard packer. This designates that you are done packing and the data is ready to be sent out the door.

A similar process is done in sendVisionData for the high priority packer.

Once you have that framework in place, you can change it however you like as long as the packet that you're filling in on the C++ side matches what the Labview side is expecting. If it doesn't, you'll get an error on the Labview side that the packet doesn't match the format. This error can be tricky to debug. A few things that I've learned 1. A float comes across as a single precision type. Make sure your orange constants use the "single" representation. 2. Order is critical. You can right click on a cluster to reorder/view its contents.

Once you get the default working I can help you with the customization.

Last edited by Dave Scheck : 16-03-2010 at 10:08.
Reply With Quote
  #3   Spotlight this post!  
Unread 16-03-2010, 11:07
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: Enabling Default Dashboard in C++

Quote:
Originally Posted by Dave Scheck View Post
So, to dig deeper, lets look at the internals of sendIOPortData(). The first thing it does is get a reference to the low priority dashboard packer. The packer contains the data that will be pushed onto the bit stream. My understanding that the low and high priority packers don't actually have different priorities in the data stream itself. On the receiver side, if the buffer is too large, the low priority packet is truncated.
This is correct. The UDP datagrams sent from the robot are a fixed size (1018 bytes IIRC). After the header, high-priority data is packed, followed by error strings, then by low-priority data. The low-priority data is truncated to the packet size minus eight bytes. The last eight bytes contain four bytes of padding (bytes with a value of 0) and a CRC 32-bit checksum (for error detection).
__________________
Reply With Quote
  #4   Spotlight this post!  
Unread 16-03-2010, 16:22
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Enabling Default Dashboard in C++

I haven't looked into the dashboard stuff in depth but I have a few questions myself. Is the dashboard application customizable? If so, how do I customize it? Is the source code to the dashboard application available? My understanding is that the dashboard application is expecting data packet stream of a certain format. So if I customize the data packer for a different format, I need to change the dashboard application correspondingly. In addition, I would like to customize the dashboard application with different controls, lights, knobs and graphs. I am trying to change dashboard application into a diagnostic tool.
Thanks.
__________________
Reply With Quote
  #5   Spotlight this post!  
Unread 16-03-2010, 16:31
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Enabling Default Dashboard in C++

Quote:
Originally Posted by mikets View Post
I haven't looked into the dashboard stuff in depth but I have a few questions myself. Is the dashboard application customizable? If so, how do I customize it? Is the source code to the dashboard application available?
The default dashboard is a LabVIEW application. You can create a new Dashboard project from the LabVIEW starting screen. You have full control over what it looks like and how it works.

If you don't already use LabVIEW, it will be a bit of a learning curve for you, but it's not particularly difficult.
Reply With Quote
  #6   Spotlight this post!  
Unread 16-03-2010, 16:39
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Enabling Default Dashboard in C++

To build on what Alan said, open up the dashboard example projects on both the Labview and C++ side. The packet that's filled in on the C++ side maps to the pink cluster on the left side of the Labview diagram. As long as you get them to match, you can change them to whatever you want. The next thing to do is to trace the pink line coming out of the data type. It leads to a block that converts the binary stream into data of that type. The output of that block is a cluster that you can use the unbundle by name block to get the data. My suggestion is to find where the unbundles are in the example and replace them with logic controls of your own. Once you get the hang of it and come up with a good way of packing your data, it's pretty easy.
Reply With Quote
  #7   Spotlight this post!  
Unread 16-03-2010, 19:18
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Enabling Default Dashboard in C++

Quote:
Originally Posted by Travis Hoffman View Post
I'm trying to get the default LabVIEW dashboard indicators to update (so I can then pursue some customizations). I'm using WindRiver C++. I'm borrowing our code template we used last season (shared online so it's rules-friendly, not that anyone would want to use it ). On the surface, I think I ported over the dashboard specific code from this year's template properly. I did get the dashboard to display the camera feed, but the IO status indicators are not updating. Can anyone set me down the right path? I use the IterativeRobot class.

Code:
 
//Stuff in .h file
 
#include"DashboardDataSender.h"
 
DashboardDataSender *dds;
Code:
 
//Stuff in .cpp file
 
#include"DashboardDataSender.h"
 
//Dashboard Data Sender
dds = new DashboardDataSender();
//Update Dashboard Data
dds->sendIOPortData();
Should I be calling the sendIOPortData() method in a specific location? Am I missing anything else?


Thanks,
The reason the indicators don't update is because the default code in C++ doesn't actually read the data. It just sends pre-set values. There are some blocks of commented-out code in DashboardDataSender.cpp that if are un-commented and the code mirroring them is commented, it should properly update the dashboard
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
Reply


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
Camera picture on Dashboard with default project code? neg0riz0r NI LabVIEW 2 18-02-2010 10:53
Camera working in C++ and default dashboard pafwl C/C++ 0 03-02-2010 22:06
Classmate Question: Default Path Location for Driver Dashboard Ziaholic FRC Control System 4 25-01-2010 13:56
Default Labview Dashboard and Windriver Example Help sircedric4 Programming 7 25-02-2009 01:58
Help with connecting default dashboard project mminutto NI LabVIEW 2 30-01-2009 15:26


All times are GMT -5. The time now is 15:18.

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