|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.nxt.Part ch.aplu.nxt.Sensor ch.aplu.nxt.GyroSensor
public class GyroSensor
Class that represents a gyro sensor from HiTechnic. The sensor reports the angular velocity. To get the current rotation angle (heading) you must use a separate thread to poll the sensor in a tight loop (of about 1 ms) and integrate the reported values. See also net.mosen.nxt.GyrsoSensor (author Kirk P. Thomson).
Field Summary |
---|
Constructor Summary | |
---|---|
GyroSensor()
Creates a sensor instance connected to port S1. |
|
GyroSensor(SensorPort port)
Creates a sensor instance connected to the given port. |
Method Summary | |
---|---|
void |
addGyroListener(GyroListener gyroListener)
Registers the given gyro listener with default trigger level 500. |
void |
addGyroListener(GyroListener gyroListener,
int triggerLevel)
Registers the given gyro listener for the given trigger level. |
lejos.nxt.SensorPort |
getLejosPort()
Returns the reference of the the underlying lejos.nxt.SensorPort. |
lejos.nxt.addon.GyroSensor |
getLejosSensor()
Returns the reference of the the underlying lejos.nxt.GyroSensor. |
int |
getValue()
Polls the sensor. |
int |
setTriggerLevel(int triggerLevel)
Sets a new trigger level and returns the previous one. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GyroSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic GyroSensor()
Method Detail |
---|
public void addGyroListener(GyroListener gyroListener, int triggerLevel)
gyroListener
- the GyroListener to become registered.triggerLevel
- the trigger level where the callback is triggeredpublic void addGyroListener(GyroListener gyroListener)
gyroListener
- the GyroListener to become registered.public int setTriggerLevel(int triggerLevel)
triggerLevel
- the new trigger level
public int getValue()
public lejos.nxt.addon.GyroSensor getLejosSensor()
public lejos.nxt.SensorPort getLejosPort()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |