fixes
This commit is contained in:
parent
3153d94c3d
commit
187d937958
@ -1,10 +1,19 @@
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div class="row">
|
||||||
<mat-form-field appearance="fill">
|
<div class="col-5 pr-0">
|
||||||
<mat-label>Calibrate</mat-label>
|
<mat-form-field appearance="fill" class="w-100">
|
||||||
|
<mat-label>Shift +/-</mat-label>
|
||||||
<input matInput type="number" min="-180" max="180" [(ngModel)]="calibration">
|
<input matInput type="number" min="-180" max="180" [(ngModel)]="calibration">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-2 text-center"><h1> = </h1></div>
|
||||||
|
<div class="col-5 pl-0">
|
||||||
|
<mat-form-field appearance="fill" class="w-100">
|
||||||
|
<mat-label>Heading</mat-label>
|
||||||
|
<input matInput type="number" [ngModel]="(physicsService.info | async)?.heading" readonly>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<mat-slider class="w-100" [max]="180" [min]="-180" [step]="1" [tickInterval]="90" [thumbLabel]="true" [(ngModel)]="calibration" (input)="calibration = $event.value"></mat-slider>
|
<mat-slider class="w-100" [max]="180" [min]="-180" [step]="1" [tickInterval]="90" [thumbLabel]="true" [(ngModel)]="calibration" (input)="calibration = $event.value"></mat-slider>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,9 +25,9 @@ export class CalibrateComponent {
|
|||||||
setN() {
|
setN() {
|
||||||
let currentHeading = this.physicsService.orientation.value.alpha;
|
let currentHeading = this.physicsService.orientation.value.alpha;
|
||||||
if(currentHeading <= 180) {
|
if(currentHeading <= 180) {
|
||||||
this.calibration = -currentHeading;
|
this.calibration = 360 - Math.round(currentHeading);
|
||||||
} else {
|
} else {
|
||||||
this.calibration = 360 - currentHeading;
|
this.calibration = -Math.round(currentHeading);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,6 @@ export class PhysicsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
info.heading = -data[1].alpha + (data[2] == Infinity ? 0 : data[2]);
|
info.heading = -data[1].alpha + (data[2] == Infinity ? 0 : data[2]);
|
||||||
if(info.heading > 360) info.heading -= 360;
|
|
||||||
if(info.heading < 0) info.heading += 360;
|
|
||||||
}
|
}
|
||||||
if(info.speed == null && !!data[3]) info.speed = Math.sqrt(data[3].x**2 + data[3].y**2 + data[3].z**2);
|
if(info.speed == null && !!data[3]) info.speed = Math.sqrt(data[3].x**2 + data[3].y**2 + data[3].z**2);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user