Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   ZomB: a C# Drag and Drop Dashboard (http://www.chiefdelphi.com/forums/showthread.php?t=82612)

byteit101 13-02-2010 18:47

ZomB: a C# Drag and Drop Dashboard
 
2 Attachment(s)
Team 451 would like to share our ZomB Dashboard (Yes, you read that right, zombie) that we have been working on, and get some feedback. We have used this successfully for a few response testing, like ultrasonic (it looks good on a graph)

Pre-build controls: AnalogMeter, DataGraph(inspired by taskmanager), DirectionMeter, DistanceMeter, SpikeControl, RoundSpeedMeter, TacoMeter(Yes, it even has cheese), MessageDisplay, VarValue, OnOffControl, ColorFind(Totally misleading name, still testing)

There are 2 parts, the dashboard, and the robot files.
Requirements: Visual Studio 2008, .Net 2.0
Note: we use C++, but you can do this in java and LabView also, look at the bottom of this post for the format

The robot side files are ZDashboard.h and cpp, copy them into your project and add at the top of the main file #include "ZDashboard.h"
in your code, create a ZDashboard object , and initialize it.
Code:

class RobotDemo:public SimpleRobot
{
  //...
  ZDashboard ZomB;
public:
  RobotDemo():
      /* ... */ ZomB()
  {
      //...
  }
//...

Whenever you want to send some data to the dashboard, use the Add function, and then Send it off with the Send function
Code:

//...
void OperatorControl()
{
  while(IsOperatorControl())
  {
      ZomB.Add("controlName","controlValue");
      ZomB.Add("grph2",stick.GetY());
      ZomB.Send();
      Wait(0.02);
  }
}
//...

Now, Launch Visual Studio 2008 (express edition also works), and Open the Dashboard Solution, and open Form1 of the DefaultDash Project. Click on the control you want to have update, in our test case, the graph. Find the BindToInput and change it to what you specified in the code. Run both the Dashboard and the Robot and have fun!

Some notes:
THIS IS BETA!!! I am still working on bugs, the least tested feature is the VarValue control and the var and AddDebugVariable functions. please report any bugs
the .Net controls features are in the .Cat group. most have Max, Min, and Value.
DataGraphs cannot have a Min less that 0
Taco is pure fun
To see what each control does, open the test project (run it), click on a control, and move the slider at the top (EDIT: direction and analog meter barely move). onoff and spike are click state change, the thing in the lower right corner is a drag and drop sample, not related
to create a new Dashboard, make a new project, Reference System451.Communications.Dashboard.dll (in dash/System451.Communication.Dashboard/bin/Release folder), build the project. the controls will appear at the top of the toolbox, they are drag and drop. add 1 dashboardDataHub control. in the constructor (or a start button) add this code
Code:

dashboardDataHub1.AddDashboardControl(YourControls);
dashboardDataHub1.AddDashboardControl(AnotherControl);
dashboardDataHub1.StartRecieving();

It is Ready!

the Format of the strings, which can be Printf'd from the Dashboard class is
@@@451:|controlname=value|name=value|:451@@@

virtuald 14-02-2010 13:34

Re: ZomB: a C# Drag and Drop Dashboard
 
Looks shiny. I wrote some old-school looking analog meter controls for C# a few years ago, you might find it useful to use with your dashboard.

http://www.virtualroadside.com/blog/...for-c-and-net/

byteit101 05-03-2010 20:34

Re: ZomB: a C# Drag and Drop Dashboard
 
1 Attachment(s)
I added a camera feed to this today, complements of the dashboard here: http://www.chiefdelphi.com/forums/sh...ad.php?t=82422 . It still uses .net 2, so no need to update!
I have some bug fixes that I will post tommorow (some not on this computer), so for now, here is the CS files, and the dll

byteit101 06-03-2010 16:27

Re: ZomB: a C# Drag and Drop Dashboard
 
1 Attachment(s)
Here's the latest version, I would create a new project that references the dll, and add stuff like my original post explains, as the DefaultDash is a bit of a mess.

Changes from initial release:
Fixed multithreading bugs
Added CameraView
Added CSV DataSaver

Robototes2412 07-03-2010 19:38

Re: ZomB: a C# Drag and Drop Dashboard
 
Can I use this with Java?

byteit101 08-03-2010 15:50

Re: ZomB: a C# Drag and Drop Dashboard
 
EDIT: Java port posted at post #8

yes, I have not had a chance to port the robot side code (ZDashboard.cpp) yet, but it uses WPILib (and therefore also works with WPILibJ).

(functions may be slightly different for java, I am not a java expert (yet))
Instead of making a ZDashboard object, make a Dashboard object from Driverstation.GetInstance().GetHighPriorityDashboa rdPacker()
then, at the beginning of your code, create a string, and (either immediatly or when the value has been calculated) then assign it a string in the format of @@@451:|controlname=value|name=value|:451@@@
when you have built the string, use the dashboard object to Printf it

example:
Code:

string prints = "@@@451:|";
//code to calculate outputSpeed
prints+="out="+outputSpeed+"|";//name=value pipes (| above enter key on most keyboards, use shift) seperate values
yourDashboardObject.Printf(prints+":451@@@);//this fuction might be different for java


I will try to make a Java version of ZDashboard by this Friday. If you have any other questions, please ask

byteit101 08-03-2010 16:12

Re: ZomB: a C# Drag and Drop Dashboard
 
1 Attachment(s)
minor bug fix: mono compatible (not tested, but MoMA say's looks good)

byteit101 08-03-2010 16:41

Re: ZomB: a C# Drag and Drop Dashboard
 
1 Attachment(s)
Got a Java port, just add the attached ZDashboard.java to your project.
Code:

import edu.wpi.first.wpilibj.SimpleRobot;
import org.thecatattack.System451.Communication.ZDashboard;
public class RobotTemplate extends SimpleRobot {

  ZDashboard ZomB = new ZDashboard();

    /**
    * This function is called once each time the robot enters autonomous mode.
    */
    public void autonomous() {
        while (isAutonomous()) {
            ZomB.Add("controlname", "value");
            ZomB.Add("dataGraph", 0.6);
            ZomB.Send();
        }
    }

    /**
    * This function is called once each time the robot enters operator control.
    */
    public void operatorControl() {
    }
}


Robototes2412 08-03-2010 18:07

Re: ZomB: a C# Drag and Drop Dashboard
 
Thanks! it will work for our purposes :D

Robototes2412 08-03-2010 18:29

Re: ZomB: a C# Drag and Drop Dashboard
 
It wOnt compile, it says th dashboard packer is bad and so is the send function

edit:

The java library wont compile, it says getDashBoardPacker and send are bad calls

byteit101 08-03-2010 19:38

Re: ZomB: a C# Drag and Drop Dashboard
 
1 Attachment(s)
Quote:

Originally Posted by Robototes2412 (Post 933940)
It wOnt compile, it says th dashboard packer is bad and so is the send function

edit:

The java library wont compile, it says getDashBoardPacker and send are bad calls

oops! I didn't update WPILibJ!
Here it is fixed

Robototes2412 08-03-2010 19:43

Re: ZomB: a C# Drag and Drop Dashboard
 
It says that the string is too long

byteit101 08-03-2010 20:46

Re: ZomB: a C# Drag and Drop Dashboard
 
1 Attachment(s)
Quote:

Originally Posted by Robototes2412 (Post 933982)
It says that the string is too long

you only have a little more than 900 bytes, and if you have variable names that are to long and/or lots of variables, you will get this. does it work with 1 or 2 variables that have short names?


IMPORTANT UPDATE! - V0.3

This fixes a few bugs that were fixed with the Camera update, and lost with the mono fix (and adds the fixes to a few other new controls)
This also fixes the default Dashboard.
Adds configurable IP address for the camera, so you can actually see YOUR camera!
added some camera target options - send widthxheigth+x,y to target (ZomB.Add("Target","400x300+5,5");)
added Restart to camera
Added virtuald's AnalogMeter (VirtualdAnalogMeter)

I will probably have some more detailed documentation and how-to's out by Friday

Features that are coming:
Soon:
TCP instead of dashboard, but fallback available
virtuald's oscilliscope

Before week 6:
message splitting
a few more controls

eventually:
re-write of data hub for many params
better designer support
VS-less design mode (like slavik262's dashboard)

Robototes2412 08-03-2010 22:18

Re: ZomB: a C# Drag and Drop Dashboard
 
i just tried to send a motor value to the dashboard.

byteit101 09-03-2010 06:36

Re: ZomB: a C# Drag and Drop Dashboard
 
Quote:

Originally Posted by Robototes2412 (Post 934116)
i just tried to send a motor value to the dashboard.

and?

also make sure you are not sending every loop, you don't want to overload the dashboard (50Hz)

assuming you are running ZB on a different laptop, go to the driverstation setup tab, click on remote dashboard and enter the other laptop's IP

byteit101 20-03-2010 08:33

Re: ZomB: a C# Drag and Drop Dashboard
 
I have put this on WPI FIRST Forge: http://firstforge.wpi.edu/sf/projects/zombdashboard

the next version will be coming soon (need to test one feature and finish another)

byteit101 20-03-2010 19:58

Re: ZomB: a C# Drag and Drop Dashboard
 
Version 0.4 has been released on FIRST Forge: http://firstforge.wpi.edu/sf/go/page1029

byteit101 04-04-2010 12:37

Re: ZomB: a C# Drag and Drop Dashboard
 
1 Attachment(s)
ZomB Version 0.5 Released!
http://firstforge.wpi.edu/sf/sfmain/....zombdashboard

This version contains numerous new features and bug fixes

Notable new features
  • BluFinger - Bluetooth file transfer
  • DashboardDataHubForm - Manages everything automatically (even Driver mode)
  • Added a Exit/Restart/Restart DS button to avoid having to log out and in again to clear FMS Locked
  • Added PercentBar
  • Added AlertBar
  • Updated Default Dashboard
    • Video recording support (right click on Camera View) (WARNING: Large files may result)
    • Updated "See Names" button to show some help
  • Updated ZomB Eye - Video Viewer

Multiple bugs were fixed, you can read the release notes at http://firstforge.wpi.edu/sf/wiki/do...eleaseNotes0.5

Download

Everything - http://firstforge.wpi.edu/sf/frs/do/...able.v0_5?dl=1
Just ZomB Dashboard - http://firstforge.wpi.edu/sf/frs/do/...5/frs1115?dl=1
C++ Bindings - http://firstforge.wpi.edu/sf/frs/do/...5/frs1117?dl=1
Java Bindings - http://firstforge.wpi.edu/sf/frs/do/...5/frs1116?dl=1


Need Help?

Post on First Forge or here if you need help setting ZomB up, or you are having troubles with it. I will try to answer all questions as soon as possible

http://firstforge.wpi.edu/sf/discuss...iscussion.help

Robototes2412 08-04-2010 23:01

Re: ZomB: a C# Drag and Drop Dashboard
 
just to check, you can use ZomB with just m$ C# express 2008?

Damaku250 09-04-2010 15:56

Re: ZomB: a C# Drag and Drop Dashboard
 
Posting from a teammate's account here...

Anyway, I'm trying to use zomB, but I can't get the default zomB dashboard to update at all. For testing purposes I'm just trying to feed a value of 0.5 to grph and -0.5 to grph2 and nothing is coming up. I'm using Java. Yes, I've declared and instantiated a ZDashboard object (named zomB), and the zomB.Add()s and .Send() are in the teleop loop method. The dashboard is set to our team number and the driverstation is of course properly configured for our team.

byteit101 09-04-2010 20:18

Re: ZomB: a C# Drag and Drop Dashboard
 
Quote:

Originally Posted by Robototes2412 (Post 950543)
just to check, you can use ZomB with just m$ C# express 2008?

currently 2008 (Express and Pro) it is the only supported dev Enviroment (2010 should work though, as well as MonoDevelop. it DOES NOT work on Mac or linux though)

Quote:

Originally Posted by Damaku250 (Post 950972)
Posting from a teammate's account here...

Anyway, I'm trying to use zomB, but I can't get the default zomB dashboard to update at all. For testing purposes I'm just trying to feed a value of 0.5 to grph and -0.5 to grph2 and nothing is coming up. I'm using Java. Yes, I've declared and instantiated a ZDashboard object (named zomB), and the zomB.Add()s and .Send() are in the teleop loop method. The dashboard is set to our team number and the driverstation is of course properly configured for our team.

I won't have access to a robot for a while, so this could be hard.
the team number box on the dashboard is for the camera (so it shouldn't have any affect)

are you running ZomB on the classmate (if so what account) or on a remote computer?
your code looks like this correct?
Code:

void operatorControl()
{
//code
while (istelop)
{
//code
zomB.Add("grph", 0.55);//0.5 is on a line, 0.55 is above a line
zomB.Add("grph2", -0.5);
zomB.Send();
//code
}//end of while
}//end of operatorControl


Azores 09-04-2010 22:21

Re: ZomB: a C# Drag and Drop Dashboard
 
Well, rather than being a while loop for teleop, it's a method named teleperiodic that is looped while the DS is in teleop mode. Should be the same, right? Other than that the code does look the same.

And yes, it's on the Classmate. As for the 0.5 value being on a line, I also tried feeding the left joystick's Y value to the graph, and nothing showed up either when I tested that.

byteit101 10-04-2010 10:09

Re: ZomB: a C# Drag and Drop Dashboard
 
Quote:

Originally Posted by Azores (Post 951322)
Well, rather than being a while loop for teleop, it's a method named teleperiodic that is looped while the DS is in teleop mode. Should be the same, right? Other than that the code does look the same.

should work
Quote:

Originally Posted by Azores (Post 951322)
And yes, it's on the Classmate. As for the 0.5 value being on a line, I also tried feeding the left joystick's Y value to the graph, and nothing showed up either when I tested that.

In the DS, do you have the local Dashboard button checked? (under setup)

Azores 10-04-2010 12:28

Re: ZomB: a C# Drag and Drop Dashboard
 
Yes, local dashboard is checked.

byteit101 10-04-2010 13:28

Re: ZomB: a C# Drag and Drop Dashboard
 
1 Attachment(s)
Hmm, try the attached (put it all in C:\Program files\FRC Dashboard), and hit the start button near the bottom right.
also, try sending the string value (zomB.Add("grph", "0.5");)
if that does not work, download and install Visual Studio C# express 2008 from (http://www.microsoft.com/express/Dow...2008-Visual-CS)

Azores 10-04-2010 16:49

Re: ZomB: a C# Drag and Drop Dashboard
 
Still nothing on the graphs. I also tried using sw1 and sw2 and they aren't responding either. Visual Studio is installing right now.

byteit101 10-04-2010 17:54

Re: ZomB: a C# Drag and Drop Dashboard
 
Ok, while you're at it, install wireshark (http://www.wireshark.org/download.html), and make sure that the packets have the right data:
(do this while the robot is running, and sending "data")
open wireshark
go to Capture>Interfaces...
select your interface (wait to see the one that has incoming packets) by hitting the start next to it
in the Filter text box enter udp.dstport == 1165 and click apply
after some packets have come in, click one, and make sure it contains (look at the bottom box) @@@451:|grph=0.5|... (or something similar)
if you see this, you are good, and can close wireshark. if not, report back (and you can close wireshark for the moment)

Azores 10-04-2010 18:50

Re: ZomB: a C# Drag and Drop Dashboard
 
I'll see what I can do, but we had to pack up everything we could today for the trip down to Atlanta. I might be able to unbox the electrical board on Monday and work on it for a while though. Otherwise I'll have to try this in the pits on Wednesday...

byteit101 13-04-2010 17:33

Re: ZomB: a C# Drag and Drop Dashboard
 
actually, I might have just found the problem.
the first thing I want you to do is open ZDashboard.java, and find the line (near the bottom) that says dash.addString(prints + ":451@@@");
add dash.commit(); just after that. the end of the file will look like this:
Code:

...

  public  void var(String name, double value) {
        AddDebugVariable(name, String.valueOf(value));
    }

  public  void Send() {
        dash.addString(prints + ":451@@@");
        dash.commit();//Add this line
        prints = "@@@451:|";
    }
}

once you add this, recompile, redownload, and re-test. If it does not work, do what I said above (with wireshark)

byteit101 18-04-2010 15:34

Re: ZomB: a C# Drag and Drop Dashboard
 
@Azores: did you try it? did it work?

Azores 25-04-2010 22:30

Re: ZomB: a C# Drag and Drop Dashboard
 
Sorry for not checking back in so long :D

Anyway I didn't get any time to test anything out before packing up for Atlanta, and once we got there I really didn't have the time to be testing out the Dashboard :rolleyes:. But, our robot is on its way back to us, so once it gets in I'll be testing ZomB out, and hopefully we'll get to use it for next year!

Azores 13-05-2010 17:18

Re: ZomB: a C# Drag and Drop Dashboard
 
Good news, everyone! [/Farnsworth]

Finally got time to try and put ZomB back together. I now have the ZomB Dashboard reading data properly - graphs are giving me the values I want, switches are responding how they should - but it's very, very slow. Slow enough that the "Elapsed Time" counter in the Driver Station isn't counting consistently. I have the ZomB dashboard set to only update once every thousand CPU cycles right now - should it be a larger number?

Also, I remember reading this before but can't figure it out now, how do I have the Driver Station open the ZomB Dash by default? As it is the default NI/FRC dash opens when Driver Station is run (either by logging in to Driver or running it from Developer). I've replaced Dashboard.exe in C:\Program Files\FRC Dashboard with the ZomB Dashboard but the default one still opens instead. And I've replaced it and tried both leaving the ZomB dashboard named DefaultDash.exe and Dashboard.exe and either way the default opens instead. I thought I read something about changing a .ini or .txt file but I can't find which file that is now.

Update: Had to leave the shop at 6:00 today so I didn't get to do too much more testing, but besides being slow, the dashboard also rarely has camera feed (at all, it isn't just slow, it's just not there, or it will show a frozen frame). Still haven't figured out how to have ZomB open as the default dashboard. But I also noticed today that we're having the Watchdog Not Fed error again, which I had solved before our first regional. Not sure why it came back up between the robot leaving Atlanta and arriving here, so I'll have to take a look at the Classmate tomorrow and see what could be causing that (last time the solution was to change the power management settings and some stuff in the BIOS to do with power management and CPU speed). I think it's very possible that the camera not feeding, the slow performance and the Watchdog error might all have a common source.

But other than that, ZomB is working fine now. I have spk1, spk2, sw1 and sw2 showing solenoid statuses for testing purposes, and grph1 and grph2 showing joystick Y values, "right" showing whether our compressor is running, "go" showing which mode autonomous is set to... and everything is behaving relatively properly :D.

Radical Pi 13-05-2010 23:53

Re: ZomB: a C# Drag and Drop Dashboard
 
To change the dashboard: There is a .ini file in one of the User folders (will say DS or Driver Station I think). In it there is a key that points to the normal Dashboard. Just change that and it should open your's. Also, make sure you have protections against multiple instances opening of your dashboard (for some reason the DS opens Dashboard twice)

Azores 14-05-2010 11:29

Re: ZomB: a C# Drag and Drop Dashboard
 
Yea, I read about the anti-multi-instance-Dashboard solutions and I'll be sure to do that as well.

So in one of the User folders, as in under My Documents? I don't have the Classmate available to me right now so I can't go exploring for it :p

byteit101 14-05-2010 15:07

Re: ZomB: a C# Drag and Drop Dashboard
 
The ZomB has automatic instance protection

Renaming the DefaultDash.exe to Dashboard.exe and putting it in the C:\Program files\FRC Dashboard\ folder did the trick for us, you might want to move the first dashboard out, and then put the ZomB in.

As for the slowness, was it slow with updating the graphs/controls? (ie. push a button, wait a second, shows up) or just with mouse/keyboard feedback (ie. move mouse over button, wait one second, ui cues show up)
I have noticed the mouse/keyboard feedback lag increases in driver mode for both the ZomB and the DS by about 1 second every 3 hours, which needs a full reboot to cure. (I don't think it took you 3 hours, but you still might have this problem)

for the delay (on the robot side) if you are just testing, use Thread.Sleep(20) to get maximum throughput
Code:

while(istelop())//?
{
//calculate
zomB.Add("spk1",0);
//etc...
zomB.Send();
Thread.sleep(20);
}

otherwise, use a timer (pseudo code)
Code:

Timer t
t.start()
while telop
{
...
if t.Get()>=0.02
{
t.reset()
zomB.add(...)
zomB.send()
}
...
}

As for the camera, click the "reset camera" button and wait 2-5 seconds. If it does not show up after 10 seconds, click it again (make sure the camera the camera is initialized, ~10 seconds after the camera ring turns green)
(also make sure you have a camera instance in your code)

You say it worked with the dash.commit() line?

EDIT: BTW, have you seen the awesomeness of the taco yet? (its a -1 to 1 float value) (full documentation on its awesomeness: http://firstforge.wpi.edu/sf/wiki/do...wiki/TacoMeter)

Azores 14-05-2010 15:53

Re: ZomB: a C# Drag and Drop Dashboard
 
It was slow as in the Dashboard had a lag to it - for example the spk and sw indicators that I set to show solenoid statuses would be a few seconds delayed in showing the status changes. The UI cues though came up quickly enough.

I found the .ini file and edited the line pointing to the Dashboard and it now opens ZomB by default, so that problem is solved.

I'm just about to put in the timer to update ZomB now, I'll edit this post later after I get to test it.

EDIT: Oh, and yes I believe it was dash.commit(); that fixed it. I don't recall making any other changes before it started working. And I haven't tried using the Tacometer yet, but I'll find a use for it :p

byteit101 14-05-2010 20:33

Re: ZomB: a C# Drag and Drop Dashboard
 
The only things that I can think of that would be causing the delay would be network traffic, or (kinda doubt it) slowness in sending the data. I know running at comps and wired and wireless at home I have seen little delay. Not sure what your issue is though

Azores 14-05-2010 20:37

Re: ZomB: a C# Drag and Drop Dashboard
 
Yea it's weird, the lag only showed up after we got back from ATL, so I'm trying to figure out what's happening. It's more pronounced when running ZomB it seems but it's still present when running the default Dashboard. We ran a disk cleanup and defrag today though as well as removing some less necessary programs we had installed, so perhaps that will help it out. We also reformatted and reimaged the cRIO. If all that doesn't help then I won't know what to do next :D.

Oh, and I don't think it's network issues, because I'm doing these tests through tethered ethernet haha.

Greg McKaskle 14-05-2010 20:54

Re: ZomB: a C# Drag and Drop Dashboard
 
You may want to open the Task manager and see what the CPU load is ... both when running the DS and DB, and when running nothing. I've sometimes seen the classmate successfully connect to the wireless network and the update programs phone home and try to determine which virus scanner, OS patch, etc are needed. The task manager should show what the computer is up to.

Greg McKaskle

Azores 14-05-2010 21:01

Re: ZomB: a C# Drag and Drop Dashboard
 
CPU load seemed normal and I didn't note any unfamiliar running processes when I checked, but then again I wasn't constantly monitoring it... if the lag hasn't been resolved tomorrow morning I'll take a look at that too of course. Thanks.


All times are GMT -5. The time now is 21:33.

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