Go to Post No, nothing secret unless you include the following: will it work?, can it be driven and will it release the balls. - twolf [more]
Home
Go Back   Chief Delphi > CD-Media > White Papers
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

photos

papers

everything



.NET (2.0) Composite Dashboard Viewer

By: seanwitte
New: 22-01-2006 15:50
Updated: 07-02-2008 23:49
Total downloads: 1132 times


This application provides a framework for creating custom views of the data provided by the dashboard port on the IFI operator interface. The default views include a widget that displays the centroid and bounding box of the CMUCamII camera and a view that allows you to record and playback motor outp...

This application provides a framework for creating custom views of the data provided by the dashboard port on the IFI operator interface. The default views include a widget that displays the centroid and bounding box of the CMUCamII camera and a view that allows you to record and playback motor outputs.

Views are standard windows user controls that inherit from the class FRC.Dashboard.DashboardView in the FRC.Dashboard.Typelib.dll assembly. By overriding the virtual methods (ShowDataFrameIO(), ShowDataFrame1(), ShowDataFrame2(), ShowDataFrame3()) you can display the data however you want without dealing with the serial port decoding. If you create a custom view, just compile the DLL and copy it to the same folder as the dashboard viewer exe. The Views->Import menu will display any implementations of DashboardView in the same folder and allow you to import them. The tab text and order is defined in DashboardTabs.xml.

The camera data maps to the dashboard packet as follows:
user_byte1 = x
user_byte2 = y
user_byte3 = x1
user_byte4 = y1
user_byte5 = x2
user_byte6 = y2

It also includes a UDP packet relay so you can forward the incoming data stream to one other PC. You can view the data on two PCs at the same time.

The primary reason for upgrading to version 2.0 of the .NET framework is that the C# 2005 Express Edition is free. It also includes native serial port support in the System.IO.Ports namespace. No more win32 interop.

Version 2.0 of the .NET Framework can be downloaded here:
http://www.microsoft.com/downloads/...&DisplayLang=en

Visual C# 2005 Express Edition is FREE until November 2006. They're also giving away the MSDN library documentation and SQL Server 2005 desktop edition. It can be downloaded here:
http://msdn.microsoft.com/vstudio/express/visualcsharp/

Attached Files

  • zip .NET (2.0) Composite Dashboard Viewer

    1137963040dashboard2006.zip

    downloaddownload file

    uploaded: 22-01-2006 15:50
    filetype: zip
    filesize: 555.96kb
    downloads: 494


  • zip Source (C#, 2.0 CLR)

    FRC.Dashboard_Source.zip

    downloaddownload file

    uploaded: 12-02-2007 16:29
    filetype: zip
    filesize: 325.66kb
    downloads: 372


  • zip 2008 Control Library

    SRWitte.FRC.Dashboard.Controls.zip

    downloaddownload file

    uploaded: 07-02-2008 23:49
    filetype: zip
    filesize: 5.31kb
    downloads: 264



Recent Downloaders

Discussion

view entire thread

Reply

31-01-2006 07:30

seanwitte


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

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.

http://members.cox.net/seanwitte/FRC...ard_Source.zip



31-01-2006 11:31

seanwitte


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

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/ex...b/default.aspx. I haven't used it and I'm not familiar with the syntax differences.
[/EDIT]



04-02-2006 20:45

Mike Betts


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

Sean,

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):

Code:
//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.

Your thoughts kind Sir?

Respectfully,

Mike



05-02-2006 15:51

seanwitte


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

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.



11-02-2006 11:13

cjelly


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

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?

Thank You,

Chris



11-02-2006 13:26

seanwitte


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

Quote:
Originally Posted by cjelly
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.
If you're already working with the source, the only change is to replace line 55 in DataFrameBase.cs in the typelib project with the following:

public int Team_Number { get { return ((data[iCTRL_A] & 0x0F) << 8) | data[iCTRL_B]; }}

I updated the source linked earlier in the thread as well if you want a fresh copy.

Quote:
Originally Posted by cjelly
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?
Sorry, this I have not seen. Have you changed anything?



16-02-2006 02:27

Eldarion


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

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.



12-02-2007 16:24

seanwitte


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

I added the source code to the whitepaper record.



08-02-2008 00:15

seanwitte


Unread Re: White Paper Discuss: .NET (2.0) Composite Dashboard Viewer

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.

1) 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.

2) PwmControl - displays PWM value as a double-headed arrow.

3) 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.

4) 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.



view entire thread

Reply

Tags

loading ...



All times are GMT -5. The time now is 22:38.

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