|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
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 http://code.google.com/p/kauaibotsfi...riveSystem.cpp Angle Sensor Code http://code.google.com/p/kauaibotsfi...ngleSensor.cpp 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.... |
|
#2
|
|||
|
|||
|
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(); } } } |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|