commitd90869cbcaAuthor: smathis <stefan.mathis@psi.ch> Date: Tue Feb 10 13:18:43 2026 +0100 Added reminder comment commiteadce0f594Author: smathis <stefan.mathis@psi.ch> Date: Tue Feb 10 12:31:01 2026 +0100 Draft velocity mode See TODO in src/masterMacsAxis.cpp, line 552. The velocity readback is the only thing that doesn't work properly, everything else does work. Once a solution has been found here, this can be a new minor release. commit0e1f95a94bAuthor: smathis <stefan.mathis@psi.ch> Date: Tue Feb 10 09:04:04 2026 +0100 Updated sinqMotor and use setLimits commitb01f398533Author: smathis <stefan.mathis@psi.ch> Date: Tue Feb 10 09:00:58 2026 +0100 Set move flag correctly in velocity / jog mode commit56d9d20c3aAuthor: smathis <stefan.mathis@psi.ch> Date: Tue Feb 3 17:57:00 2026 +0100 Simplified handling of velocity mode using standard EPICS motor record fields commit4634609891Author: smathis <stefan.mathis@psi.ch> Date: Tue Feb 3 13:35:24 2026 +0100 Rolled back to sinqMotor 1.5.7
377 lines
10 KiB
C++
377 lines
10 KiB
C++
#ifndef masterMacsAXIS_H
|
|
#define masterMacsAXIS_H
|
|
#include "masterMacsController.h"
|
|
#include "sinqAxis.h"
|
|
#include <memory>
|
|
|
|
struct HIDDEN masterMacsAxisImpl;
|
|
|
|
class HIDDEN masterMacsAxis : public sinqAxis {
|
|
public:
|
|
/**
|
|
* @brief Construct a new masterMacsAxis
|
|
*
|
|
* @param pController Pointer to the associated controller
|
|
* @param axisNo Index of the axis
|
|
*/
|
|
masterMacsAxis(masterMacsController *pController, int axisNo);
|
|
|
|
/**
|
|
* @brief Delete the copy and copy assignment constructors, because this
|
|
* class should not be copied (it is tied to hardware!)
|
|
*/
|
|
masterMacsAxis(const masterMacsAxis &) = delete;
|
|
masterMacsAxis &operator=(const masterMacsAxis &) = delete;
|
|
|
|
/**
|
|
* @brief Destroy the masterMacsAxis
|
|
*
|
|
*/
|
|
virtual ~masterMacsAxis();
|
|
|
|
/**
|
|
* @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 TODO
|
|
*
|
|
* @param minVelocity
|
|
* @param maxVelocity
|
|
* @param acceleration
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus moveVelocity(double minVelocity, double maxVelocity,
|
|
double acceleration);
|
|
|
|
/**
|
|
* @brief Implementation of the `doMove` function from sinqAxis. The
|
|
* parameters are described in the documentation of `sinqAxis::doMove`.
|
|
*
|
|
* @param position
|
|
* @param relative
|
|
* @param minVelocity
|
|
* @param maxVelocity
|
|
* @param acceleration
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus doMove(double position, int relative, double minVelocity,
|
|
double maxVelocity, double acceleration);
|
|
|
|
/**
|
|
* @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 `doReset` function from sinqAxis.
|
|
*
|
|
* @param on
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus doReset();
|
|
|
|
/**
|
|
* @brief Performs a "node reset" on the axis as defined in the CANopen
|
|
* standard
|
|
*
|
|
* A "node reset" is a factory reset on the axis which completely deletes
|
|
* all configured information (e.g. limits or speed) from the axis. The
|
|
* MasterMACS controller then reapplies the initial configuration to this
|
|
* axis. It can therefore be seen as a "hard" version of the normal error
|
|
* reset performed by the `doReset` method.
|
|
*
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus nodeReset();
|
|
|
|
/**
|
|
* @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 accordint to the initial status of the axis.
|
|
*
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus init();
|
|
|
|
/**
|
|
* @brief Enable / disable the axis.
|
|
*
|
|
* @param on
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus enable(bool on);
|
|
|
|
/**
|
|
* @brief Write the new operation mode (position or velocity) to the
|
|
* MasterMACS controller.
|
|
*
|
|
* @param mode
|
|
* @return asynStatus
|
|
*/
|
|
asynStatus setMode(int mode);
|
|
|
|
/**
|
|
* @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 Check if the axis needs to run its initialization function
|
|
*
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool needInit();
|
|
|
|
/**
|
|
* @brief Instruct the axis to run its init() function during the next
|
|
* poll
|
|
*
|
|
* @param needInit
|
|
*/
|
|
void setNeedInit(bool needInit);
|
|
|
|
/**
|
|
* @brief Return a pointer to the axis controller
|
|
*/
|
|
virtual masterMacsController *pController() override { return pC_; };
|
|
|
|
/**
|
|
* @brief Read the Master MACS status with the xR10 command and store
|
|
* the result in axisStatus (see masterMacsAxisImpl redefinition in
|
|
* masterMacsAxis.cpp)
|
|
*
|
|
*/
|
|
asynStatus readAxisStatus();
|
|
|
|
/**
|
|
* @brief Read the upper and lower limits and store them in the parameter
|
|
* library.
|
|
*/
|
|
asynStatus readLimits();
|
|
|
|
/*
|
|
The functions below read the specified status bit from the axisStatus (see
|
|
masterMacsAxisImpl redefinition in masterMacsAxis.cpp) bitset. Since a bit
|
|
can either be 0 or 1, the return value is given as a boolean.
|
|
*/
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool readyToBeSwitchedOn();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool switchedOn();
|
|
|
|
// Bit 2 is unused
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool faultConditionSet();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool voltagePresent();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool quickStopping();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool switchOnDisabled();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool warning();
|
|
|
|
// Bit 8 is unused
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool remoteMode();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool targetReached();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool internalLimitActive();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool speedEqualZero();
|
|
|
|
// Bits 12 and 13 are unused
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool setEventHasOcurred();
|
|
|
|
/**
|
|
* @brief Read the property from axisStatus (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool powerEnabled();
|
|
|
|
/**
|
|
* @brief Read the Master MACS error with the xR10 command and store
|
|
* the result in axisError (see masterMacsAxisImpl redefinition in
|
|
* masterMacsAxis.cpp)
|
|
*
|
|
*/
|
|
asynStatus readAxisError();
|
|
|
|
/*
|
|
The functions below read the specified error bit from the axisError (see
|
|
masterMacsAxisImpl redefinition in masterMacsAxis.cpp) bitset. Since a bit
|
|
can either be 0 or 1, the return value is given as a boolean.
|
|
*/
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool shortCircuit();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool encoderError();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool followingError();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool communicationError();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool feedbackError();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool positiveLimitSwitch();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool negativeLimitSwitch();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool positiveSoftwareLimit();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool negativeSoftwareLimit();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool overCurrent();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool overTemperature();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool overVoltage();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool underVoltage();
|
|
|
|
/**
|
|
* @brief Read the property from axisError (see masterMacsAxisImpl
|
|
* redefinition in masterMacsAxis.cpp)
|
|
*/
|
|
bool stoFault();
|
|
|
|
private:
|
|
masterMacsController *pC_;
|
|
std::unique_ptr<masterMacsAxisImpl> pMasterMacsA_;
|
|
};
|
|
|
|
#endif
|