Add Turret Constants
Add speeds, ratios, and limits.
Change-Id: I84c8edb884fb31b1303444ede775288a8c30d7a2
diff --git a/y2020/constants.cc b/y2020/constants.cc
index aee797f..6f79b6b 100644
--- a/y2020/constants.cc
+++ b/y2020/constants.cc
@@ -12,9 +12,9 @@
#include "aos/logging/logging.h"
#include "aos/mutex/mutex.h"
#include "aos/network/team_number.h"
-#include "y2020/control_loops/superstructure/intake/integral_intake_plant.h"
-
#include "y2020/control_loops/superstructure/hood/integral_hood_plant.h"
+#include "y2020/control_loops/superstructure/intake/integral_intake_plant.h"
+#include "y2020/control_loops/superstructure/turret/integral_turret_plant.h"
namespace y2020 {
namespace constants {
@@ -69,6 +69,28 @@
intake->zeroing_constants.allowable_encoder_error = 0.9;
intake->zeroing_constants.middle_position = Values::kIntakeRange().middle();
+ Values::PotAndAbsEncoderConstants *const turret = &r->turret;
+ ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemParams<
+ ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator>
+ *const turret_params = &turret->subsystem_params;
+
+ //Turret Constants
+ turret_params->zeroing_voltage = 4.0;
+ turret_params->operating_voltage = 12.0;
+ // TODO(austin): Tune these.
+ turret_params->zeroing_profile_params = {0.5, 2.0};
+ turret_params->default_profile_params = {15.0, 40.0};
+ turret_params->range = Values::kTurretRange();
+ turret_params->make_integral_loop =
+ &control_loops::superstructure::turret::MakeIntegralTurretLoop;
+ turret_params->zeroing_constants.average_filter_size =
+ Values::kZeroingSampleSize;
+ turret_params->zeroing_constants.one_revolution_distance =
+ M_PI * 2.0 * constants::Values::kTurretEncoderRatio();
+ turret_params->zeroing_constants.zeroing_threshold = 0.0005;
+ turret_params->zeroing_constants.moving_buffer_size = 20;
+ turret_params->zeroing_constants.allowable_encoder_error = 0.9;
+
switch (team) {
// A set of constants for tests.
case 1:
@@ -76,17 +98,29 @@
case kCompTeamNumber:
hood->zeroing_constants.measured_absolute_position = 0.0;
+
intake->zeroing_constants.measured_absolute_position = 0.0;
+
+ turret->potentiometer_offset = 0.0;
+ turret_params->zeroing_constants.measured_absolute_position = 0.0;
break;
case kPracticeTeamNumber:
hood->zeroing_constants.measured_absolute_position = 0.0;
+
intake->zeroing_constants.measured_absolute_position = 0.0;
+
+ turret->potentiometer_offset = 0.0;
+ turret_params->zeroing_constants.measured_absolute_position = 0.0;
break;
case kCodingRobotTeamNumber:
hood->zeroing_constants.measured_absolute_position = 0.0;
+
intake->zeroing_constants.measured_absolute_position = 0.0;
+
+ turret->potentiometer_offset = 0.0;
+ turret_params->zeroing_constants.measured_absolute_position = 0.0;
break;
default: