×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Manual slewing on EQ6-R Pro using built in USB port results in slewing forever

  • Posts: 9
  • Thank you received: 0
Thank you Kevin. Sorry for some reason I cannot post reply earlier.

Cheers
1 year 8 months ago #85777

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
So I spent the day messing around with this. It does appear you were on the right track when you suggested the lower baud rate of the hand controller might be why it's working. It seems at 115200 baud, I have to add a small delay after sending commands in order for it to properly recognize the commands. Without the delay, when doing manual slews, it wouldn't process the commands properly.

I was getting the problem where it would slew uncontrollably, and not respond. It would even slew at the wrong speed, causing the terrible noise (stepper motor missing steps because it's being driven too fast).

However, I never got the "extra" go commands that you saw. I never got a "spurious" J1 followed by a K1.

Are you able to build the indi-eqmod driver from source? If so, I'd like you to try adding the small delay after sending commands to see if it fixes the problem for you.

In the indi-eqmod folder, in the skywatcher.cpp file, around line 1730, after the read_eqmod call, and before the "return true", add the following lines:
                struct timespec wait;
                wait.tv_sec  = 0;
                wait.tv_nsec = 100000000; // 100ms
                nanosleep(&wait, nullptr);

So the final result looks like this:
        try
        {
            if (read_eqmod())
            {
                if (i > 0)
                {
                    LOGF_WARN("%s() : serial port read failed for %dms (%d retries), verify mount link.", __FUNCTION__, (i*EQMOD_TIMEOUT)/1000, i);
                }
 
                struct timespec wait;
                wait.tv_sec  = 0;
                wait.tv_nsec = 100000000; // 100ms
                nanosleep(&wait, nullptr);
 
                return true;
            }
        }
        catch (EQModError)
        {
            // By this time, we just rethrow the error
            // JM 2018-05-07 immediately rethrow if GET_FEATURES_CMD
            if (i == EQMOD_MAX_RETRY - 1 || cmd == GetFeatureCmd)
                throw;
        }
1 year 8 months ago #85807

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
Looks like the delay has fixed the problem. Kudos!!

I did some additional testing on the double slew start. Turns out it's a problem of my setup. I run VNC on the mini PC and use an ipad client to connect to it so I can control it when I'm near the mount. My actual desktop computer is in the basement. I never dared to try slewing from the basement in fear of not able to reach the mount and shut it off before it runs my telescope into the ground. Problem though, is that with the iPad VNC client, to perform a click and hold, I need to double tap the screen with the second tap being a hold. This potentially is transmitted to the VNC server as a second click. I don't know how to record mouse click events in X11 so I can't be sure. With the delay in place, my mount now slews properly albeit still seeing two slew starts. After I let go of the slew button, it would come to a stop, start again, and then stop again but properly. This observation emboldened me to try slewing from the basement using a desktop VNC client, and lo and behold I'm only seeing one slew event. So it's likely the ipad vnc client that is causing the double slewing.

Thank you again for the quick fix!

Cheers and Clear Sky!
1 year 8 months ago #85808

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
I'm glad this fixed the problem for you.

However, I'm concerned. Why does manually slewing need this delay and nothing else needs it? Why does it need it? It's not like we're sending a bunch of commands in bulk. We send one command, wait for a response, send another command, wait for a response, etc.

:shrug:

It works. I guess that's the important part. :D
1 year 8 months ago #85810

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
Yup as long as it works :)

I had some more time playing with the setup now. I did notice a potential side effect of the delay. The symptom is that, when I use the "slew to target" function in the alignment module, I seemingly can never get the error to be under 40 arc-second no matter how many time the alignment module tries to correct. Before the code change I can easily get under 20 arc-second, usually within 2 corrections. If I understood the code correctly, this 100ms delay is introduced for ALL commands going to the mount (including the polling of axis position and motor status). I wonder if this causes enough total delay between plate solving and the actual mount movement to result in ~40" slewing error. Furthermore, I wonder if the delay could potentially causes other side effects.

I'm already running an imaging sequence for tonight but tomorrow I can try to flip back to the old code and see if I can pin this on the code change.
1 year 8 months ago #85812

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
Well, some clouds rolled in so I did some A/B testing. Looks like the delay code is indeed causing Slew to Target inaccuracies.

Due to fear of uncontrollable axis spinning, I went back to the hand controller PC Direct mode. If I comment out the delay code, I get consistently high "Slew to Target" accuracy. Tested with a few objects all over the sky, I usually get under 20" accuracy with the second image capture. I then un-commented the delay code. My accuracy now would always fall somewhere between 50" and 30", and never below 20". I then commented out the code again, and yup, my accuracy went back up.

I also noticed that my internal guiding error has doubled. I normally get 0.8" RMS. With the delay code, I'm reading the upper 1" and sometimes even 2.5" errors. Admittedly this is a different night. But my RMS has been stable for quite some time now and seeing it at 2" is definitely strange.
Last edit: 1 year 8 months ago by Yi.
1 year 8 months ago #85814

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
Yeah, I was afraid there would be side effects. I will continue trying to take a more targeted approach instead of the shotgun approach.
1 year 8 months ago #85815

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
I think I found the real culprit. It seems it's the extra "K1/K2" commands (stop axis commands). It appears if it sends a stop axis command when the axis is already stopped, if you send the next command too quickly, it gets ignored.

Can you try removing the delay code I sent earlier, and instead modify the "StopWaitMotor()" method, around line 1650, to look like this:
void Skywatcher::StopWaitMotor(SkywatcherAxis axis)
{
    bool *motorrunning;
    struct timespec wait;
    ReadMotorStatus(axis);
    if (axis == Axis1 && RARunning)
        LastRunningStatus[Axis1] = RAStatus;
    if (axis == Axis2 && DERunning)
        LastRunningStatus[Axis2] = DEStatus;
 
    if (axis == Axis1)
        motorrunning = &RARunning;
    else
        motorrunning = &DERunning;
 
    if (*motorrunning)
    {
        DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
        dispatch_command(NotInstantAxisStop, axis, nullptr);
        wait.tv_sec  = 0;
        wait.tv_nsec = 100000000; // 100ms
        ReadMotorStatus(axis);
        while (*motorrunning)
        {
            nanosleep(&wait, nullptr);
            ReadMotorStatus(axis);
        }
    }
}

It's working for me during the daytime, but I can't test under the stars, since we have nothing but rain in the forecast for the next few days. In particular, I think it should return your guiding performance back to the way it was before.

-- Kevin
1 year 8 months ago #85854

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
Man I hope it clears up for you soon. I guess clear nights is one of a very few number of benefits of living so close to a desert :)

I compiled the new code and, unfortunately, the uncontrollable slewing came back. I included the entire modified StopWaitMotor function at the end just for you to check (old code is commented out instead of deleted)

Good news though, is that the "Slew to Target" and tracking accuracies went back to what they were before.

I tested a few other functions and can pretty much confirm that the only time problems occur is when I use manual slew via my ipad vnc client, which is the cause of the second spurious start and immediately stopped slew command. All programmatic slews work properly, such as "GoTo target", "Slew to Target", and perhaps what matters to me the most, "Park" command (It's the last large movement during an unattended imaging session, occurs 4:30AM while I'm asleep). Since the second slew command is not really caused by anything KStars or Ekos/INDI related stuff, it's technically not a bug anymore :) On the other hand, knowing a specific sequence of action can leads to potential equipment damage is a bit nerve wracking.

I'm running a capture sequence now. What I can do tomorrow during day-time is to try another "socat" recording, but this time with timestamps included so you can take a look at the intervals these commands are sent. What I don't understand is, even if the second K1 command gets ignored, the mount should just keep moving regularly, instead of moving erratically with loud noise and not responding to subsequent stop commands, all the while reporting (via f1) that the motor is stopped.

Here is the code I tested:
void Skywatcher::StopWaitMotor(SkywatcherAxis axis)
{
    bool *motorrunning;
    struct timespec wait;
    ReadMotorStatus(axis);
    if (axis == Axis1 && RARunning)
        LastRunningStatus[Axis1] = RAStatus;
    if (axis == Axis2 && DERunning)
        LastRunningStatus[Axis2] = DEStatus;
 
    //DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
    //dispatch_command(NotInstantAxisStop, axis, nullptr);
    //read_eqmod();
 
    if (axis == Axis1)
        motorrunning = &RARunning;
    else
        motorrunning = &DERunning;
 
    //wait.tv_sec  = 0;
    //wait.tv_nsec = 100000000; // 100ms
    //ReadMotorStatus(axis);
    //while (*motorrunning)
    //{
    //    nanosleep(&wait, nullptr);
    //    ReadMotorStatus(axis);
    //}
    if (*motorrunning)
    {
        DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
        dispatch_command(NotInstantAxisStop, axis, nullptr);
        wait.tv_sec  = 0;
        wait.tv_nsec = 100000000; // 100ms
        ReadMotorStatus(axis);
        while (*motorrunning)
        {
            nanosleep(&wait, nullptr);
            ReadMotorStatus(axis);
        }
    }
}
Last edit: 1 year 8 months ago by Yi.
1 year 8 months ago #85868

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
Well that's disappointing. It is definitely working a lot better for me with this change, although I could only test during the day. It is now raining outside.

A log with timestamps would probably help. Thanks!
1 year 8 months ago #85871

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
I'm able to replicate the problem even with my fix, by rapidly double and triple clicking the direction buttons. So far the only reliable fix has been to add a delay after every command. I'll keep investigating...
1 year 8 months ago #85887

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
I used my socat hack today to record what happens during a problematic slew. The full log is attached but here is what's most relevant:
## this is probably in response to the second, spurious slew command
[14:10:10.650601] :f1.                  [14:10:10.651333] =101.
[14:10:10.651754] :G130.                [14:10:10.652651] =.
[14:10:10.652836] :f1.                  [14:10:10.653530] =501.
[14:10:10.653844] :I1BA0000.            [14:10:10.655067] =.
[14:10:10.655282] :J1.                  [14:10:10.656078] =.
[14:10:10.656259] :f1.                  [14:10:10.656958] =501.
[14:10:11.650969] :j1.                  [14:10:11.652099] =08387D.
[14:10:11.652672] :j2.                  [14:10:11.653672] =97BE7B.
[14:10:11.654226] :f1.                  [14:10:11.654882] =101.
[14:10:11.655379] :f2.                  [14:10:11.655995] =101.
[14:10:12.658263] :j1.                  [14:10:12.659286] =A54D7E.
[14:10:12.660084] :j2.                  [14:10:12.661261] =97BE7B.
[14:10:12.661986] :f1.                  [14:10:12.662842] =101.
 
## this is probably when I turned off the mount power
[14:10:12.663561] :f2.                  [14:10:12.664345] =101.............8...l.............
[14:10:13.666533] :j1.                  [14:10:13.667306] j.

First column is what sent to the mount, second column is what the mount responded. Timestamps are in square brackets. This is what happened after the mount had come to a complete stop, and started to handle the second spurious slew command. Notice that, after the J1 command is sent, the motor status as reported by the mount is "motor stopped" (:f1 -> =501. and :f1 -> =101.). But if you look at the axis position queries (j1 commands), you can see that the axis was indeed moving (from 0x08387D to 0xA54D7E before I shut the mount off).

Another thing I noticed is that the second K1 was never sent. This is probably because of the new
if(*motorrunning)
code you introduced last night. Since f1 never responded that the motor was running, *motorrunning was probably never true, hence the if block was never executed.

I got the sense that it is whatever action before the J1 command that was causing the mount control board to be in an undefined state... I'll keep playing with this and report back if I find anything.
Last edit: 1 year 8 months ago by Yi.
1 year 8 months ago #85893
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.683 seconds