Go to Post "What connection is the most vital to the success of your robot?" The one between the drivers brain and hands, and the one between the coaches brain and mouth. None of the other ones matter if those two don't work. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 16-02-2011, 19:41
timothyb89 timothyb89 is offline
code monkey
FRC #1977 (Loveland High Robotics)
Team Role: Alumni
 
Join Date: Oct 2008
Rookie Year: 2009
Location: Loveland, Colorado
Posts: 45
timothyb89 will become famous soon enough
Tweaked SmartDashboard for Image Overlays

We've been playing around with the SmartDashboard code to add support for image overlays to help debug vision code. It's somewhat basic at the moment, and we're planning on improving it, but what's there is already a huge help. Essentially, it allows you to send a list of targets back over the SmartDashboard connection that are rendered onto the camera image.

Right now it just draws black bounding boxes around the targets sent back, but we're planning on allowing you to specify colors and shapes to help differentiate the targets. It's also a little bit hacky and likes to display a couple of extra fields on the dashboard, but the "__overlay" fields can be shoved into a corner without causing any problems.

I'm a lazy programmer, so the modifications don't have a C++ counterpart, and I haven't sent a patch to the SmartDashboard guys, although that's something I'd like to do in the near future.

Anyway, if anyone wants to give it a go, just do a subversion checkout:
Code:
https://lhrobotics.svn.sourceforge.net/svnroot/lhrobotics/trunk/sdbmod/
It's a NetBeans project, so just open it (or check it out from svn directly within netbeans) and hit the run button. That's the only setup for the client side.

As for the robot, you'll need to grab this file (also svn, but just grabbing it works fine too -- it's just one file). In the source folder for your robot code, make the folder structure edu -> wpi -> first -> wpilibj, and place the ModdedSmartDashboard.java there.

The only major change needed to robot code is to make sure you use the "ModdedSmartDashboard" class in place of "SmartDashboard" - using both (even in different parts of your code) will probably cause problems. Then, wherever you can get access to a ParticleAnalysisReport or something with target x/y/width/height, add:
Code:
ModdedSmartDashboard.startOverlay(); // do this before sending new targets to clear any old target overlays

ParticleAnalysisReport r; // get this from somewhere or use your own data
ModdedSmartDashboard.overlay(r.center_mass_x, r.center_mass_y, r.boundingRectWidth, r.boundingRectHeight);
If you don't use this bit of the NI Vision libs, make sure to use center x/y coordinates rather than the usual top-left. They're automatically converted to normal display coordinates on the client.

Anyway, hopefully somebody out there can find this useful!
__________________
FRC-DB: A detailed, web-based scouting database for FRC teams with lots of interesting statistics.
Reply With Quote
 


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


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

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