Make sundry improvements/bug fixes to auto-aiming
This includes:
-Adding some velocity and voltage limits to prevent excessive
velocity and acceleration.
-Logging more information in the status message.
-Fixing calculation of the desired turret velocity.
Change-Id: I83840bc1db9dda003be63e594d826fc97fa509e8
diff --git a/y2020/control_loops/superstructure/turret/aiming.h b/y2020/control_loops/superstructure/turret/aiming.h
index 3b3071e..854518c 100644
--- a/y2020/control_loops/superstructure/turret/aiming.h
+++ b/y2020/control_loops/superstructure/turret/aiming.h
@@ -56,7 +56,7 @@
const Goal *TurretGoal() const { return &goal_.message(); }
// Returns the distance to the goal, in meters.
- double DistanceToGoal() const { return distance_; }
+ double DistanceToGoal() const { return shot_distance_; }
flatbuffers::Offset<AimerStatus> PopulateStatus(
flatbuffers::FlatBufferBuilder *fbb) const;
@@ -64,7 +64,11 @@
private:
aos::FlatbufferDetachedBuffer<Goal> goal_;
bool aiming_for_inner_port_ = false;
- double distance_ = 0.0;
+ // Distance of the shot to the virtual target, used for calculating hood
+ // position and shooter speed.
+ double shot_distance_ = 0.0; // meters
+ // Real-world distance to the target.
+ double target_distance_ = 0.0; // meters
};
} // namespace turret