diff --git a/dsmApp/src/MD90Driver.cpp b/dsmApp/src/MD90Driver.cpp index 52dc57a..2e02278 100644 --- a/dsmApp/src/MD90Driver.cpp +++ b/dsmApp/src/MD90Driver.cpp @@ -248,6 +248,22 @@ asynStatus MD90Axis::setClosedLoop(bool closedLoop) return status; } +/** Set the I Gain of the motor control loop. The motor is an I- controller + * and has no P or D terms. + * \param[in] iGain The current I gain in the control loop */ +asynStatus MD90Axis::setIGain(double iGain) +{ + asynStatus status; + //static const char *functionName = "MD90Axis::setIGain"; + + iGain = iGain * 100; + if (iGain < 1) iGain = 1.0; + if (iGain > 100) iGain = 100.0; + sprintf(pC_->outString_, "SGN %d", NINT(iGain)); + status = pC_->writeReadController(); + return status; +} + /** Polls the axis. * This function reads the motor position, the limit status, the home status, the moving status, * and the drive power-on status. diff --git a/dsmApp/src/MD90Driver.h b/dsmApp/src/MD90Driver.h index 28717cc..5062b4f 100644 --- a/dsmApp/src/MD90Driver.h +++ b/dsmApp/src/MD90Driver.h @@ -27,6 +27,7 @@ public: asynStatus stop(double acceleration); asynStatus poll(bool *moving); asynStatus setClosedLoop(bool closedLoop); + asynStatus setIGain(double iGain); private: MD90Controller *pC_; /**< Pointer to the asynMotorController to which this axis belongs.