Expose More of Our Shooter Status in The Debugging Site
Signed-off-by: Niko Sohmers <nikolai@sohmers.com>
Change-Id: I9b1228bbc91b95ae2469562c009e8fbec8bf36a5
diff --git a/y2024/control_loops/superstructure/shooter.cc b/y2024/control_loops/superstructure/shooter.cc
index cc00454..837b353 100644
--- a/y2024/control_loops/superstructure/shooter.cc
+++ b/y2024/control_loops/superstructure/shooter.cc
@@ -140,13 +140,18 @@
? shooter_goal->altitude_position()
: &altitude_goal_builder->AsFlatbuffer();
- bool subsystems_in_range =
+ const bool turret_in_range =
(std::abs(turret_.estimated_position() - turret_goal->unsafe_goal()) <
- kCatapultActivationThreshold &&
- std::abs(altitude_.estimated_position() - altitude_goal->unsafe_goal()) <
- kCatapultActivationThreshold &&
- altitude_.estimated_position() >
- robot_constants_->common()->min_altitude_shooting_angle());
+ kCatapultActivationThreshold);
+ const bool altitude_in_range =
+ (std::abs(altitude_.estimated_position() - altitude_goal->unsafe_goal()) <
+ kCatapultActivationThreshold);
+ const bool altitude_above_min_angle =
+ (altitude_.estimated_position() >
+ robot_constants_->common()->min_altitude_shooting_angle());
+
+ bool subsystems_in_range =
+ (turret_in_range && altitude_in_range && altitude_above_min_angle);
const bool disabled = turret_.Correct(turret_goal, position->turret(),
turret_output == nullptr);
@@ -301,6 +306,9 @@
status_builder.add_altitude(altitude_status_offset);
status_builder.add_catapult(catapult_status_offset);
status_builder.add_catapult_state(state_);
+ status_builder.add_turret_in_range(turret_in_range);
+ status_builder.add_altitude_in_range(altitude_in_range);
+ status_builder.add_altitude_above_min_angle(altitude_above_min_angle);
if (aiming) {
status_builder.add_aimer(aimer_offset);
}
diff --git a/y2024/control_loops/superstructure/superstructure_status.fbs b/y2024/control_loops/superstructure/superstructure_status.fbs
index 8d6b14f..b728f4f 100644
--- a/y2024/control_loops/superstructure/superstructure_status.fbs
+++ b/y2024/control_loops/superstructure/superstructure_status.fbs
@@ -77,6 +77,10 @@
// Status of the aimer
aimer:AimerStatus (id: 4);
+
+ turret_in_range:bool (id: 5);
+ altitude_in_range:bool (id: 6);
+ altitude_above_min_angle:bool (id: 7);
}
// Contains status of transfer rollers
diff --git a/y2024/www/field.html b/y2024/www/field.html
index cfb8778..097fbf3 100644
--- a/y2024/www/field.html
+++ b/y2024/www/field.html
@@ -114,6 +114,18 @@
<td>Altitude at Loading Position</td>
<td id="altitude_ready_for_load">FALSE</td>
</tr>
+ <tr>
+ <td>Turret in Range of Goal</td>
+ <td id="turret_in_range">FALSE</td>
+ </tr>
+ <tr>
+ <td>Altitude in Range of Goal</td>
+ <td id="altitude_in_range">FALSE</td>
+ </tr>
+ <tr>
+ <td>Altitude Above Minimum Angle </td>
+ <td id="altitude_above_min_angle">FALSE</td>
+ </tr>
</table>
<table>
<tr>
diff --git a/y2024/www/field_handler.ts b/y2024/www/field_handler.ts
index 949b34b..d694108 100644
--- a/y2024/www/field_handler.ts
+++ b/y2024/www/field_handler.ts
@@ -70,6 +70,13 @@
private altitude_ready_for_load: HTMLElement =
(document.getElementById('altitude_ready_for_load') as HTMLElement);
+ private turret_in_range: HTMLElement =
+ (document.getElementById('turret_in_range') as HTMLElement);
+ private altitude_in_range: HTMLElement =
+ (document.getElementById('altitude_in_range') as HTMLElement);
+ private altitude_above_min_angle: HTMLElement =
+ (document.getElementById('altitude_above_min_angle') as HTMLElement);
+
private intakePivot: HTMLElement =
(document.getElementById('intake_pivot') as HTMLElement);
@@ -323,6 +330,12 @@
this.setBoolean(this.extend_ready_for_catapult_transfer, this.superstructureStatus.extendReadyForCatapultTransfer());
+ this.setBoolean(this.turret_in_range, this.superstructureStatus.shooter().turretInRange())
+
+ this.setBoolean(this.altitude_in_range, this.superstructureStatus.shooter().altitudeInRange())
+
+ this.setBoolean(this.altitude_above_min_angle, this.superstructureStatus.shooter().altitudeAboveMinAngle())
+
if (this.superstructureStatus.shooter() &&
this.superstructureStatus.shooter().aimer()) {
this.turret_position.innerHTML = this.superstructureStatus.shooter()