- Code: Select all
MMA7455L accel = new MMA7455L(SensorPort.S4);
Moderators: roger, 99jonathan, imaqine
MMA7455L accel = new MMA7455L(SensorPort.S4);skoehler wrote:Use the import statement:
import nl.totan.sensors.MMA7455L;
gazcrowbar wrote:EDIT: Figured it out - added the IMU folder to the source not as a library and the import statement worked. Thanks for the help!
while (Button.ESCAPE.isDown());while (Button.ESCAPE.isPressed());//IMUGyro.java Created by Gary Stanton 09 December 2011
//uses the dIMU drivers cereated by aswin, found on http://nxttime.wordpress.com/2011/11/22/imu-sensor-software/
//extends the gyrocope class to make the IMU to act a as a single axis gyro
//axis options: 0,1,2
//inverted - inverts the axis
//maybe in future allow rate setting, calculate offset correct to do so?
import nl.totan.sensors.*;
import lejos.robotics.Gyroscope;
import lejos.nxt.*;
public abstract class IMUGyro implements Gyroscope {
private float vel = 0;
private float[] rate = new float[3];
private L3G4200D gyro;
private int axis;
private boolean inverted = false;
public IMUGyro(int axis, boolean inverted) {
SensorPort.S4.i2cEnable(I2CPort.HIGH_SPEED);
this.inverted = inverted;
gyro = new L3G4200D(SensorPort.S4);
gyro.setRateUnit(RateData.RateUnits.DPS);
this.axis = axis;
}
//retrieve data from chosen axis
public float getAngularVelocity() {
//get results
gyro.fetchAllRate(rate);
vel = (float) rate[axis];
//invert gyro data if told by constructor
if (inverted == true){
vel = -(vel);
}
return vel;
}
public void recalibrateOffset() {
gyro.calculateOffset();
}
}
trebronics wrote:Where are the classes DIMUAccel and DIMUGyro? Everything in sensors, filters, and util compiles without error, but testDIMU in sample does not compile because it is unable to find those two classes.
MMA7455L_E accel = new MMA7455L_E(SensorPort.S2);
L3G4200D_E gyro = new L3G4200D_E(SensorPort.S2);
Users browsing this forum: No registered users and 0 guests