Adding zeroing faults to y2023 webpage
Signed-off-by: Milo Lin <100027790@mvla.net>
Change-Id: Ic40a85bda430254bb20f0863bb48ff23d8db78ac
diff --git a/y2023/www/field_handler.ts b/y2023/www/field_handler.ts
index db881af..65b9a20 100644
--- a/y2023/www/field_handler.ts
+++ b/y2023/www/field_handler.ts
@@ -5,6 +5,7 @@
import {Status as DrivetrainStatus} from '../../frc971/control_loops/drivetrain/drivetrain_status_generated';
import {Status as SuperstructureStatus, EndEffectorState, ArmState, ArmStatus} from '../control_loops/superstructure/superstructure_status_generated'
import {Class} from '../vision/game_pieces_generated'
+import {ZeroingError} from '../../frc971/control_loops/control_loops_generated';
import {Visualization, TargetEstimateDebug} from '../localizer/visualization_generated';
import {FIELD_LENGTH, FIELD_WIDTH, FT_TO_M, IN_TO_M} from './constants';
@@ -56,6 +57,8 @@
(document.getElementById('arm_proximal') as HTMLElement);
private distal: HTMLElement =
(document.getElementById('arm_distal') as HTMLElement);
+ private zeroingFaults: HTMLElement =
+ (document.getElementById('zeroing_faults') as HTMLElement);_
constructor(private readonly connection: Connection) {
(document.getElementById('field') as HTMLElement).appendChild(this.canvas);
@@ -276,6 +279,23 @@
this.superstructureStatus.arm().proximalEstimatorState().position().toFixed(2);
this.distal.innerHTML =
this.superstructureStatus.arm().distalEstimatorState().position().toFixed(2);
+ let zeroingErrors: string = "Roll Joint Errors:"+'<br/>';
+ for (let i = 0; i < this.superstructureStatus.arm().rollJointEstimatorState().errors.length; i++) {
+ zeroingErrors += ZeroingError[this.superstructureStatus.arm().rollJointEstimatorState().errors(i)]+'<br/>';
+ }
+ zeroingErrors += '<br/>'+"Proximal Joint Errors:"+'<br/>';
+ for (let i = 0; i < this.superstructureStatus.arm().proximalEstimatorState().errors.length; i++) {
+ zeroingErrors += ZeroingError[this.superstructureStatus.arm().proximalEstimatorState().errors(i)]+'<br/>';
+ }
+ zeroingErrors += '<br/>'+"Distal Joint Errors:"+'<br/>';
+ for (let i = 0; i < this.superstructureStatus.arm().distalEstimatorState().errors.length; i++) {
+ zeroingErrors += ZeroingError[this.superstructureStatus.arm().distalEstimatorState().errors(i)]+'<br/>';
+ }
+ zeroingErrors += '<br/>'+"Wrist Errors:"+'<br/>';
+ for (let i = 0; i < this.superstructureStatus.wrist().estimatorState().errors.length; i++) {
+ zeroingErrors += ZeroingError[this.superstructureStatus.wrist().estimatorState().errors(i)]+'<br/>';
+ }
+ this.zeroingFaults.innerHTML = zeroingErrors;
}
if (this.drivetrainStatus && this.drivetrainStatus.trajectoryLogging()) {