...
This commit is contained in:
@@ -106,27 +106,26 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareInit()
|
||||
|
||||
AsibFM700ServoController::error_t AsibFM700ServoController::hardwareSetState(hardware_state_t state)
|
||||
{
|
||||
static thread_local coordval_pair_t cvalpair{.X{0.0, 0.0}, .Y{0.0, 0.0}};
|
||||
static thread_local coordpair_t cpair{.X = 0.0, .Y = 0.0};
|
||||
std::lock_guard lock{*_setStateMutex};
|
||||
|
||||
// static thread_local coordval_pair_t cvalpair{.X{0.0, 0.0}, .Y{0.0, 0.0}};
|
||||
// static thread_local coordpair_t cpair{.X = 0.0, .Y = 0.0};
|
||||
|
||||
// cvalpair.X = {.val = state.Y, .t = tp};
|
||||
// cvalpair.Y = {.val = state.X, .t = tp};
|
||||
|
||||
// cpair.X = state.tagY;
|
||||
// cpair.Y = state.tagX;
|
||||
|
||||
// time point from sidservo library is 'double' number represented UNIXTIME with
|
||||
// microseconds/nanoseconds precision
|
||||
double tp = std::chrono::duration<double>(state.time_point.time_since_epoch()).count();
|
||||
|
||||
std::lock_guard lock{*_setStateMutex};
|
||||
|
||||
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
||||
// coordval_pair_t cvalpair{.X{.val = state.Y, .t = tp}, .Y{.val = state.X, .t = tp}};
|
||||
// coordpair_t cpair{.X = state.Y, .Y = state.X};
|
||||
// coordpair_t cpair{.X = state.Y + mcc::MccAngle(1.0_degs), .Y = state.X + mcc::MccAngle(1.0_degs)};
|
||||
coordval_pair_t cvalpair{.X{.val = state.Y, .t = tp}, .Y{.val = state.X, .t = tp}};
|
||||
coordpair_t cpair{.X = state.endptY, .Y = state.endptX};
|
||||
|
||||
|
||||
cvalpair.X = {.val = state.Y, .t = tp};
|
||||
cvalpair.Y = {.val = state.X, .t = tp};
|
||||
|
||||
cpair.X = state.Y;
|
||||
cpair.Y = state.X;
|
||||
|
||||
// correctTo is asynchronous function!!!
|
||||
//
|
||||
// according to the Eddy's implementation of the LibSidServo library it is safe
|
||||
@@ -154,11 +153,13 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareGetState(har
|
||||
using secs_t = std::chrono::duration<double>;
|
||||
|
||||
secs_t secs = secs_t{mdata.encXposition.t};
|
||||
if (mcc::utils::isEqual(secs.count(), 0.0)) { // model mode?
|
||||
state->time_point = decltype(state->time_point)::clock::now();
|
||||
} else {
|
||||
state->time_point = tp_t{std::chrono::duration_cast<tp_t::duration>(secs)};
|
||||
}
|
||||
state->time_point = tp_t{std::chrono::duration_cast<tp_t::duration>(secs)};
|
||||
|
||||
// if (mcc::utils::isEqual(secs.count(), 0.0)) { // model mode?
|
||||
// state->time_point = decltype(state->time_point)::clock::now();
|
||||
// } else {
|
||||
// state->time_point = tp_t{std::chrono::duration_cast<tp_t::duration>(secs)};
|
||||
// }
|
||||
// WARNING: TEMPORARY (WAIT FOR Eddy fix its implementation of LibSidServo)!!!
|
||||
// state->time_point = decltype(state->time_point)::clock::now();
|
||||
|
||||
|
||||
@@ -78,6 +78,12 @@ public:
|
||||
axis_status_t stateX, stateY; // Eddy's LibSidServo axis state
|
||||
|
||||
hardware_moving_state_t moving_state;
|
||||
|
||||
// endpoint: a point on the trajectory of movement behind the guidance point (X,Y), taking into account
|
||||
// the movement vector (i.e. sign of movement speed)
|
||||
// this point is needed as Sidereal controller commands require not only moving speed but
|
||||
// also 'target' point (point at which mount will stop)
|
||||
double endptX, endptY;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user