Andreas Rörig created a new topic ' Slew complete problem' in the forum. 1 year ago

Hi,

I have a problem with a telescope driver I have written. While most things work as expected there is a problem when the Ekos Planer/Scheduler issues a slew command. The slew is executed but the Ekos Scheduler immediately says "Job 'NGC1746' slew is complete" and starts the focus routine while the telescope is still slewing. So I guess I am missing something within my driver to tell Ekos that the slew has not finished yet.
Below is the code of my Goto method.
What am I missing?
Any help is highly appreciated.

bool RasPiMCDriver::Goto(double ra, double dec)
{
    LOG_INFO("Goto called");

    string url = baseUrl;
    url = url + "?cmd=GotoRaDec&ra=" + to_string(ra * DEGREE_PER_HOUR) + "&de=" + to_string(dec);

    // Mark state as slewing
    TrackState = SCOPE_SLEWING;
    //LOG_INFO(url.c_str());

    // Send slew command to telescope
    string resp = HttpGet(url);

    // Mark state as slewing
    TrackState = SCOPE_SLEWING;
    EqNP.s = IPS_BUSY;

    // Wait until the mount system status changes to SLEWING
    // up to 3000ms
    for (int i = 0; i < 15; i++)
    {
        if (isSlewing())
            break;
        std::this_thread::sleep_for(std::chrono::milliseconds(200));
    }

    //LOG_INFO(resp.c_str());

    return true;
}

bool  RasPiMCDriver::isSlewing()
{
        bool result = false;
        //LOG_INFO("isSlewing called.");

    	string url = baseUrl;

    	url = url + "?cmd=isSlewing";

    	string resp = HttpGet(url);

    	// convert to bool
    	istringstream(resp) >> std::boolalpha >> result;
        LOGF_INFO("isSlewing returned %d", result);
        if (result)
        {
        	// Mark state as slewing
        	TrackState = SCOPE_SLEWING;
                EqNP.s = IPS_BUSY;
        }

    	return result;
}

Best regards
Andreas

Read More...