Fix shooter_translate for third robot.
As soon as we get the sensors working, this little tweak, (after I
merge in what James did at NASA today), should enable us to get
sensor data into the shooter loop and send outputs to the motors.
NOTE: James needs to modify some constants in one of the
shooter control loop Python files before this can actually happen.
(hint, hint)
diff --git a/bot3/input/gyro_sensor_receiver.cc b/bot3/input/gyro_sensor_receiver.cc
index ed81ed1..bb6bac7 100644
--- a/bot3/input/gyro_sensor_receiver.cc
+++ b/bot3/input/gyro_sensor_receiver.cc
@@ -22,14 +22,16 @@
namespace bot3 {
namespace {
-//TODO (danielp): Figure out whether the bigger gear is on the
-// encoder or not.
inline double drivetrain_translate(int32_t in) {
return static_cast<double>(in) / (256.0 /*cpr*/ * 4.0 /*quad*/) *
(32.0 / 44.0 /*encoder gears*/) * // the encoders are on the wheels.
(3.5 /*wheel diameter*/ * 2.54 / 100 * M_PI);
}
+inline double shooter_translate(int32_t in) {
+ return static_cast<double>(in) / 500 /*counter rate*/ * (2 * M_PI);
+}
+
// Translates values from the ADC into voltage.
inline double adc_translate(uint16_t in) {
static const double kVRefN = 0;
@@ -66,6 +68,9 @@
.right_encoder(drivetrain_translate(data()->main.wrist))
.left_encoder(drivetrain_translate(data()->main.shooter))
.Send();
+
+ shooter.position.MakeWithBuilder()
+ .position(shooter_translate(data()->bot3.shooter_cycle_ticks));
LOG(DEBUG, "battery %f %f %" PRIu16 "\n",
battery_translate(data()->main.battery_voltage),