136 lines
3.6 KiB
C++
136 lines
3.6 KiB
C++
#ifndef turboPmacAXIS_H
|
|
#define turboPmacAXIS_H
|
|
#include "sinqAxis.h"
|
|
|
|
// Forward declaration of the controller class to resolve the cyclic dependency
|
|
// between the controller and the axis .h-file. See
|
|
// https://en.cppreference.com/w/cpp/language/class.
|
|
class turboPmacController;
|
|
|
|
class turboPmacAxis : public sinqAxis {
|
|
public:
|
|
/**
|
|
* @brief Construct a new turboPmacAxis
|
|
*
|
|
* @param pController Pointer to the associated controller
|
|
* @param axisNo Index of the axis
|
|
*/
|
|
turboPmacAxis(turboPmacController *pController, int axisNo,
|
|
bool initialize = true);
|
|
|
|
/**
|
|
* @brief Destroy the turboPmacAxis
|
|
*
|
|
*/
|
|
virtual ~turboPmacAxis();
|
|
|
|
/**
|
|
* @brief Implementation of the `stop` function from asynMotorAxis
|
|
*
|
|
* @param acceleration Acceleration ACCEL from the motor record. This
|
|
* value is currently not used.
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus stop(double acceleration);
|
|
|
|
/**
|
|
* @brief Implementation of the `doHome` function from sinqAxis. The
|
|
* parameters are described in the documentation of `sinqAxis::doHome`.
|
|
*
|
|
* @param minVelocity
|
|
* @param maxVelocity
|
|
* @param acceleration
|
|
* @param forwards
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus doHome(double minVelocity, double maxVelocity,
|
|
double acceleration, int forwards);
|
|
|
|
/**
|
|
* @brief Implementation of the `doPoll` function from sinqAxis. The
|
|
* parameters are described in the documentation of `sinqAxis::doPoll`.
|
|
*
|
|
* @param moving
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus doPoll(bool *moving);
|
|
|
|
/**
|
|
* @brief Implementation of the `doMove` function from sinqAxis. The
|
|
* parameters are described in the documentation of `sinqAxis::doMove`.
|
|
*
|
|
* @param position
|
|
* @param relative
|
|
* @param min_velocity
|
|
* @param max_velocity
|
|
* @param acceleration
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus doMove(double position, int relative, double min_velocity,
|
|
double max_velocity, double acceleration);
|
|
|
|
/**
|
|
* @brief Readout of some values from the controller at IOC startup
|
|
*
|
|
* The following steps are performed:
|
|
* - Read out the motor status, motor position, velocity and acceleration
|
|
* from the MCU and store this information in the parameter library.
|
|
* - Set the enable PV according to the initial status of the axis.
|
|
*
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus init();
|
|
|
|
/**
|
|
* @brief Implementation of the `doReset` function from sinqAxis.
|
|
*
|
|
* @param on
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus doReset();
|
|
|
|
/**
|
|
* @brief Enable / disable the axis.
|
|
*
|
|
* @param on
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus enable(bool on);
|
|
|
|
/**
|
|
* @brief Read the encoder type (incremental or absolute) for this axis from
|
|
* the MCU and store the information in the PV ENCODER_TYPE.
|
|
*
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus readEncoderType();
|
|
|
|
/**
|
|
* @brief Trigger a rereading of the encoder position.
|
|
*
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus rereadEncoder();
|
|
|
|
/**
|
|
* @brief Interpret the error code and populate the user message accordingly
|
|
*
|
|
* @param error
|
|
* @param userMessage
|
|
* @param sizeUserMessage
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus handleError(int error, char *userMessage, int sizeUserMessage);
|
|
|
|
protected:
|
|
turboPmacController *pC_;
|
|
|
|
bool waitForHandshake_;
|
|
time_t timeAtHandshake_;
|
|
|
|
// The axis status is used when enabling / disabling the motor
|
|
int axisStatus_;
|
|
};
|
|
|
|
#endif
|