Rename HandleInterrupt to CurrentInterrupt
This is in preparation for adding a fixed cycle version
Change-Id: I20bac62558b9aa74514108e4520ba0f5497c14e4
diff --git a/motors/big/medium_salsa.cc b/motors/big/medium_salsa.cc
index 7e01869..6c3f339 100644
--- a/motors/big/medium_salsa.cc
+++ b/motors/big/medium_salsa.cc
@@ -133,7 +133,7 @@
}
const BalancedReadings balanced = BalanceReadings(to_balance);
- global_motor.load(::std::memory_order_relaxed)->HandleInterrupt(
+ global_motor.load(::std::memory_order_relaxed)->CurrentInterrupt(
balanced,
global_motor.load(::std::memory_order_relaxed)->wrapped_encoder());
}
diff --git a/motors/fet12/fet12v2.cc b/motors/fet12/fet12v2.cc
index ae7c3c0..6722640 100644
--- a/motors/fet12/fet12v2.cc
+++ b/motors/fet12/fet12v2.cc
@@ -256,7 +256,7 @@
global_motor.load(::std::memory_order_relaxed)
->SetGoalCurrent(goal_current);
global_motor.load(::std::memory_order_relaxed)
- ->HandleInterrupt(balanced, wrapped_encoder);
+ ->CurrentInterrupt(balanced, wrapped_encoder);
global_debug_buffer.count.fetch_add(1);
diff --git a/motors/motor.cc b/motors/motor.cc
index ebeec22..7cd4bc7 100644
--- a/motors/motor.cc
+++ b/motors/motor.cc
@@ -114,8 +114,8 @@
#define DO_PULSE_SWEEP 0
#define PRINT_TIMING 0
-void Motor::HandleInterrupt(const BalancedReadings &balanced,
- uint32_t captured_wrapped_encoder) {
+void Motor::CurrentInterrupt(const BalancedReadings &balanced,
+ uint32_t captured_wrapped_encoder) {
pwm_ftm_->SC &= ~FTM_SC_TOF;
#if PRINT_TIMING
diff --git a/motors/motor.h b/motors/motor.h
index 808783e..2f088aa 100644
--- a/motors/motor.h
+++ b/motors/motor.h
@@ -130,8 +130,8 @@
// If the global time base is in use, it must be activated after this.
void Start();
- void HandleInterrupt(const BalancedReadings &readings,
- uint32_t captured_wrapped_encoder);
+ void CurrentInterrupt(const BalancedReadings &readings,
+ uint32_t captured_wrapped_encoder);
void SetGoalCurrent(float goal_current) {
DisableInterrupts disable_interrupts;
diff --git a/motors/pistol_grip/controller.cc b/motors/pistol_grip/controller.cc
index 9f292d1..acbfb29 100644
--- a/motors/pistol_grip/controller.cc
+++ b/motors/pistol_grip/controller.cc
@@ -237,14 +237,17 @@
->absolute_encoder(encoder);
const float angle = absolute_encoder / static_cast<float>((15320 - 1488) / 2);
- global_wheel_angle.store(angle);
- float goal_current = -global_wheel_current.load(::std::memory_order_relaxed) +
+ float goal_current = global_wheel_current.load(::std::memory_order_relaxed) +
kWheelCoggingTorque[encoder];
+ //float goal_current = kWheelCoggingTorque[encoder];
+ //float goal_current = 0.0f;
global_motor1.load(::std::memory_order_relaxed)->SetGoalCurrent(goal_current);
global_motor1.load(::std::memory_order_relaxed)
- ->HandleInterrupt(BalanceSimpleReadings(readings.currents), encoder);
+ ->CurrentInterrupt(BalanceSimpleReadings(readings.currents), encoder);
+
+ global_wheel_angle.store(angle);
}
constexpr float kTriggerMaxExtension = -0.70f;
@@ -281,20 +284,24 @@
DisableInterrupts disable_interrupts;
readings = AdcReadSmall0(disable_interrupts);
}
- uint32_t encoder =
- global_motor0.load(::std::memory_order_relaxed)->wrapped_encoder();
- int32_t absolute_encoder = global_motor0.load(::std::memory_order_relaxed)
- ->absolute_encoder(encoder);
- float trigger_angle = absolute_encoder / 1370.f;
+ const uint32_t encoder =
+ global_motor0.load(::std::memory_order_relaxed)->wrapped_encoder();
+ const int32_t absolute_encoder =
+ global_motor0.load(::std::memory_order_relaxed)
+ ->absolute_encoder(encoder);
+
+ const float trigger_angle = absolute_encoder / 1370.f;
const float goal_current =
- -global_trigger_torque.load(::std::memory_order_relaxed) +
+ global_trigger_torque.load(::std::memory_order_relaxed) +
kTriggerCoggingTorque[encoder];
+ //const float goal_current = kTriggerCoggingTorque[encoder];
+ //const float goal_current = 0.0f;
global_motor0.load(::std::memory_order_relaxed)->SetGoalCurrent(goal_current);
global_motor0.load(::std::memory_order_relaxed)
- ->HandleInterrupt(BalanceSimpleReadings(readings.currents), encoder);
+ ->CurrentInterrupt(BalanceSimpleReadings(readings.currents), encoder);
global_trigger_angle.store(trigger_angle);
}