SmartDashboard - PID Editor Crashes C++ CRio Code

Via LiveWindow and the SmartDashboard, we are able to successfully edit the P value of our swerve drive subsystem code. We are currently tuning the PIDs linking our angle sensors to our steeringmotors.

However, whenever we edit the I or D values in the Smart Dashboard (the instant we change focus away from these controls), the robot crashes.

Source Code which demonstrates the problem is at:

Swerve Drive Code

Angle Sensor Code

If anyone has any ideas as to how to resolve this, we would greatly appreciate it. The promise of LiveWindow to accelerate our PID tuning progress is tantalizing, but seemingly unreachable, to us…

In case this is helpful to others, we’ve found a workaround:

  1. Copy WPILibrary PIDController.cpp/.h into our project.
  2. Add new “internal” SetP, SetI, SetD, SetF methods to PIDController.h/.cpp
  3. Modify the PIDController::ValueChanged method as follows (commented out code is the WPILib implementation that seems to be causing problems, although we’re not sure why):

void PIDController::ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew){
/if (key==kP || key==kI || key==kD || key==kF) {
if (m_P != m_table->GetNumber(kP) || m_I != m_table->GetNumber(kI) || m_D != m_table->GetNumber(kD) || m_F != m_table->GetNumber(kF) ) {
SetPID(m_table->GetNumber(kP, 0.0), m_table->GetNumber(kI, 0.0), m_table->GetNumber(kD, 0.0), m_table->GetNumber(kF, 0.0));
if (key==kP && m_P != value.f) {
} else if (key==kI && m_I != value.f) {
} else if (key==kD && m_D != value.f) {
} else if (key==kF && m_F != value.f) {
} else if (key==kSetpoint && m_setpoint != value.f) {
} else if (key==kEnabled && m_enabled != value.b) {
if (value.b) {
} else {