![]() |
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! |
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.
|
Re: Axis Camera to Dashboard
Okay, thanks. I'll try that tomorrow. (And I really need to have a mockup bot in my basement...)
|
Re: Axis Camera to Dashboard
Quote:
|
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. |
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;Code:
turnController.setSetpoint(gyroAngle + targets[0].getHorizontalAngle());Code:
PIDController turnController = new PIDController(.08, 0.0, 0.5, gyro, new PIDOutput() {EDIT: I know the targeting part probably won't end up in TeleOp, but for now it can stay. |
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. |
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)? |
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.
|
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.
|
| All times are GMT -5. The time now is 09:09. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi