#ifndef seleneOffsetAxis_H #define seleneOffsetAxis_H #include "turboPmacAxis.h" // Forward declaration of the seleneLiftAxis class to resolve the cyclic // dependency between the seleneLiftAxis and the seleneAngleAxis .h-file. // See https://en.cppreference.com/w/cpp/language/class. class seleneLiftAxis; // Forward declaration of the seleneGuideController class to resolve the cyclic // dependency. See https://en.cppreference.com/w/cpp/language/class. class seleneGuideController; /** * @brief Virtual axis for setting the offset of a motor of the Selene guide * * Please see README.md for a detailed explanation. */ class seleneOffsetAxis : public turboPmacAxis { public: /** * @brief Construct a new selene Offset Axis object * * @param pController Pointer to the associated controller * @param axisNo Index of the axis * @param xPos x-Offset of this axis to the origin * @param zPos z-Offset of this axis to the origin */ seleneOffsetAxis(seleneGuideController *pController, int axisNo, double xPos, double zPos); /** * @brief Initialize this offset axis * * This function is started from seleneLiftAxis. * * @return asynStatus */ asynStatus init(); /** * @brief Implementation of the `doPoll` function from sinqAxis. * * * @param moving * @return asynStatus */ asynStatus doPoll(bool *moving); /** * @brief Move the offset position of this axis to parameter "position". * * @param position * @param relative * @param min_velocity * @param maxOffset_velocity * @param acceleration * @return asynStatus */ asynStatus doMove(double position, int relative, double min_velocity, double maxOffset_velocity, double acceleration); /** * @brief This function does nothing, since this axis cannot be enabled / * disabled * * @param on * @return asynStatus */ asynStatus enable(bool on); /** * @brief Calculate the member variables `absolutePositionLiftCS_` and * `motorPosition` based on the given encoder position. * * @param encoderPosition * @return asynStatus */ asynStatus setPositionsFromEncoderPosition(double encoderPosition); /** * @brief Read the target position from the axis and write it into the * provided pointer. * * @param targetPosition * @return asynStatus */ asynStatus targetPosition(double *targetPosition); /** * @brief Set the offsets of axis 3 and 4 to zero and recalculate all other * axes positions based on it. * * This function does not communicate with the controller. * * @return asynStatus */ asynStatus normalizePositions(); /** * @brief Returns the horizontal distance from the origin * */ double xOffset() { return xOffset_; } /** * @brief Returns the vertical distance of the axis' zero position from the * origin * */ double zOffset() { return zOffset_; } /** * @brief Return the absolute high limit of the underlying physical axis in * lift coordinates, taking the zOffset into account. * * @return double */ double absoluteHighLimitLiftCS() { return absoluteHighLimitLiftCS_; } /** * @brief Return the absolute low limit of the underlying physical axis in * lift coordinates, taking the zOffset into account. * * @return double */ double absoluteLowLimitLiftCS() { return absoluteLowLimitLiftCS_; } protected: // True, if the target has been set from this axis bool targetSet_; // Absolute position in the lift coordinate system = absolute position // corrected by zOffset. double absolutePositionLiftCS_; // Position of the motor axis on the line defined by the liftAxis and the // angleAxis position in mm. double liftPosition_; // Horizontal distance from the origin double xOffset_; // Vertical distance from the origin double zOffset_; // Distance of the motor to the limits read from the controller double distHighLimit_; double distLowLimit_; // Absolute limits read out from the encoder in the lift coordinate system double absoluteHighLimitLiftCS_; double absoluteLowLimitLiftCS_; // Equal to the motor record fields HLM and LLM from the substitution file double highLimit_; double lowLimit_; seleneGuideController *pC_; seleneLiftAxis *liftAxis_; /* The lift axis needs the ability to write to some of the members of this axis (e.g. it needs to be able to insert a pointer to itself into the member variable liftAxis_). */ friend class seleneLiftAxis; }; #endif