2017-12-18 22:04:17 +01:00
|
|
|
namespace pxsim {
|
2019-10-01 07:43:50 +02:00
|
|
|
export const enum GyroSensorMode {
|
2017-12-18 22:04:17 +01:00
|
|
|
None = -1,
|
|
|
|
Angle = 0,
|
|
|
|
Rate = 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
export class GyroSensorNode extends UartSensorNode {
|
|
|
|
id = NodeType.GyroSensor;
|
|
|
|
|
|
|
|
private rate: number = 0;
|
|
|
|
|
|
|
|
constructor(port: number) {
|
|
|
|
super(port);
|
|
|
|
}
|
|
|
|
|
|
|
|
getDeviceType() {
|
|
|
|
return DAL.DEVICE_TYPE_GYRO;
|
|
|
|
}
|
|
|
|
|
|
|
|
setRate(rate: number) {
|
2019-10-01 07:43:50 +02:00
|
|
|
rate = rate | 0;
|
2017-12-18 22:04:17 +01:00
|
|
|
if (this.rate != rate) {
|
|
|
|
this.rate = rate;
|
2017-12-19 23:20:35 +01:00
|
|
|
this.setChangedState();
|
2017-12-18 22:04:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-01 19:11:58 +02:00
|
|
|
getRate() {
|
|
|
|
return this.rate;
|
|
|
|
}
|
|
|
|
|
2017-12-18 22:04:17 +01:00
|
|
|
getValue() {
|
2019-10-01 19:11:58 +02:00
|
|
|
return this.getRate();
|
2017-12-18 22:04:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|