View Single Post
  #2   Spotlight this post!  
Unread 20-03-2013, 16:58
slibert slibert is offline
Software Mentor
AKA: Scott Libert
FRC #2465 (Kauaibots)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2005
Location: Kauai, Hawaii
Posts: 343
slibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud of
Re: SmartDashboard - PID Editor Crashes C++ CRio Code

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) {
SetP(value.f);
} else if (key==kI && m_I != value.f) {
SetI(value.f);
} else if (key==kD && m_D != value.f) {
SetD(value.f);
} else if (key==kF && m_F != value.f) {
SetF(value.f);
} else if (key==kSetpoint && m_setpoint != value.f) {
SetSetpoint(value.f);
} else if (key==kEnabled && m_enabled != value.b) {
if (value.b) {
Enable();
} else {
Disable();
}
}
}
Reply With Quote