mirror of
https://github.com/Binary-Coalescence/motorDSM.git
synced 2025-08-04 21:55:40 -05:00
Merge branch 'dev'
This commit is contained in:
@@ -140,29 +140,26 @@ void MD90Axis::report(FILE *fp, int level)
|
|||||||
asynMotorAxis::report(fp, level);
|
asynMotorAxis::report(fp, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Acceleration currently unsupported with MD-90 controller
|
||||||
|
* \param[in] acceleration The accelerations to ramp up to max velocity
|
||||||
|
* \param[in] velocity Motor velocity in steps / sec
|
||||||
|
*/
|
||||||
asynStatus MD90Axis::sendAccelAndVelocity(double acceleration, double velocity)
|
asynStatus MD90Axis::sendAccelAndVelocity(double acceleration, double velocity)
|
||||||
{
|
{
|
||||||
asynStatus status;
|
asynStatus status;
|
||||||
int ival;
|
int freq;
|
||||||
// static const char *functionName = "MD90::sendAccelAndVelocity";
|
// static const char *functionName = "MD90::sendAccelAndVelocity";
|
||||||
|
|
||||||
// Send the velocity
|
// Send the velocity
|
||||||
ival = NINT(fabs(115200./velocity));
|
// Velocity provided in steps/sec
|
||||||
if (ival < 2) ival=2;
|
// Our unit step size of the encoder is 10 nm, but the motor moves in steps approx. 5 micrometers.
|
||||||
if (ival > 255) ival = 255;
|
// Motor controller accepts step frequency in Hz.
|
||||||
sprintf(pC_->outString_, "#%02dV=%d", axisNo_, ival);
|
freq = NINT(fabs(velocity / 500.));
|
||||||
|
if (freq < 5) freq=5;
|
||||||
|
if (freq > 125) freq = 125;
|
||||||
|
sprintf(pC_->outString_, "SSF %d", freq);
|
||||||
status = pC_->writeReadController();
|
status = pC_->writeReadController();
|
||||||
|
|
||||||
// Send the acceleration
|
|
||||||
// acceleration is in steps/sec/sec
|
|
||||||
// MD-90 is programmed with Ramp Index (R) where:
|
|
||||||
// dval (steps/sec/sec) = 720,000/(256-R) */
|
|
||||||
// or R=256-(720,000/dval) */
|
|
||||||
ival = NINT(256-(720000./acceleration));
|
|
||||||
if (ival < 1) ival=1;
|
|
||||||
if (ival > 255) ival=255;
|
|
||||||
sprintf(pC_->outString_, "#%02dR=%d", axisNo_, ival);
|
|
||||||
status = pC_->writeReadController();
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,13 +205,15 @@ asynStatus MD90Axis::moveVelocity(double minVelocity, double maxVelocity, double
|
|||||||
|
|
||||||
status = sendAccelAndVelocity(acceleration, maxVelocity);
|
status = sendAccelAndVelocity(acceleration, maxVelocity);
|
||||||
|
|
||||||
/* MD-90 does not have jog command. Move 1 million steps */
|
/* MD-90 does not have jog command. Move max 6000 steps */
|
||||||
|
sprintf(pC_->outString_, "SNS 6000");
|
||||||
|
status = pC_->writeReadController();
|
||||||
if (maxVelocity > 0.) {
|
if (maxVelocity > 0.) {
|
||||||
/* This is a positive move in MD90 coordinates */
|
/* This is a positive move in MD90 coordinates */
|
||||||
sprintf(pC_->outString_, "#%02dI+1000000", axisNo_);
|
sprintf(pC_->outString_, "ESF");
|
||||||
} else {
|
} else {
|
||||||
/* This is a negative move in MD90 coordinates */
|
/* This is a negative move in MD90 coordinates */
|
||||||
sprintf(pC_->outString_, "#%02dI-1000000", axisNo_);
|
sprintf(pC_->outString_, "ESB");
|
||||||
}
|
}
|
||||||
status = pC_->writeReadController();
|
status = pC_->writeReadController();
|
||||||
return status;
|
return status;
|
||||||
@@ -230,22 +229,46 @@ asynStatus MD90Axis::stop(double acceleration )
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
asynStatus MD90Axis::setPosition(double position)
|
/** The ACS driver used this to turn on/off the motor winding current, so
|
||||||
{
|
* we'll use this for enabling/disabling the persistent move state.
|
||||||
asynStatus status;
|
*/
|
||||||
//static const char *functionName = "MD90Axis::setPosition";
|
|
||||||
|
|
||||||
sprintf(pC_->outString_, "#%02dP=%+d", axisNo_, NINT(position));
|
|
||||||
status = pC_->writeReadController();
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
asynStatus MD90Axis::setClosedLoop(bool closedLoop)
|
asynStatus MD90Axis::setClosedLoop(bool closedLoop)
|
||||||
{
|
{
|
||||||
asynStatus status;
|
asynStatus status;
|
||||||
//static const char *functionName = "MD90Axis::setClosedLoop";
|
//static const char *functionName = "MD90Axis::setClosedLoop";
|
||||||
|
|
||||||
sprintf(pC_->outString_, "#%02dW=%d", axisNo_, closedLoop ? 1:0);
|
if (closedLoop == 1) {
|
||||||
|
sprintf(pC_->outString_, "EPM");
|
||||||
|
} else {
|
||||||
|
sprintf(pC_->outString_, "DPM");
|
||||||
|
}
|
||||||
|
status = pC_->writeReadController();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
asynStatus MD90Axis::doMoveToHome()
|
||||||
|
{
|
||||||
|
asynStatus status;
|
||||||
|
//static const char *functionName = "MD90Axis::doMoveToHome";
|
||||||
|
|
||||||
|
sprintf(pC_->outString_, "CLM 0");
|
||||||
status = pC_->writeReadController();
|
status = pC_->writeReadController();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -255,7 +278,8 @@ asynStatus MD90Axis::setClosedLoop(bool closedLoop)
|
|||||||
* and the drive power-on status.
|
* and the drive power-on status.
|
||||||
* It calls setIntegerParam() and setDoubleParam() for each item that it polls,
|
* It calls setIntegerParam() and setDoubleParam() for each item that it polls,
|
||||||
* and then calls callParamCallbacks() at the end.
|
* and then calls callParamCallbacks() at the end.
|
||||||
* \param[out] moving A flag that is set indicating that the axis is moving (true) or done (false). */
|
* \param[out] moving A flag that is set indicating that the axis is moving (true) or done (false).
|
||||||
|
*/
|
||||||
asynStatus MD90Axis::poll(bool *moving)
|
asynStatus MD90Axis::poll(bool *moving)
|
||||||
{
|
{
|
||||||
int replyStatus;
|
int replyStatus;
|
||||||
@@ -263,7 +287,7 @@ asynStatus MD90Axis::poll(bool *moving)
|
|||||||
int replyValue;
|
int replyValue;
|
||||||
int done;
|
int done;
|
||||||
int driveOn;
|
int driveOn;
|
||||||
int home;
|
int homed;
|
||||||
double position;
|
double position;
|
||||||
asynStatus comStatus;
|
asynStatus comStatus;
|
||||||
|
|
||||||
@@ -332,8 +356,8 @@ asynStatus MD90Axis::poll(bool *moving)
|
|||||||
if (comStatus) goto skip;
|
if (comStatus) goto skip;
|
||||||
// The response string is of the form "0: Home status: 1"
|
// The response string is of the form "0: Home status: 1"
|
||||||
sscanf (pC_->inString_, "%d: %[^:]: %d", &replyStatus, replyString, &replyValue);
|
sscanf (pC_->inString_, "%d: %[^:]: %d", &replyStatus, replyString, &replyValue);
|
||||||
home = (replyValue == '1') ? 1:0;
|
homed = (replyValue == '1') ? 1:0;
|
||||||
setIntegerParam(pC_->motorStatusAtHome_, home);
|
setIntegerParam(pC_->motorStatusHomed_, homed);
|
||||||
|
|
||||||
// Read the drive power on status
|
// Read the drive power on status
|
||||||
sprintf(pC_->outString_, "GPS");
|
sprintf(pC_->outString_, "GPS");
|
||||||
|
@@ -10,7 +10,7 @@ March 1, 2012
|
|||||||
#include "asynMotorController.h"
|
#include "asynMotorController.h"
|
||||||
#include "asynMotorAxis.h"
|
#include "asynMotorAxis.h"
|
||||||
|
|
||||||
#define MAX_MD90_AXES 4
|
#define MAX_MD90_AXES 1
|
||||||
|
|
||||||
// No controller-specific parameters yet
|
// No controller-specific parameters yet
|
||||||
#define NUM_MD90_PARAMS 0
|
#define NUM_MD90_PARAMS 0
|
||||||
@@ -26,8 +26,9 @@ public:
|
|||||||
asynStatus home(double min_velocity, double max_velocity, double acceleration, int forwards);
|
asynStatus home(double min_velocity, double max_velocity, double acceleration, int forwards);
|
||||||
asynStatus stop(double acceleration);
|
asynStatus stop(double acceleration);
|
||||||
asynStatus poll(bool *moving);
|
asynStatus poll(bool *moving);
|
||||||
asynStatus setPosition(double position);
|
|
||||||
asynStatus setClosedLoop(bool closedLoop);
|
asynStatus setClosedLoop(bool closedLoop);
|
||||||
|
asynStatus setIGain(double iGain);
|
||||||
|
asynStatus doMoveToHome();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MD90Controller *pC_; /**< Pointer to the asynMotorController to which this axis belongs.
|
MD90Controller *pC_; /**< Pointer to the asynMotorController to which this axis belongs.
|
||||||
|
@@ -14,9 +14,9 @@ pattern
|
|||||||
# DESC Description
|
# DESC Description
|
||||||
# EGU Engineering units
|
# EGU Engineering units
|
||||||
# DIR Direction
|
# DIR Direction
|
||||||
# VELO Velocity (EGU / s)
|
# VELO Velocity (EGU / s) (note: jog velocity set separately by JVEL)
|
||||||
# VBAS Minimum velocity (EGU / s)
|
# VBAS Minimum velocity (EGU / s)
|
||||||
# VMAX Maximum velocity (EGU / s) (not getting set here with basic_asyn_motor.db)
|
# VMAX Maximum velocity (EGU / s) (note: not getting set here with basic_asyn_motor.db)
|
||||||
# ACCL Acceleration (time in seconds until VELO)
|
# ACCL Acceleration (time in seconds until VELO)
|
||||||
# BDST Backlash distance
|
# BDST Backlash distance
|
||||||
# MRES Motor step size (EGU)
|
# MRES Motor step size (EGU)
|
||||||
|
Reference in New Issue
Block a user