Motor driver for the xHuber SMC9300, courtesy of Dongliang Yang (noya269@126.com). This is an improved version of what Dongliang provided. In particular SMC9300Axis::poll - add a new parameter for the messge text that comes from the controller - parse pC_->inString_ using sscanf and check that the reply has all the expected parameters - make usre that the whole poll is executed. For some reason the original version did not update the position during the movement
58 lines
1.9 KiB
C++
58 lines
1.9 KiB
C++
/*
|
|
FILENAME... SMC9300Driver.h
|
|
USAGE... Motor driver support for the HUBER SMC9300 controller.
|
|
|
|
Yang Dongliang
|
|
March 1, 2020
|
|
|
|
*/
|
|
|
|
#include "asynMotorController.h"
|
|
#include "asynMotorAxis.h"
|
|
|
|
#define MAX_SMC9300_AXES 4
|
|
|
|
// No controller-specific parameters yet
|
|
#define NUM_SMC9300_PARAMS 0
|
|
|
|
#define motorMessageTextString "MOTOR_MESSAGE_TEXT"
|
|
|
|
class epicsShareClass SMC9300Axis : public asynMotorAxis
|
|
{
|
|
public:
|
|
/* These are the methods we override from the base class */
|
|
SMC9300Axis(class SMC9300Controller *pC, int axis);
|
|
void report(FILE *fp, int level);
|
|
asynStatus move(double position, int relative, double min_velocity, double max_velocity, double acceleration);
|
|
asynStatus moveVelocity(double min_velocity, double max_velocity, double acceleration);
|
|
asynStatus home(double min_velocity, double max_velocity, double acceleration, int forwards);
|
|
asynStatus stop(double acceleration);
|
|
asynStatus poll(bool *moving);
|
|
asynStatus setPosition(double position);
|
|
asynStatus setClosedLoop(bool closedLoop);
|
|
asynStatus getAxisInitialStatus(void);
|
|
|
|
|
|
protected:
|
|
SMC9300Controller *pC_; /**< Pointer to the asynMotorController to which this axis belongs.
|
|
* Abbreviated because it is used very frequently */
|
|
// asynStatus sendAccelAndVelocity(double accel, double velocity);
|
|
asynStatus updateMsgTxtFromDriver(const char *value);
|
|
|
|
friend class SMC9300Controller;
|
|
};
|
|
|
|
class epicsShareClass SMC9300Controller : public asynMotorController {
|
|
public:
|
|
SMC9300Controller(const char *portName, const char *SMC9300PortName, int numAxes, double movingPollPeriod, double idlePollPeriod, const int &extraParams );
|
|
|
|
void report(FILE *fp, int level);
|
|
SMC9300Axis* getAxis(asynUser *pasynUser);
|
|
SMC9300Axis* getAxis(int axisNo);
|
|
|
|
protected:
|
|
int motorMessageText_;
|
|
|
|
friend class SMC9300Axis;
|
|
};
|