[EDIT]
More than one person has asked for the source code. I need to finish putting together a guide to create new dashboard views first, but will make the source available sometime this week. My hope is that people who choose to use the software will add functionality by creating and sharing views that can be imported into the application. I’m also aware that there are many open source advocates and linux users in this community, but I chose this platform because it was the fastest means to an end because these are the tools that I use professionally. Now that Microsoft is giving away the IDE the tools are free, but Windows is still a requirement.
[/EDIT]
Attached to this post is a guide for creating custom views for use with this dashboard application. If you create custom controls that other teams may find useful I encourage you to make them available.
You can download the C# solution files from the URL below. Please do not redistribute the source with or without modification.
This is in response to a few private messages and emails I’ve received. I made the source available, but the whole point of this application is that you don’t need to modify the source code to add custom views. You really don’t have to know anything about the dashboard data at all. You only need to follow the instructions in the previous post to create a new user control and add UI elements to display the data. There are a few custom dashboardy (thats a technical term) widgets included, including a sliding bar, LED, CMU camera FOV, and last year’s field.
The dashboard views are just user controls that inherit from a base class in the FRC.Dashboard.Typelib assembly. The base class inherits from UserControl, but adds methods that are used as callbacks to notify your control when new dashboard packets are available. The dashboard application loads the controls at runtime and lays them out on tabs in the UI. When a new packet is received it calls the appropriate callback on control loaded in the active tab. When a packet of type data frame1 is received and parsed it will call ShowDataFrame1() on the active view control. Its pretty simple when you dig into the code, but the architecture allows you to extend the functionality without modifying the original source code.
[EDIT]
I forgot to mention that you can use any CLR 2.0 compatible language (C#, VB.NET, or Managed C++) to build custom dashboard views. The step are the same, but the syntax depends on the language. VB.NET 2005 Express Edition is available here: http://msdn.microsoft.com/vstudio/express/vb/default.aspx. I haven’t used it and I’m not familiar with the syntax differences.
[/EDIT]
First of all, let me genuflect to you (and this something I rarely do). Your post is a wonderful example of structured code in a Windows environment.
I did, however, notice an error today. The Team Number was not displaying.
I believe that the root cause might be here (from DataFrameBase.cs):
//control byte breakdowns
public int Team_Number { get { return ((data[iCTRL_A] & 0x0F) << 8) & data[iCTRL_B]; }}
public int Channel_Number { get { return (data[iCTRL_C] & 0x3F); }}
I think that the bitwise AND of CTRL_B and the masked CTRL_A should be an addition or a bitwise OR.
I might be off base on this… I’m more of an embedded oriented engineer.
There is an error in the type library that will cause team numbers to be incorrect. Attached is a patch to correct problem. Thanks to Mike Betts for not only finding the problem, but proposing the correct solution. Unzip the two dll’s in the attachment and drop them into the folder with FRCDashboard.exe.
The controls assembly is included because I added a widget to display the robot’s heading. Its very simple, looks sort of like a compass. The UpdateHeading() method does exactly what you’d think.
Do you think you can release the source for the patch? My team has been working on the dashboard and the new update source code should be helpful.
I am also recieving “Cross-Thread Operation Not Valid” error messages when I run the main application. Has anyone else experienced this? Do you have a proposed solution?
Attached is the DLL for the old version of the dashboard with the team number fix applied, for those of us with old views that we don’t want to reprogram
EDIT: I found an error that is probably common to both dashboards. iCTRL_B is defined as byte 10 in the dashboards, but the specification (and in real life) says it should be byte 9. I have uploaded the doubly corrected file for the older version, but do not have the tools to correct the newer version.
The 2008 Control Library has a few .NET 2.0 dashboard controls. All controls are updated using the Value property. The controls will render themselves to fill space provided. If the size is invalid it may display an exception in the designer. You can clear the exception in the designer by resizing the control to valid dimensions and reopening the designer. The compass will always render as a square and the gyro will render as a rectangle with 2:1 aspect ratio.
CompassControl - displays a heading value. Use the MinValue and MaxValue properties to set the upper and lower bounds. Use ArrowDirection to adjust for clockwise/counter-clockwise rotation (value is 1 or -1). Use ArrowOffset property to adjust where the min value is rendered.
PwmControl - displays PWM value as a double-headed arrow.
GyroControl - displays an analog value that has a zero value centered in the total range. Use the MinValue and MaxValue properties to set the range displayed.
RangeControl - displays range information. Use the Invert property to display the inverse depending on the sensor being used. Use the MinValue and MaxValue properties to set the range.