24#ifndef POSITIONCONTROLLER_H_
25#define POSITIONCONTROLLER_H_
27#include <SAL_MTM1M3C.h>
29#include <HardpointActuatorSettings.h>
30#include <PositionControllerSettings.h>
31#include <SafetyController.h>
33#include <cRIO/DataTypes.h>
39typedef enum { NO_WAIT, CAN_WAIT, WAITING, ALREADY_WAITED } wait_tension_t;
71 int getLowerTimeout() {
return _positionControllerSettings->lowerTimeout; }
73 bool enableChaseAll();
74 void disableChaseAll();
89 bool motionComplete();
110 bool move(int32_t *steps);
111 bool moveToEncoder(int32_t *encoderValues);
125 bool moveToAbsolute(
double x,
double y,
double z,
double rX,
double rY,
double rZ);
126 bool moveToReferencePosition();
140 bool translate(
double x,
double y,
double z,
double rX,
double rY,
double rZ);
185 void _convertToSteps(int32_t *steps,
double x,
double y,
double z,
double rX,
double rY,
double rZ);
187 void _checkFollowingError(
int hp);
189 void _resetWaitTension();
191 PositionControllerSettings *_positionControllerSettings;
192 HardpointActuatorSettings *_hardpointActuatorSettings;
194 MTM1M3_hardpointActuatorDataC *_hardpointActuatorData;
195 MTM1M3_logevent_hardpointActuatorStateC *_hardpointActuatorState;
196 MTM1M3_logevent_hardpointActuatorInfoC *_hardpointInfo;
198 int32_t _scaledMaxStepsPerLoop[HP_COUNT];
199 int32_t _targetEncoderValues[HP_COUNT];
200 int32_t _stableEncoderCount[HP_COUNT];
201 int32_t _unstableEncoderCount[HP_COUNT];
203 int32_t _lastEncoderCount[HP_COUNT];
204 wait_tension_t _waitTension[HP_COUNT];
205 uint16_t _raisingLoweringInRangeSamples[HP_COUNT];
207 SafetyController *_safetyController;
Controls M1M3 position.
Definition PositionController.h:61
bool hpRaiseLowerForcesInTolerance(bool raise)
Checks that hardpoint forces are in tolerance for mirror raising and lowering.
Definition PositionController.cpp:114
bool moveToLowerPosition()
Moves mirror to position ideal for lowering.
Definition PositionController.cpp:415
void checkLimits(int hp)
Check the hardpoint doesn't try to move past limits.
Definition PositionController.cpp:548
void stopMotion(int hardpointIndex=-1)
Stops HP motion.
Definition PositionController.cpp:434
bool move(int32_t *steps)
Move HPs by given steps.
Definition PositionController.cpp:291
int getRaiseTimeout()
Returns raise and lower timeout.
Definition PositionController.h:70
bool moveHardpoint(int32_t steps, int hpIndex)
Move single hardpoint specified number of steps.
Definition PositionController.cpp:263
void updateSteps()
Called in any enabled state (raised, parked, ..).
Definition PositionController.cpp:451
bool moveToAbsolute(double x, double y, double z, double rX, double rY, double rZ)
Commands mirror to move to new position.
Definition PositionController.cpp:396