Merge changes I76b08464,I4b76f566,Ic46b39e2
* changes:
Add distance remaining to trajectory status
Add slow-down button to pistol grip
Rezero practice intake
diff --git a/aos/input/drivetrain_input.cc b/aos/input/drivetrain_input.cc
index 248f1ce..631f97d 100644
--- a/aos/input/drivetrain_input.cc
+++ b/aos/input/drivetrain_input.cc
@@ -170,6 +170,10 @@
throttle = ::std::max(-1.0, throttle / 0.7);
}
+ if (data.IsPressed(slow_down_)) {
+ throttle *= 0.5;
+ }
+
if (!data.GetControlBit(ControlBit::kEnabled)) {
high_gear_ = default_high_gear_;
}
@@ -242,6 +246,7 @@
const ButtonLocation TopButton(1, 1);
const ButtonLocation SecondButton(1, 2);
+ const ButtonLocation BottomButton(1, 4);
// Non-existant button for nops.
const ButtonLocation DummyButton(1, 10);
@@ -264,7 +269,8 @@
kWheelHigh, kWheelLow, kTriggerVelocityHigh, kTriggerVelocityLow,
kTriggerTorqueHigh, kTriggerTorqueLow, kTriggerHigh, kTriggerLow,
kWheelVelocityHigh, kWheelVelocityLow, kWheelTorqueHigh,
- kWheelTorqueLow, kQuickTurn, kShiftHigh, kShiftLow, kTurn1, kTurn2));
+ kWheelTorqueLow, kQuickTurn, kShiftHigh, kShiftLow, kTurn1, kTurn2,
+ BottomButton));
result->set_default_high_gear(default_high_gear);
return result;
diff --git a/aos/input/drivetrain_input.h b/aos/input/drivetrain_input.h
index f4b0212..ec52368 100644
--- a/aos/input/drivetrain_input.h
+++ b/aos/input/drivetrain_input.h
@@ -182,7 +182,8 @@
driver_station::ButtonLocation shift_high,
driver_station::ButtonLocation shift_low,
driver_station::ButtonLocation turn1,
- driver_station::ButtonLocation turn2)
+ driver_station::ButtonLocation turn2,
+ driver_station::ButtonLocation slow_down)
: DrivetrainInputReader(wheel_high, throttle_high, quick_turn, turn1,
TurnButtonUse::kLineFollow, turn2,
TurnButtonUse::kControlLoopDriving),
@@ -197,7 +198,8 @@
throttle_torque_high_(throttle_torque_high),
throttle_torque_low_(throttle_torque_low),
shift_high_(shift_high),
- shift_low_(shift_low) {}
+ shift_low_(shift_low),
+ slow_down_(slow_down) {}
WheelAndThrottle GetWheelAndThrottle(
const ::aos::input::driver_station::Data &data) override;
@@ -222,6 +224,7 @@
const driver_station::ButtonLocation shift_high_;
const driver_station::ButtonLocation shift_low_;
+ const driver_station::ButtonLocation slow_down_;
bool high_gear_;
bool default_high_gear_;
diff --git a/frc971/control_loops/drivetrain/drivetrain.q b/frc971/control_loops/drivetrain/drivetrain.q
index 939ad75..c6af732 100644
--- a/frc971/control_loops/drivetrain/drivetrain.q
+++ b/frc971/control_loops/drivetrain/drivetrain.q
@@ -63,6 +63,7 @@
float theta;
float left_velocity;
float right_velocity;
+ float distance_remaining;
};
// For logging state of the line follower.
diff --git a/frc971/control_loops/drivetrain/splinedrivetrain.cc b/frc971/control_loops/drivetrain/splinedrivetrain.cc
index 2eb434a..1f7e2b0 100644
--- a/frc971/control_loops/drivetrain/splinedrivetrain.cc
+++ b/frc971/control_loops/drivetrain/splinedrivetrain.cc
@@ -218,6 +218,9 @@
(current_spline_idx_ != -1) && IsAtEnd();
status->trajectory_logging.goal_spline_handle = current_spline_handle_;
status->trajectory_logging.current_spline_idx = current_spline_idx_;
+ status->trajectory_logging.distance_remaining =
+ current_trajectory_ ? current_trajectory_->length() - current_xva_.x()
+ : 0.0;
int32_t planning_spline_idx = planning_spline_idx_;
if (current_spline_idx_ == planning_spline_idx) {
diff --git a/y2019/constants.cc b/y2019/constants.cc
index 8872318..5f0469e 100644
--- a/y2019/constants.cc
+++ b/y2019/constants.cc
@@ -197,7 +197,7 @@
elevator_params->zeroing_constants.measured_absolute_position = 0.131806;
elevator->potentiometer_offset = -0.022320 + 0.020567 - 0.022355 - 0.006497 + 0.019690 + 0.009151 - 0.007513 + 0.007311;
- intake->zeroing_constants.measured_absolute_position = 1.756847;
+ intake->zeroing_constants.measured_absolute_position = 1.928755;
wrist_params->zeroing_constants.measured_absolute_position = 0.192576;
wrist->potentiometer_offset = -4.200894 - 0.187134;