Go to Post You all have made me think about this in a new way - which I appreciate. - aaeamdar [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-12-2012, 01:20 PM
2526 2526 is offline
Crimson Robotics
FRC #2526 (Crimson Robotics)
Team Role: Teacher
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Maple Grove Senior High
Posts: 10
2526 is an unknown quantity at this point
unable to compile camera code

After searching forums and docs we are still unable to build the code taken from the WPI user guide. I am using Netbeans, have plugins installed, and installed smartdashboard. I am trying to compile following code from user guide:

package com.crimsonrobotics;

import edu.wpi.first.smartdashboard.camera.WPICameraExten sion;
import edu.wpi.first.wpijavacv.WPIColorImage;
import edu.wpi.first.wpijavacv.WPIImage;

/**
*
* @author
* Wayne
*/
public class BasicCameraExtension extends WPICameraExtension {
//@Override
public WPIImage processImage(WPIColorImage rawImage) {
return rawImage.getRedChannel();
}
}

here are errors I get:

C:\Users\Wayne\Documents\NetBeansProjects\Team2526 Version5\src\com\crimsonrobotics\BasicCameraExtens ion.java:7: package edu.wpi.first.smartdashboard.camera does not exist
import edu.wpi.first.smartdashboard.camera.WPICameraExten sion;
C:\Users\Wayne\Documents\NetBeansProjects\Team2526 Version5\src\com\crimsonrobotics\BasicCameraExtens ion.java:8: package edu.wpi.first.wpijavacv does not exist
import edu.wpi.first.wpijavacv.WPIColorImage;
C:\Users\Wayne\Documents\NetBeansProjects\Team2526 Version5\src\com\crimsonrobotics\BasicCameraExtens ion.java:9: package edu.wpi.first.wpijavacv does not exist
import edu.wpi.first.wpijavacv.WPIImage;
C:\Users\Wayne\Documents\NetBeansProjects\Team2526 Version5\src\com\crimsonrobotics\BasicCameraExtens ion.java:16: cannot find symbol
symbol: class WPICameraExtension
public class BasicCameraExtension extends WPICameraExtension {
C:\Users\Wayne\Documents\NetBeansProjects\Team2526 Version5\src\com\crimsonrobotics\BasicCameraExtens ion.java:18: cannot find symbol
symbol : class WPIColorImage
location: class com.crimsonrobotics.BasicCameraExtension
public WPIImage processImage(WPIColorImage rawImage) {
C:\Users\Wayne\Documents\NetBeansProjects\Team2526 Version5\src\com\crimsonrobotics\BasicCameraExtens ion.java:18: cannot find symbol
symbol : class WPIImage
location: class com.crimsonrobotics.BasicCameraExtension
public WPIImage processImage(WPIColorImage rawImage) {
6 errors
C:\Users\Wayne\sunspotfrcsdk\ant\compile.xml:48: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)

Once we get past this we can be on our way. Any sugestions? I tried to add jars in all places I could to no avail.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-13-2012, 08:56 AM
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 102
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: unable to compile camera code

I'm guessing that you haven't added the SmartDashboard JAR files to your NetBeans project. Here are my suggestions:
  • Right click on your project in the NetBeans project browser (left side navigation) and select properties
  • Select the "Libraries" category
  • Click on the "Add Library" button, then click the "Create" button and add a library named "SmartDashboard"
  • You will then be asked to add a collection of JAR files to include in the library.
  • Click the "Add JAR/Folder" button, and the SmartDashboard.jar file (look under "C:\Program Files\SmartDashboard").
  • Click the "Add JAR/Folder" button, and the WPICameraExtension.jar file (look under "C:\Program Files\SmartDashboard\extensions").
  • Click the "Add JAR/Folder" button, and the javacpp.jar file (look under "C:\Program Files\SmartDashboard\extensions\lib").
  • Click the "Add JAR/Folder" button, and the javacv-windows-x86.jar file (look under "C:\Program Files\SmartDashboard\extensions\lib").
  • Click the "Add JAR/Folder" button, and the javacv.jar file (look under "C:\Program Files\SmartDashboard\extensions\lib").
  • Click the "Add JAR/Folder" button, and the WPIJavaCV.jar file (look under "C:\Program Files\SmartDashboard\extensions\lib").

This should include all of the JAR files necessary to work on SmartDashboard plugins and driver station side image processing.

If you decide to create additional SmartDashboard projects, you should just be able to select the new "SmartDashboard" library we created above (you won't have to add all of the JAR files again).

NOTE: We ran across a memory leak in the WPIJavaCV.jar file that causes the system to run out of memory and crash after processing too many images. There was a fix - but I'm not sure it's been pushed out. If you find your program crashing, use Window's Task Manager to observe it when running and see if it consumes a lot of memory when running. If so, you may want to refer to this post:

http://www.chiefdelphi.com/forums/sh...67&postcount=6

It has a unofficial replacement for the WPIJavaCV.jar file which was built from the updated source files at the SmartDashboard project.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-13-2012, 07:39 PM
2526 2526 is offline
Crimson Robotics
FRC #2526 (Crimson Robotics)
Team Role: Teacher
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Maple Grove Senior High
Posts: 10
2526 is an unknown quantity at this point
Re: unable to compile camera code

Our code is based on the command Base template and when you right click on the project in the left pane libraries is not an option. Is this because it is a freeform project? Does the camera code go in as another class in this project? I am trying to follow the user guide and we are stuck at this point any help appreciated. If others are doing it this way then somewhere along the line we missed something.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-14-2012, 10:20 AM
nickpeq nickpeq is offline
Turing-complete
FRC #1255 (Blarglefish)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Baytown, TX
Posts: 60
nickpeq is an unknown quantity at this point
Re: unable to compile camera code

Quote:
Originally Posted by 2526 View Post
Our code is based on the command Base template and when you right click on the project in the left pane libraries is not an option. Is this because it is a freeform project? Does the camera code go in as another class in this project? I am trying to follow the user guide and we are stuck at this point any help appreciated. If others are doing it this way then somewhere along the line we missed something.
You can't create a SmartDashboard extension in the same project that you create robot code. (as far as I know)
You must create the project as a Java Class Library so that you can compile it as a .jar extension.
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


All times are GMT -5. The time now is 09:01 AM.

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