OCCRA
Go to Post Excuse me while I rant on your comment here a bit. - Andrew Remmers [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Events   CD-Media   CD-Spy   FRC-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 02-11-2010, 05:16 PM
EthanMiller EthanMiller is offline
Lead Programmer
AKA: Socks
FTC #4356 (The Zip Ties)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Clayton, NY
Posts: 121
EthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura about
Axis Camera to Dashboard

I'm fairly new to programming, and I'm my team's only programmer, with no mentors knowing any programming. So far I've been able to piece together some Java, but the camera is beyond me.

I've looked at the Javadocs for the Axis camera, and the Circle Tracker demo, but I really don't understand how it works. If anyone could explain that, and how to implement it (at least to the effect of outputting camera to the dashboard) and the basic idea of image processing, I would be really grateful.

Thanks!
__________________
When all else fails, read the manual.

FRC 1713 K Island Gears 2009, 2010 (Not 2011 due to budget, hopefully 2012!) - Fingerlakes Regional

FTC 4356 The Zip Ties 2010-2011 Season - NNYRC (2010 9th seed).
Reply With Quote
  #2   Spotlight this post!  
Unread 02-11-2010, 09:09 PM
Lord_Jeremy's Avatar
Lord_Jeremy Lord_Jeremy is offline
Lord_Jeremy the Procrastinator
AKA: Jeremy Agostino
FRC #1546 (Chaos Inc.)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Baldwin, New York
Posts: 45
Lord_Jeremy is an unknown quantity at this point
Send a message via ICQ to Lord_Jeremy Send a message via AIM to Lord_Jeremy Send a message via MSN to Lord_Jeremy Send a message via Yahoo to Lord_Jeremy
Re: Axis Camera to Dashboard

Hey. Theoretically the camera should just show up on the dashboard when you call AxisCamera.getInstance(). At least, that's what I've read. You can see how it's done in the CircleTrackerDemo example code that's supplied in netbeans. Unfortunately, neither the example code nor a routine I've written seems to be written seems to be working for my team, we're investigating possible solutions. Anyway, I'm proficient in Java so if you need any help getting anything else working let me know.
__________________
Compiling...
Compiling...
Reply With Quote
  #3   Spotlight this post!  
Unread 02-11-2010, 09:12 PM
EthanMiller EthanMiller is offline
Lead Programmer
AKA: Socks
FTC #4356 (The Zip Ties)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Clayton, NY
Posts: 121
EthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura about
Re: Axis Camera to Dashboard

Okay, thanks. I'll try that tomorrow. (And I really need to have a mockup bot in my basement...)
__________________
When all else fails, read the manual.

FRC 1713 K Island Gears 2009, 2010 (Not 2011 due to budget, hopefully 2012!) - Fingerlakes Regional

FTC 4356 The Zip Ties 2010-2011 Season - NNYRC (2010 9th seed).
Reply With Quote
  #4   Spotlight this post!  
Unread 02-11-2010, 09:17 PM
Lord_Jeremy's Avatar
Lord_Jeremy Lord_Jeremy is offline
Lord_Jeremy the Procrastinator
AKA: Jeremy Agostino
FRC #1546 (Chaos Inc.)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Baldwin, New York
Posts: 45
Lord_Jeremy is an unknown quantity at this point
Send a message via ICQ to Lord_Jeremy Send a message via AIM to Lord_Jeremy Send a message via MSN to Lord_Jeremy Send a message via Yahoo to Lord_Jeremy
Re: Axis Camera to Dashboard

Quote:
Originally Posted by EthanMiller View Post
(And I really need to have a mockup bot in my basement...)
Tell me about it. I've written around 1500 lines of code that I have no way to test because the robot is yet to be wired.
__________________
Compiling...
Compiling...
Reply With Quote
  #5   Spotlight this post!  
Unread 02-11-2010, 09:44 PM
synth3tk's Avatar
synth3tk synth3tk is offline
The Voice
AKA: David Thomas
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Ohio
Posts: 1,933
synth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond repute
Send a message via Skype™ to synth3tk
Re: Axis Camera to Dashboard

What I just did was just customizing a copy of the sample CircleTrackerDemo to include our other functions, since the camera code took up most of the coding. That's probably not the most efficient way, but it works for us.

Let us know what you find, though, since I'd love to shave off a few lines by using the minimal amount of code required.
__________________
Quote:
The difference between theory and application is that in theory, theory and application are the same; In application, they are not.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-12-2010, 03:58 PM
EthanMiller EthanMiller is offline
Lead Programmer
AKA: Socks
FTC #4356 (The Zip Ties)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Clayton, NY
Posts: 121
EthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura about
Re: Axis Camera to Dashboard

Well, having done some extensive tracing and finally copying the Target.java and the TrackerDashboard.java files to my project, then copying the following code into the Teleop section:

Code:
ColorImage image = null;
try {
       if (cam.freshImage()) {
       image = cam.getImage();
       Thread.yield();
       Target[] targets = Target.findCircularTargets(image);
       Thread.yield();
        if (targets.length == 0 || targets[0].m_score < kScoreThreshold) {
             System.out.println("No target found");
             Target[] newTargets = new Target[targets.length + 1];
             newTargets[0] = new Target();
             newTargets[0].m_majorRadius = 0;
             newTargets[0].m_minorRadius = 0;
             newTargets[0].m_score = 0;
             for (int i = 0; i < targets.length; i++) {
                   newTargets[i + 1] = targets[i];
             }
             trackerDashboard.updateVisionDashboard(0.0, gyro.getAngle(), 0.0, 0.0, newTargets);
             } else {
             System.out.println(targets[0]);
             System.out.println("Target Angle: " + targets[0].getHorizontalAngle());
             turnController.setSetpoint(gyroAngle + targets[0].getHorizontalAngle());
             trackerDashboard.updateVisionDashboard(0.0, gyro.getAngle(), 0.0, targets[0].m_xPos / targets[0].m_xMax, targets);
              }
      }
} catch (NIVisionException ex) {
       ex.printStackTrace();
} catch (AxisCameraException ex) {
       ex.printStackTrace();
} finally {
    try {
         if (image != null) {
         image.free();
         }
    } catch (NIVisionException ex) {
}
I've gone through and figured out (mostly) what this code does, but I don't understand what the line
Code:
turnController.setSetpoint(gyroAngle + targets[0].getHorizontalAngle());
does. In the original file, turnController is:
Code:
PIDController turnController = new PIDController(.08, 0.0, 0.5, gyro, new PIDOutput() {

        public void pidWrite(double output) {
            drive.arcadeDrive(0, output);
        }
    }, .005);
but I have no clue what PIDController does. Any help?

EDIT: I know the targeting part probably won't end up in TeleOp, but for now it can stay.
__________________
When all else fails, read the manual.

FRC 1713 K Island Gears 2009, 2010 (Not 2011 due to budget, hopefully 2012!) - Fingerlakes Regional

FTC 4356 The Zip Ties 2010-2011 Season - NNYRC (2010 9th seed).

Last edited by EthanMiller : 02-12-2010 at 04:23 PM. Reason: Addendum
Reply With Quote
  #7   Spotlight this post!  
Unread 02-12-2010, 06:55 PM
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Itinerant Programmer
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 7,398
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Axis Camera to Dashboard

turnController drives the robot to point it directly at the target using the gyro angle.

The PIDController is designed to slow the robot turn down as it approaches the target gyro angle. Those values (.08, 0.0, 0.5) are coefficients that must match your robot's turning characteristics, so plan to adjust those when you get a real robot to practice with.

The gyro angle was calculated from the camera image by the offset of the target from the center line.
__________________
Deduction is limited by knowledge, and knowledge is limited by preconceptions
358 Beta notes & results
Reply With Quote
  #8   Spotlight this post!  
Unread 02-13-2010, 10:47 AM
EthanMiller EthanMiller is offline
Lead Programmer
AKA: Socks
FTC #4356 (The Zip Ties)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Clayton, NY
Posts: 121
EthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura about
Re: Axis Camera to Dashboard

Okay, thanks.

Let me make sure I got that straight - I'd be able to use that code in autonomous to point towards the target.

If that's the case, how would I make it tell the next part that it's pointing at the target to shoot (Ignoring getting a ball for now)?
__________________
When all else fails, read the manual.

FRC 1713 K Island Gears 2009, 2010 (Not 2011 due to budget, hopefully 2012!) - Fingerlakes Regional

FTC 4356 The Zip Ties 2010-2011 Season - NNYRC (2010 9th seed).
Reply With Quote
  #9   Spotlight this post!  
Unread 02-13-2010, 01:50 PM
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Itinerant Programmer
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 7,398
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Axis Camera to Dashboard

You'll be pointed at the target when targets[0].getHorizontalAngle() gets small. You'll have to pick your tolerance, e.g., +/- 1 degree, and test for it.
__________________
Deduction is limited by knowledge, and knowledge is limited by preconceptions
358 Beta notes & results
Reply With Quote
  #10   Spotlight this post!  
Unread 02-14-2010, 12:34 AM
EthanMiller EthanMiller is offline
Lead Programmer
AKA: Socks
FTC #4356 (The Zip Ties)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Clayton, NY
Posts: 121
EthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura about
Re: Axis Camera to Dashboard

Ok, thanks. If I need more help, I'll post it, but I think I've got the gist of this.
__________________
When all else fails, read the manual.

FRC 1713 K Island Gears 2009, 2010 (Not 2011 due to budget, hopefully 2012!) - Fingerlakes Regional

FTC 4356 The Zip Ties 2010-2011 Season - NNYRC (2010 9th seed).
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
2010 Axis Camera Dashboard Problems Kohala2460 General Forum 0 02-04-2010 01:34 PM
2010 Axis Camera Dashboard Problems JesterKarrde Programming 12 02-04-2010 01:11 PM
Java/Netbeans Camera Code for Classmate PC and Axis Camera joshholat Programming 1 01-23-2010 02:59 PM
Dashboard and Robot main with Axis camera Team2883 General Forum 9 01-10-2009 07:35 AM
AXIS Camera nickmagus Programming 1 01-03-2009 08:06 PM


All times are GMT -5. The time now is 02:57 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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