Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   We have some things working with java, if you need help look here (http://www.chiefdelphi.com/forums/showthread.php?t=82106)

mark.amber 07-02-2010 12:53

We have some things working with java, if you need help look here
 
Quote:

I am creating this thread because we needed some help getting all the things working on the robot.
We are using the following computer systems for programming in JAVA:
  • Ubuntu 64 bit, running netbeans 6.8 successfully (Ubuntu 9.10)
  • Ubuntu 32 bit, running netbeans 6.8 successfully (Ubuntu 9.10)
  • Windows Vista, running netbeans 6.8 successfully

Classmate PC running:
  • Netbeans 6.7.1. we do not use netbeans on the classmate
  • Updated driver station with compass in bottom right.
  • Recieving feed of camera from cRIO.
  • Working comunication.

The cRIO:
  • Using Victors.
  • Connected to camera, seems to run the default circle detection code, follows circles with this code.
  • Connected to a WGA600N Gaming adapter, connected to our local network, all Computers listed can download to it.
  • Working Gyro for compensating for the orientation of the robot.
  • Working Servo for adjusting camera angle.

Code contains working sections for:
  • HolonomicDrive: setup so no matter what direction the robot is heading, it will respond to the joystick the same (using mecnum wheels)
  • Controls camera position on servo using a throttle on Attack3 Joystick.
  • Using iterativerobot class
  • Using multiple methods, so the code is segmented, and easier to debug
  • Debug output to Netbeans working.

Procedures we know
  • We know the procedure to download code to the cRIO from Netbeans (complicated).
  • We know how to flash the cRIO with the latest image.
  • We know how to setup the Axis camera, for use on the cRIO.
  • We know how to use the Vision Assistant 2009 to test out different filters.
  • We know how to install the latest updates for driver station (complicated).


Quote:

Just respond to this thread if you want to know how to do one of these things, just quote it, and tell any relevant information.

sunit 08-02-2010 14:43

Re: We have some things working with java, if you need help look here
 
We are looking for some sample code that displays images from the camera on the driver station display. The sample code talks about instantiating the class and then setting brightness level and resolution.

What do we do after the camera instance is created in code to display the picture?

- Sunit

BradAMiller 08-02-2010 14:55

Re: We have some things working with java, if you need help look here
 
If you create a sample Java project - the CircleTrackerDemo it will track the target and display the output on the dashboard. You should be able to use that as a model to write your own programs to track the target and display images. When the camera is running it will automatically tries to connect to the dashboard program and send images.

Brad

Patrick Chiang 09-02-2010 19:25

Re: We have some things working with java, if you need help look here
 
Mind posting your code on the section about the servos? We couldn't ever get it to work beyond one single movement. (Ex:We can set the sensitivity to whatever we want, but it will only move once in any direction.)

mark.amber 14-02-2010 10:36

Re: We have some things working with java, if you need help look here
 
sorry for forgetting about this thread.

to get camera feed put this in the import section

import edu.wpi.first.wpilibj.camera.AxisCamera;

and this in robot init

AxisCamera.getInstance().writeResolution(AxisCamer a.ResolutionT.k320x240);AxisCamera.getInstance().w riteBrightness(0);

that will start getting the image from the camera, make sure that you have the camera configured properly by using the circle tracker demo



for the servo, you just use:

Servo servo = new Servo(slot, 10);

then to tell the servo where to go you use

servo.set(-1 to 1)

you could also say

servo.set((Joystick(1).getX())) now the servo will go up and down with the jostick

johncap100 28-03-2011 08:25

Re: We have some things working with java, if you need help look here
 
do you have a copy of this default code from last year that you might share, or do you know where i might get a copy from last year?

thanks


Quote:

Originally Posted by mark.amber (Post 915083)
We are using the following computer systems for programming in JAVA:
  • Ubuntu 64 bit, running netbeans 6.8 successfully (Ubuntu 9.10)
  • Ubuntu 32 bit, running netbeans 6.8 successfully (Ubuntu 9.10)
  • Windows Vista, running netbeans 6.8 successfully

Classmate PC running:
  • Netbeans 6.7.1. we do not use netbeans on the classmate
  • Updated driver station with compass in bottom right.
  • Recieving feed of camera from cRIO.
  • Working comunication.

The cRIO:
  • Using Victors.
  • Connected to camera, seems to run the default circle detection code, follows circles with this code.
  • Connected to a WGA600N Gaming adapter, connected to our local network, all Computers listed can download to it.
  • Working Gyro for compensating for the orientation of the robot.
  • Working Servo for adjusting camera angle.

Code contains working sections for:
  • HolonomicDrive: setup so no matter what direction the robot is heading, it will respond to the joystick the same (using mecnum wheels)
  • Controls camera position on servo using a throttle on Attack3 Joystick.
  • Using iterativerobot class
  • Using multiple methods, so the code is segmented, and easier to debug
  • Debug output to Netbeans working.

Procedures we know
  • We know the procedure to download code to the cRIO from Netbeans (complicated).
  • We know how to flash the cRIO with the latest image.
  • We know how to setup the Axis camera, for use on the cRIO.
  • We know how to use the Vision Assistant 2009 to test out different filters.
  • We know how to install the latest updates for driver station (complicated).


Ether 28-03-2011 22:40

Re: We have some things working with java, if you need help look here
 
Hello Java gurus.

Sorry if this is slightly off-topic, but I've got a Java question I've been unable to find an answer for.

Can anyone tell me: If you start several threads at the same priority, what scheduling policy is used to run them concurrently?

Someone said it was not time-based, but rather based on number of bytecodes executed. Is this correct, and can anyone link to a document where this is discussed? I'm referring to the 2011 FRC Java Framework implementation here specifically.

Thank you.



Ivan913 14-05-2011 23:31

Re: We have some things working with java, if you need help look here
 
My team is trying to switch over to Java from C++ and we're having difficulties getting netbeans to find the wpilibj class files. I followed the "Getting Started with Java for FRC" pdf. Everything goes off without a hitch except until I try to instantiate any of the wpilibj classes, in which case it tells me it "cannot find symbol".

Fletch1373 15-05-2011 00:12

Re: We have some things working with java, if you need help look here
 
Quote:

Originally Posted by Ivan913 (Post 1061513)
My team is trying to switch over to Java from C++ and we're having difficulties getting netbeans to find the wpilibj class files. I followed the "Getting Started with Java for FRC" pdf. Everything goes off without a hitch except until I try to instantiate any of the wpilibj classes, in which case it tells me it "cannot find symbol".

hello Ivan, the WPILibJ library is made available to NetBeans by installing the FRC NetBeans plugins found at http://firstforge.wpi.edu/sf/frs/do/...e_for_2011_frc. You can either download the files and install them manually, or link NetBeans to the site and allow it to check for updates on it's own(with an internet connection at least). To let it search automatically, point the NetBeans plugin manager to http://first.wpi.edu/FRC/java/netbea...te/updates.xml.

Let me know if you have any more questions. I can give you a step by step if you would like.

Ivan913 15-05-2011 00:27

Re: We have some things working with java, if you need help look here
 
I already installed the plugins. I've actually done it multiple times. Twice using by linking netbeans to the update site, and once by downloading them manually. In each case all works fine. I can see the little frc logo on the menu and all that. I can open the javadocs and open the templates and everything. But every time I try to test out a SimpleRobot template, I try to instantiate something simple like a gyro or accelerometer and it can't seem to find it. Im running windows 7. Under the FRC Configuration tab in the options menu its using the standard WPILibJ location. The file path is C:/Users/Ivan/sunspotfrcsdk/lib/WPILibJ. Any clue what I'm doing wrong here?

Strants 15-05-2011 12:24

Re: We have some things working with java, if you need help look here
 
Quote:

Originally Posted by Ivan913 (Post 1061522)
But every time I try to test out a SimpleRobot template, I try to instantiate something simple like a gyro or accelerometer and it can't seem to find it. Im running windows 7. Under the FRC Configuration tab in the options menu its using the standard WPILibJ location. The file path is C:/Users/Ivan/sunspotfrcsdk/lib/WPILibJ. Any clue what I'm doing wrong here?

Are you importing the file? Assuming the SimpleRobot class itself doesn't cause you any problems (and from what you've said, that appears to be the case), I would say you just need to import the files. For example, to import a Gyro, you would put this code at the top of the file, under the package name:

Code:

import edu.wpi.first.wpilibj.Gyro;
This is the same as an include statement in C++. In Netbeans, you can also just press ctrl+i, and the editor will take care of the imports for you.

Fletch1373 15-05-2011 13:40

Re: We have some things working with java, if you need help look here
 
Quote:

Originally Posted by Ivan913 (Post 1061522)
I already installed the plugins. I've actually done it multiple times. Twice using by linking netbeans to the update site, and once by downloading them manually. In each case all works fine. I can see the little frc logo on the menu and all that. I can open the javadocs and open the templates and everything. But every time I try to test out a SimpleRobot template, I try to instantiate something simple like a gyro or accelerometer and it can't seem to find it. Im running windows 7. Under the FRC Configuration tab in the options menu its using the standard WPILibJ location. The file path is C:/Users/Ivan/sunspotfrcsdk/lib/WPILibJ. Any clue what I'm doing wrong here?

So the SimpleRobot template with no modifications still gives you errors? If you are making modifications to the template, make sure you're importing the classes like Strants said. The plugins "should" make everything work. However, on my laptop I've always installed the Labview libraries and DriverStation/dashboard programs first, so it's possible that something in one of those is needed by netbeans....? (unlikely, but who knows)

Ivan913 15-05-2011 19:06

Re: We have some things working with java, if you need help look here
 
As embarrassed as I am to say it, you guys are right, it was the imports. Its working fine now. Big thanks :D.

Fletch1373 16-05-2011 00:10

Re: We have some things working with java, if you need help look here
 
no problem, I'm glad to help


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

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