First fare 2010 java-beta-2011

7
New Features for FRC Java Programming (Report on Java Beta Software 2011) Andrew Merrill Software Mentor, FRC Team 1540 Computer Science Teacher, Catlin Gabel School Smart Dashboard

Transcript of First fare 2010 java-beta-2011

Page 1: First fare 2010 java-beta-2011

New Features for FRC Java Programming

(Report on Java Beta Software 2011)

Andrew MerrillSoftware Mentor, FRC Team

1540Computer Science Teacher,

Catlin Gabel School

Smart Dashboard New class SmartDashboard Convenient way to log diagnostic info to a remote

display New Java client that runs on desktop/laptop computer Client program automatically displays logged fields

without needing configuration Example:

Page 2: First fare 2010 java-beta-2011

SmartDashboard.init();SmartDashboard.log("Disabled", "System State");SmartDashboard.log(leftDrive.get(), "Left Drive");SmartDashboard.log(rightDrive.get(), "Right Drive");SmartDashboard.log(rollerAvg, "Roller Avg. Value");SmartDashboard.log(basket.hasBall(), "Ball in Robot");

Safe Motors New interface MotorSafety, new

classes SafePWM and MotorSafetyHelper A safe motor shuts itself off if you stop sending it

PWM signals You configure how long the motor waits until shutoff Motor starts working again when you send it a new

PWM signal Motors controlled by the RobotDrive class are

automatically "safe" Other motors are not "safe" by default Example of making a "safe" Jaguar controlled motor:

        Jaguar driveMotor = new Jaguar(1);       

Page 3: First fare 2010 java-beta-2011

driveMotor.setSafetyEnabled(true);        driveMotor.setExpiration(5);

Driver Station Enhanced IO New class DriverStationEnhancedIO More access to the Cypress add-on module on the

driver station Example of using

the DriverStationEnhancedIO class:   DriverStationEnhancedIO dseio =       DriverStation.getInstance().getEnhancedIO();   double accelX =        dseio.getAcceleration(dseio.tAccelChannel.kAccelX);    double slider = dseio.getTouchSlider();   dseio.setLED(1, true);

Accelerometer over I2C New class ADXL345_I2C Provides access to the ADXL 345 Accelerometer over

the I2C interface

Page 4: First fare 2010 java-beta-2011

Previously, accelerometer access was via analog inputs

Example code:  ADXL345_I2C accelerometer =      new ADXL345_I2C(1, ADXL345_I2C.DataFormat_Range.k4G);  double ax =      accelerometer.getAcceleration(ADXL345_I2C.Axes.kX);

New Image Processing Capabilities The package edu.wpi.first.wpilibj.image

has new classes:o CurveOptionso EllipseDescriptoro EllipseMatcho RegionOfInteresto ShapeDetectionOptions

The MonoImage class has a new detectEllipses method

Miscellaneous Changes The package com.sun.spot.ota has been

removedo but the com.sun.spot.ota.VxWorks class

was moved to the com.ni.rio package

Page 5: First fare 2010 java-beta-2011

The package com.sun.cldc.io was addedo it contains only

the ConnectionBaseInterface interface The package com.sun.cldc.jna has two new

classes:o BlockingFunction and TaskExecutor

The package com.sun.squawk has four new classes:

o CallbackManager, CrossIsolateThread, DoBlock, ResourceFile

The package com.sun.squawk.io.j2me.multicast has been renamed

o The new name is com.sun.squawk.io.j2me.multicastoutput

Two interfaces from com.sun.squawk.microedition.io were moved

o ServerSocketConnection, SocketConnection are now in javax.microedition.io

The package com.sun.squawk.pragma has been added

The package com.sun.squawk.security.verifier has been removed

The package con.sun.squawk.util has a new SquawkHashtable