Merge branch 'dev'

This commit is contained in:
2024-08-06 15:39:55 -05:00
3 changed files with 53 additions and 11 deletions

View File

@@ -12,6 +12,8 @@ March 1, 2012
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <chrono>
#include <thread>
#include <iocsh.h> #include <iocsh.h>
#include <epicsThread.h> #include <epicsThread.h>
@@ -219,13 +221,43 @@ asynStatus MD90Axis::move(double position, int relative, double minVelocity, dou
asynStatus MD90Axis::home(double minVelocity, double maxVelocity, double acceleration, int forwards) asynStatus MD90Axis::home(double minVelocity, double maxVelocity, double acceleration, int forwards)
{ {
int sleepTime;
asynStatus status; asynStatus status;
static const char *functionName = "MD90Axis::home"; static const char *functionName = "MD90Axis::home";
status = sendAccelAndVelocity(acceleration, maxVelocity); status = sendAccelAndVelocity(acceleration, maxVelocity);
sprintf(pC_->outString_, "HOM"); // The MD-90 will start the home routine in the direction of the last move
status = pC_->writeReadController(); // Here we first make a small move to set the desired direction before homing
if (!status) {
sprintf(pC_->outString_, "SNS %d", SMALL_NSTEPS);
status = pC_->writeReadController();
}
if (!status) {
status = parseReply(functionName, pC_->inString_);
}
if (forwards) {
sprintf(pC_->outString_, "ESF");
} else {
sprintf(pC_->outString_, "ESB");
}
if (!status) {
status = pC_->writeReadController();
}
if (!status) {
status = parseReply(functionName, pC_->inString_);
}
if (!status) {
// Wait for the move to complete, then home
sleepTime = SLEEP_MARGIN * SMALL_NSTEPS * COUNTS_PER_STEP / maxVelocity;
std::this_thread::sleep_for(std::chrono::seconds(sleepTime));
sprintf(pC_->outString_, "HOM");
status = pC_->writeReadController();
}
if (!status) { if (!status) {
status = parseReply(functionName, pC_->inString_); status = parseReply(functionName, pC_->inString_);
} }

View File

@@ -12,7 +12,9 @@ USAGE... Motor driver support for the DSM MD-90 controller.
// No controller-specific parameters yet // No controller-specific parameters yet
#define NUM_MD90_PARAMS 0 #define NUM_MD90_PARAMS 0
#define COUNTS_PER_STEP 1000.0 //Number of encoder counts per motor step (measured by testing) #define SLEEP_MARGIN 1.2 // Extra factor to wait after stepping before homing
#define SMALL_NSTEPS 5 // Number of steps to take to set direction for homing routine
#define COUNTS_PER_STEP 1000.0 // Number of encoder counts per motor step (measured by testing)
class epicsShareClass MD90Axis : public asynMotorAxis class epicsShareClass MD90Axis : public asynMotorAxis
{ {

View File

@@ -147,32 +147,40 @@ iocInit
# This IOC does not use save/restore, so set values of some PVs # This IOC does not use save/restore, so set values of some PVs
dbpf("DSM:m0.RTRY", "0") dbpf("DSM:m0.RTRY", "0")
dbpf("DSM:m0.TWV", "0.1") dbpf("DSM:m0.TWV", "0.1")
dbpf("DSM:m0.VMAX", "0.625") dbpf("DSM:m0.VMAX", "1.0")
dbpf("DSM:m0.HVEL", "1.0")
dbpf("DSM:m1.RTRY", "0") dbpf("DSM:m1.RTRY", "0")
dbpf("DSM:m1.TWV", "0.1") dbpf("DSM:m1.TWV", "0.1")
dbpf("DSM:m1.VMAX", "0.625") dbpf("DSM:m1.VMAX", "1.0")
dbpf("DSM:m1.HVEL", "1.0")
dbpf("DSM:m2.RTRY", "0") dbpf("DSM:m2.RTRY", "0")
dbpf("DSM:m2.TWV", "0.1") dbpf("DSM:m2.TWV", "0.1")
dbpf("DSM:m2.VMAX", "0.625") dbpf("DSM:m2.VMAX", "1.0")
dbpf("DSM:m2.HVEL", "1.0")
dbpf("DSM:m3.RTRY", "0") dbpf("DSM:m3.RTRY", "0")
dbpf("DSM:m3.TWV", "0.1") dbpf("DSM:m3.TWV", "0.1")
dbpf("DSM:m3.VMAX", "0.625") dbpf("DSM:m3.VMAX", "1.0")
dbpf("DSM:m3.HVEL", "1.0")
dbpf("DSM:m4.RTRY", "0") dbpf("DSM:m4.RTRY", "0")
dbpf("DSM:m4.TWV", "0.1") dbpf("DSM:m4.TWV", "0.1")
dbpf("DSM:m4.VMAX", "0.625") dbpf("DSM:m4.VMAX", "1.0")
dbpf("DSM:m4.HVEL", "1.0")
dbpf("DSM:m5.RTRY", "0") dbpf("DSM:m5.RTRY", "0")
dbpf("DSM:m5.TWV", "0.1") dbpf("DSM:m5.TWV", "0.1")
dbpf("DSM:m5.VMAX", "0.625") dbpf("DSM:m5.VMAX", "1.0")
dbpf("DSM:m5.HVEL", "1.0")
dbpf("DSM:m6.RTRY", "0") dbpf("DSM:m6.RTRY", "0")
dbpf("DSM:m6.TWV", "0.1") dbpf("DSM:m6.TWV", "0.1")
dbpf("DSM:m6.VMAX", "0.625") dbpf("DSM:m6.VMAX", "1.0")
dbpf("DSM:m6.HVEL", "1.0")
dbpf("DSM:m7.RTRY", "0") dbpf("DSM:m7.RTRY", "0")
dbpf("DSM:m7.TWV", "0.1") dbpf("DSM:m7.TWV", "0.1")
dbpf("DSM:m7.VMAX", "0.625") dbpf("DSM:m7.VMAX", "1.0")
dbpf("DSM:m7.HVEL", "1.0")