asibfm700_servocontroller.cpp: LibSidServo's AXIS_GONNASTOP hardware
state flag processing is added asibfm700_mount.cpp: in slew-and-track mode waiting for HW_MOVE_GUIDING flag to switch from slew to track mode is implemented
This commit is contained in:
@@ -551,11 +551,11 @@ Asibfm700Mount::error_t Asibfm700Mount::slewingImpl(bool slew_and_stop)
|
||||
// if mount is already slewing then stop and re-slew
|
||||
if (_mountStatus->load() == mount_status_t::MOUNT_STATUS_SLEWING ||
|
||||
_mountStatus->load() == mount_status_t::MOUNT_STATUS_ADJUSTING) {
|
||||
// *_lastMountError = stoppingImpl();
|
||||
// *_lastMountError = stoppingImpl();
|
||||
|
||||
// if (_lastMountError->load()) {
|
||||
// return _lastMountError->load();
|
||||
// }
|
||||
// if (_lastMountError->load()) {
|
||||
// return _lastMountError->load();
|
||||
// }
|
||||
}
|
||||
|
||||
*_stopMovementRequest = false;
|
||||
@@ -623,9 +623,9 @@ Asibfm700Mount::error_t Asibfm700Mount::slewingImpl(bool slew_and_stop)
|
||||
typename hardware_t::hardware_state_t hw_state;
|
||||
using ep_t = decltype(hw_state.XY.epoch());
|
||||
|
||||
if (slew_and_stop){
|
||||
if (slew_and_stop) {
|
||||
hw_state.movementState = hardware_t::hardware_movement_state_t::HW_MOVE_SLEWING;
|
||||
} else { // set to "HW_MOVE_ADJUSTING" to call LibSidServo's 'correctTo' function
|
||||
} else { // set to "HW_MOVE_ADJUSTING" to call LibSidServo's 'correctTo' function
|
||||
hw_state.movementState = hardware_t::hardware_movement_state_t::HW_MOVE_ADJUSTING;
|
||||
}
|
||||
hw_state.XY.setX(tdata.targetXY.x());
|
||||
@@ -731,10 +731,16 @@ Asibfm700Mount::error_t Asibfm700Mount::slewingImpl(bool slew_and_stop)
|
||||
} else {
|
||||
dist = tdata.mountPos.distance(tdata.targetPos);
|
||||
|
||||
if (dist.dist <= getMovementParams().slewToleranceRadius) {
|
||||
logInfo("target-to-mount distance is lesser than slew acceptable radius - exit!");
|
||||
|
||||
break;
|
||||
if (tdata.hwState.movementState == hardware_t::hardware_movement_state_t::HW_MOVE_GUIDING) {
|
||||
logInfo("mount position is near target one (target-to-mount distance: {})",
|
||||
mcc::impl::MccAngleFancyString(dist.dist));
|
||||
|
||||
if (dist.dist <= getMovementParams().slewToleranceRadius) {
|
||||
logInfo("target-to-mount distance is lesser than slew acceptable radius - exit!");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// LibSidServo.correctTo
|
||||
@@ -998,19 +1004,19 @@ Asibfm700Mount::error_t Asibfm700Mount::stoppingImpl()
|
||||
*_lastMountError = _servolController.hardwareGetState(&hw_state);
|
||||
|
||||
logDebug(" wait for mount stopping (timeout is {} seconds) ...", timeout.count());
|
||||
// logDebug(" wait for mount stopping (timeout is {} seconds) ...",
|
||||
// _mountConfig.getValue<std::chrono::seconds>("stopTimeout").value().count());
|
||||
// logDebug(" wait for mount stopping (timeout is {} seconds) ...",
|
||||
// _mountConfig.getValue<std::chrono::seconds>("stopTimeout").value().count());
|
||||
while (hw_state.movementState != AsibFM700ServoController::hardware_movement_state_t::HW_MOVE_STOPPED &&
|
||||
!_lastMountError->load()) {
|
||||
if ((std::chrono::steady_clock::now() - start_tp) > timeout) {
|
||||
*_lastMountError = mcc::impl::MccGenericMovementControlsErrorCode::ERROR_STOP_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
// if ((std::chrono::steady_clock::now() - start_tp) >
|
||||
// _mountConfig.getValue<std::chrono::seconds>("stopTimeout").value()) {
|
||||
// *_lastMountError = mcc::impl::MccGenericMovementControlsErrorCode::ERROR_STOP_TIMEOUT;
|
||||
// break;
|
||||
// }
|
||||
// if ((std::chrono::steady_clock::now() - start_tp) >
|
||||
// _mountConfig.getValue<std::chrono::seconds>("stopTimeout").value()) {
|
||||
// *_lastMountError = mcc::impl::MccGenericMovementControlsErrorCode::ERROR_STOP_TIMEOUT;
|
||||
// break;
|
||||
// }
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(300));
|
||||
|
||||
|
||||
@@ -118,35 +118,35 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareSetState(har
|
||||
if (state.movementState == hardware_movement_state_t::HW_MOVE_STOPPING) { // stop!
|
||||
err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.stop());
|
||||
|
||||
/*
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
/*
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
hardware_state_t hw_state;
|
||||
hardware_state_t hw_state;
|
||||
|
||||
auto start_tp = std::chrono::steady_clock::now();
|
||||
auto start_tp = std::chrono::steady_clock::now();
|
||||
|
||||
// poll hardware till stopped-state detected ...
|
||||
while (true) {
|
||||
err = hardwareGetState(&hw_state);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
// poll hardware till stopped-state detected ...
|
||||
while (true) {
|
||||
err = hardwareGetState(&hw_state);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (hw_state.movementState == hardware_movement_state_t::HW_MOVE_STOPPED) {
|
||||
break;
|
||||
}
|
||||
if (hw_state.movementState == hardware_movement_state_t::HW_MOVE_STOPPED) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((std::chrono::steady_clock::now() - start_tp) > _hardwareConfig.pollingTimeout) {
|
||||
err = AsibFM700ServoControllerErrorCode::ERROR_POLLING_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
if ((std::chrono::steady_clock::now() - start_tp) > _hardwareConfig.pollingTimeout) {
|
||||
err = AsibFM700ServoControllerErrorCode::ERROR_POLLING_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(_hardwareConfig.pollingInterval);
|
||||
}
|
||||
std::this_thread::sleep_for(_hardwareConfig.pollingInterval);
|
||||
}
|
||||
|
||||
*/
|
||||
*/
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -204,6 +204,8 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareGetState(har
|
||||
|
||||
if (mdata.Xstate == AXIS_ERROR || mdata.Ystate == AXIS_ERROR) {
|
||||
state->movementState = hardware_movement_state_t::HW_MOVE_ERROR;
|
||||
} else if (mdata.Xstate == AXIS_GONNASTOP || mdata.Ystate == AXIS_GONNASTOP) {
|
||||
state->movementState = hardware_movement_state_t::HW_MOVE_STOPPING;
|
||||
} else {
|
||||
if (mdata.Xstate == AXIS_STOPPED) {
|
||||
if (mdata.Ystate == AXIS_STOPPED) {
|
||||
|
||||
Reference in New Issue
Block a user