Class CruizcoreGyro
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.sensor.CruizcoreGyro
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class CruizcoreGyro extends I2CSensor
Micro Infinity Cruizcore XG1300L
The XG1300L is a fully self-contained digital MEMS gyroscope and accelerometer.The code for this sensor has not been tested. Please report test results to the leJOS forum.
Supported modes Mode name Description unit(s) Getter Acceleration Measures linear acceleration over three axes getAccelerationMode()Rate Rate Measures rate of turn over the Z-axis getRateMode()Angle Measures angle over the Z-axis getAngleMode()See Sensor datasheet See Sensor Product page See The leJOS sensor framework See
leJOS conventions for SampleProviders- Author:
- Daniele Benedettelli
-
-
Field Summary
-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
-
-
Constructor Summary
Constructors Constructor Description CruizcoreGyro(I2CPort port)Instantiates a new Cruizcore Gyro sensor.CruizcoreGyro(Port port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SensorModegetAccelerationMode()Cruizcore XG1300L, Acceleration mode
Measures linear acceleration over three axesSensorModegetAngleMode()Cruizcore XG1300L, Angle mode
Measures angle over the Z-axisSensorModegetRateMode()Cruizcore XG1300L, Acceleration mode
Measures rate of turn over the Z-axisprotected voidinit()voidreset()Resets the accumulated angle (heading).voidsetAccScale(int sf)Sets the acc scale.voidsetAccScale2G()Sets the acceleration scale factor to 2G.voidsetAccScale4G()Sets the acceleration scale factor to 4G.voidsetAccScale8G()Sets the acceleration scale factor to 8G.-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Method Detail
-
init
protected void init()
-
setAccScale
public void setAccScale(int sf)
Sets the acc scale.- Parameters:
sf- the scale factor: 0 for +/- 2G, 1 for +/- 4G, 2 for +/- 8g- Throws:
java.lang.IllegalArgumentException- if the parameter is neither 0, 1, or 2.
-
setAccScale2G
public void setAccScale2G()
Sets the acceleration scale factor to 2G.
-
setAccScale4G
public void setAccScale4G()
Sets the acceleration scale factor to 4G.
-
setAccScale8G
public void setAccScale8G()
Sets the acceleration scale factor to 8G.
-
reset
public void reset()
Resets the accumulated angle (heading).
-
getAccelerationMode
public SensorMode getAccelerationMode()
Cruizcore XG1300L, Acceleration mode
Measures linear acceleration over three axesSize and content of the sample
The sample contains 3 elements. Each element gives linear acceleration (in metres/second^2). Axis order in sample is X, Y, Z.Configuration
The sensor can be configured for range using the setAccScale#G() methods of the sensor class.- Returns:
- A sampleProvider
See
leJOS conventions for SampleProvidersSee Sensor datasheet
-
getRateMode
public SensorMode getRateMode()
Cruizcore XG1300L, Acceleration mode
Measures rate of turn over the Z-axisSize and content of the sample
The sample contains one element, the rate of turn (in degrees / second) over the Z-axis.Configuration
There are no configurable parameters.- Returns:
- A sampleProvider
See
leJOS conventions for SampleProvidersSee Sensor datasheet
-
getAngleMode
public SensorMode getAngleMode()
Cruizcore XG1300L, Angle mode
Measures angle over the Z-axisSize and content of the sample
The sample contains one element, the accumulated angle (in degrees). .Configuration
The accumulated angle can be reset to zero using the reset() method of the sensor class.- Returns:
- A sampleProvider
See
leJOS conventions for SampleProvidersSee Sensor datasheet
-
-