×

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

Bi-monthly release with minor bug fixes and improvements

Driver OnStep (LX200 like) for INDI

  • Posts: 161
  • Thank you received: 39
Here's what I've got, with everything together to handle the TrackState (unparking handled down below) There aren't any other TrackStates assigned.

if (strstr(OSStat, "P"))
{
SetParked(true); //defaults to TrackState=SCOPE_PARKED
TrackState = SCOPE_PARKED;
IUSaveText(&OnstepStat[3], "Parked");
} else {
if (strstr(OSStat, "n") && strstr(OSStat, "N"))
{
IUSaveText(&OnstepStat[1], "Idle");
TrackState = SCOPE_IDLE;
}
if (strstr(OSStat, "n") && !strstr(OSStat, "N"))
{
if (strstr(OSStat, "I")) {
IUSaveText(&OnstepStat[1], "Parking/Slewing");
TrackState = SCOPE_PARKING;
} else {
IUSaveText(&OnstepStat[1], "Slewing");
TrackState = SCOPE_SLEWING;
}
}
if (strstr(OSStat, "N") && !strstr(OSStat, "n"))
{
IUSaveText(&OnstepStat[1], "Tracking");
TrackState = SCOPE_TRACKING;
}
if (!strstr(OSStat, "N") && !strstr(OSStat, "n"))
{
IUSaveText(&OnstepStat[1], "Slewing");
TrackState = SCOPE_SLEWING;
}
}

That then becomes the only handling the lx200_OnStep driver does, but there are some lower levels:

Going through lx200telescope/lx200generic, and trying to cross reference things, the only place it looks like it sets state that isn't overridden is in the init with a SCOPE_IDLE (which seems fine). (Goto and Park (overriden both set it)).

There are some in inditelescope, but I'm not certain I've found them all.

ISNewSwitch():
TrackStateSP, will change it.
ParkStateSP will change it as well.

As will the call to SetParked/SyncParkStatus (Changes to IDLE or PARK)

TODO: copy/modify to intercept TrackStateSP & ParkStateSP.
TODO: copy/override SetParked/SyncParkStatus

That will move us to a model of purely from-telescope instead of an assumed command state + from-telescope.

Once those are done, That should mean 100% the OnStep driver has control of the Trackstate, with the above from :GU#, and should eliminate the kstars camera issue.
2 years 9 months ago #73250

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

  • Posts: 452
  • Thank you received: 71
James,

searching for TrackState in inditelescope.h the following confirms your code.
enum TelescopeStatus
{
SCOPE_IDLE,
SCOPE_SLEWING,
SCOPE_TRACKING,
SCOPE_PARKING,
SCOPE_PARKED
};

thanks for your work
2 years 9 months ago #73256

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

  • Posts: 62
  • Thank you received: 1
My latest test with the latest driver (github.com/james-lan/indi/tree/own-goto):


New driver:

Start Indi:
LX200 OnStep.OnStep Status.Tracking=
[NOK] No value

Unpark:
LX200 OnStep.OnStep Status.Tracking=Tracking
[OK]

Goto:
LX200 OnStep.OnStep Status.Tracking=Slewing
[OK]

End goto:
LX200 OnStep.OnStep Status.Tracking=Tracking
[OK]

Parking:
LX200 OnStep.OnStep Status.Tracking=Parking/Slewing
[OK ?]

Parked:
LX200 OnStep.OnStep Status.Tracking=Parking/Slewing
[NOK]

Unpark:
LX200 OnStep.OnStep Status.Tracking=Tracking
[OK]

Old driver:
Start Indi:
LX200 OnStep.OnStep Status.Tracking=Idle

Unpark:
LX200 OnStep.OnStep Status.Tracking=Tracking

Goto:
LX200 OnStep.OnStep Status.Tracking=Tracking
[NOK]

End goto:
LX200 OnStep.OnStep Status.Tracking=Tracking

Parking:
LX200 OnStep.OnStep Status.Tracking=Slewing

Parked:
LX200 OnStep.OnStep Status.Tracking=Idle

Séquence Kstars with mount parked:
[NOK]
2021-07-06T10:20:36 Shutdown complete.
2021-07-06T10:20:36 Ekos stopped.
2021-07-06T10:20:35 INDI devices disconnected.
2021-07-06T10:20:31 Mount parked.
2021-07-06T10:20:30 Parking mount in progress...
2021-07-06T10:20:29 Cap parked.
2021-07-06T10:20:24 Parking Cap...
2021-07-06T10:20:23 No jobs left in the scheduler queue.


2021-07-06T10:20:22 Job 'Neptune' is terminated due to errors.
2021-07-06T10:20:22 Warning: job 'Neptune' slew failed, marking terminated due to errors.
2021-07-06T10:20:21 Job 'Neptune' is slewing to target.
2021-07-06T10:20:21 Warning: job 'Neptune' found not slewing, restarting.
2021-07-06T10:20:20 Job 'Neptune' is slewing to target.
2021-07-06T10:20:20 Warning: job 'Neptune' found not slewing, restarting.
2021-07-06T10:20:17 Job 'Neptune' is slewing to target.


2021-07-06T10:20:15 Cap unparked.
2021-07-06T10:20:10 Unparking cap...
2021-07-06T10:20:09 Mount unparked.
2021-07-06T10:20:04 Scheduler started.

Sequence Kstars with mount unparked:
[NOK]
2021-07-06T10:28:02 Shutdown complete.
2021-07-06T10:28:02 Ekos stopped.
2021-07-06T10:28:01 INDI devices disconnected.
2021-07-06T10:27:57 Mount parked.
2021-07-06T10:27:56 Mount unparked.
2021-07-06T10:27:55 Mount unparked.
2021-07-06T10:27:54 Mount unparked.
2021-07-06T10:27:53 Mount unparked.
2021-07-06T10:27:52 Mount unparked.
2021-07-06T10:27:51 Parking mount in progress...
2021-07-06T10:27:50 Cap parked.
2021-07-06T10:27:45 Parking Cap...
2021-07-06T10:27:44 No jobs left in the scheduler queue.
2021-07-06T10:27:43 Job 'Neptune' is terminated due to errors.
2021-07-06T10:27:43 Warning: job 'Neptune' slew failed, marking terminated due to errors.
2021-07-06T10:27:42 Job 'Neptune' is slewing to target.
2021-07-06T10:27:42 Warning: job 'Neptune' found not slewing, restarting.
2021-07-06T10:27:41 Job 'Neptune' is slewing to target.
2021-07-06T10:27:41 Warning: job 'Neptune' found not slewing, restarting.
2021-07-06T10:27:38 Job 'Neptune' is slewing to target.
2021-07-06T10:27:36 Cap unparked.
2021-07-06T10:27:31 Unparking cap...
2021-07-06T10:27:30 Mount already unparked.
2021-07-06T10:27:28 Scheduler started.

Sequence Kstars with old driver and mount parked:
2021-07-06T10:39:17 Shutdown complete.
2021-07-06T10:39:17 Ekos stopped.
2021-07-06T10:39:16 INDI devices disconnected.
2021-07-06T10:39:12 Mount parked.
[NOK] The telescope is on Neptune, not parked

2021-07-06T10:39:11 Parking mount in progress...
2021-07-06T10:39:10 Cap parked.
2021-07-06T10:39:05 Parking Cap...
2021-07-06T10:39:04 No jobs left in the scheduler queue.
2021-07-06T10:39:03 Job 'Neptune' is complete.
2021-07-06T10:39:02 Job 'Neptune' capture is in progress...
[NOK] capture start before the mount is on Neptune

2021-07-06T10:39:02 Job 'Neptune' slew is complete.
2021-07-06T10:39:00 Job 'Neptune' is slewing to target.
2021-07-06T10:38:58 Cap unparked.
2021-07-06T10:38:53 Unparking cap...
2021-07-06T10:38:52 Mount unparked.
2021-07-06T10:38:48 Scheduler started.
Last edit: 2 years 9 months ago by Serge CLAUS.
2 years 9 months ago #73262

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

  • Posts: 452
  • Thank you received: 71
after some thinking (yes it happens) I believe best is to discriminate the sates based on the following return codes:
Status Unambiguous OnStep return Code
Idle nNp
Tracking Np
Slewing p and !N (it is the only one that is ambiguous with Tracking
Parking nI
Parked nNp

I tried it on many scenarios and seems to work fine.
Will do some more tests and return to you with code.
2 years 9 months ago #73270

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

  • Posts: 452
  • Thank you received: 71
@James
This replaces all TrackSate and covers all cases so far I could test.
Sorry was not able to vreate a pull request against yout Master

getCommandString(PortFD, OSStat, ":GU#"); // :GU# returns a string containg controller status
if (strcmp(OSStat, OldOSStat) != 0) //if status changed
{
// ============= Telescope Status
strcpy(OldOSStat, OSStat);

IUSaveText(&OnstepStat[0], OSStat);
if (strstr(OSStat, "nN"))
{
IUSaveText(&OnstepStat[1], "Idle");
TrackState = SCOPE_IDLE;
}
if (!strstr(OSStat, "N"))
{
IUSaveText(&OnstepStat[1], "Slewing");
TrackState = SCOPE_SLEWING;
}
if (strstr(OSStat, "N") && !strstr(OSStat, "n"))
{
IUSaveText(&OnstepStat[1], "Tracking");
TrackState = SCOPE_TRACKING;
}
if (strstr(OSStat, "I"))
{
TrackState = SCOPE_PARKING;
IUSaveText(&OnstepStat[1], "Parking");
IUSaveText(&OnstepStat[3], "Park in Progress");
}
if (strstr(OSStat, "P"))
{
SetParked(true);
TrackState = SCOPE_PARKED;
IUSaveText(&OnstepStat[1], "Parked");
IUSaveText(&OnstepStat[3], "Parked");
}
if (strstr(OSStat, "F"))
{
SetParked(false);
TrackState=SCOPE_IDLE;
IUSaveText(&OnstepStat[1], "Idle");
IUSaveText(&OnstepStat[3], "Parking Failed");
}

if (strstr(OSStat, "p"))
{
SetParked(false);
if (strstr(OSStat, "nN"))
{
IUSaveText(&OnstepStat[1], "Idle");
TrackState = SCOPE_IDLE;
}
IUSaveText(&OnstepStat[3], "UnParked");
}
2 years 9 months ago #73281

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

  • Posts: 452
  • Thank you received: 71
After testing more, the code works fine but there is still something wrong with Ekos.

When I Park the mount Ekos considers TrackState as Parked which is OK,
but when I unpark Ekos considers TrackState as Idle (despite the fact that the driver says Tracking).
So as James said there is still something to do somewhere ...
When I manually "stop/start" tracking in the control panel things are synced again between driver and Ekos ????
2 years 9 months ago #73300

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

  • Posts: 62
  • Thank you received: 1
I'm testing your repository (github.com/azwing/indi) and i have always the same problem :-(
On Kstars 3.5.4 Stable:

2021-07-07T19:56:01 Shutdown complete.
2021-07-07T19:56:01 Ekos stopped.
2021-07-07T19:56:00 INDI devices disconnected.
2021-07-07T19:55:56 Mount parked.
2021-07-07T19:55:55 Parking mount in progress...
2021-07-07T19:55:54 Cap parked.
2021-07-07T19:55:49 Parking Cap...
2021-07-07T19:55:48 Warming up CCD...
2021-07-07T19:55:48 No jobs left in the scheduler queue.
2021-07-07T19:55:47 Job 'HD 97277' is terminated due to errors.
2021-07-07T19:55:47 Warning: job 'HD 97277' slew failed, marking terminated due to errors.
2021-07-07T19:55:46 Job 'HD 97277' is slewing to target.
2021-07-07T19:55:46 Warning: job 'HD 97277' found not slewing, restarting.
2021-07-07T19:55:45 Job 'HD 97277' is slewing to target.
2021-07-07T19:55:45 Warning: job 'HD 97277' found not slewing, restarting.
2021-07-07T19:55:43 Job 'HD 97277' is slewing to target.
2021-07-07T19:55:41 Cap unparked.
2021-07-07T19:55:36 Unparking cap...
2021-07-07T19:55:35 Mount unparked.
2021-07-07T19:55:30 Scheduler started.
2021-07-07T19:54:39 Scheduler list saved to /home/serge/testflat2.esl


I think, it's a Kstars problem
Status of Indi GU#:
Start:
LX200 OnStep.OnStep Status.Tracking=Parked
Unpark:
LX200 OnStep.OnStep Status.Tracking=Tracking
LX200 OnStep.OnStep Status.Tracking=Slewing
-> Kstars error (Warning: job 'HD 97277' found not slewing, restarting.)

Tested with CCDciel and skychart: Seems to work fine \o/
2 years 9 months ago #73305

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

  • Posts: 452
  • Thank you received: 71
Thank you Serge,

you're right, could be inside Ekos the question is where :-)

Anyhow it is raining frogs here (Alsace) so ... parsing the code is fine ....
2 years 9 months ago #73307

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

  • Posts: 452
  • Thank you received: 71
Serge,

I believe (???) it is fixed in my last commit on github.com/azwing/indi
Simply added the condition is parked then I change to unpark ...
hope it solves your issue
2 years 9 months ago #73310

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

  • Posts: 62
  • Thank you received: 1
New tests :-)
Not good news...

Manual moves:
Restart indi drivers (IndiWebManager)
LX200 OnStep.OnStep Status.Tracking=Parked
Unpark:
LX200 OnStep.OnStep Status.Tracking=Tracking
Goto:
LX200 OnStep.OnStep Status.Tracking=Slewing
End goto:
LX200 OnStep.OnStep Status.Tracking=Tracking
Park:
LX200 OnStep.OnStep Status.Tracking=Parking
The Kstars green flag is ON.
...
Parked:
LX200 OnStep.OnStep Status.Tracking=Parked
Unpark:
LX200 OnStep.OnStep Status.Tracking=Tracking
...
Seems to work.

Sequence Kstars:
2021-07-08T18:21:23 Shutdown complete.
2021-07-08T18:21:23 Ekos stopped.
2021-07-08T18:21:22 INDI devices disconnected.

[NOK the mount is in parking progress, not parked] 2021-07-08T18:21:18 Mount parked.

[OK] 2021-07-08T18:21:17 Parking mount in progress...
2021-07-08T18:21:16 No jobs left in the scheduler queue.
[OK] 2021-07-08T18:21:15 Job 'Mars2' is complete.
2021-07-08T18:21:14 Job 'Mars2' capture is in progress...
[OK] 2021-07-08T18:21:13 Job 'Mars2' slew is complete.
[OK] 2021-07-08T18:20:43 Job 'Mars2' is slewing to target.
[OK] 2021-07-08T18:20:40 Mount unparked.
2021-07-08T18:20:35 Scheduler started.

[OK] Kstars is waiting for the mount is tracking (end of goto).
[NOK] But after the "park" command it consider the mount is already parked :-(
however the Indi driver seems to give the right values...

And i have more and more crash of Kstars 3.5.4 :-( (I think, it's not the indi driver)

Good news anyway It seems to work well with CCDCiel.
I think I will only use CCDciel

Thanks :-)
2 years 9 months ago #73334

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

  • Posts: 161
  • Thank you received: 39
From a glance it seems like it's going to cause extra state changes on certain codes with regard to parking (calling setParked(x) results in a change to either PARKED or IDLE, and a variable IsParked being set (accessible through isParked()) and I think that's changed in the past.

Issues with what you've got:
F shouldn't change TrackState. (Park failed, but the state should be processed via n/N )
p and nN only, if it's pn, it'll produce TRACKING when it should be IDLE (here again state should be processed via n/N)
Not sure why the myTrackState?

That own-goto branch of mine, I didn't handle it right, either, when I looked at your code: (F, I and p should be moved in my code before the n/N/P processing, because of the potential call to setParked(false) in them, which could result in an idle state.) Basically moving up the ==parkdata== / ==end...== section should have fixed that issue. (I have pushed the branch, but not tested it, as I need to get away from the computer for a bit, as I keep looking and running through the same logic and questioning it, so I'm going to stop and come back in a while so I don't break anything too badly.)

Please have a look though: github.com/james-lan/indi/blob/own-goto/...ope/lx200_OnStep.cpp (Note it doesn't include IsNewSwitch() settings which can change it.)

Note the multi unparked in ( indilib.org/forum/development/1406-drive...html?start=660#73262 ) should be resolved in the current version, as each call will set status, but will only correct the internal parked variable when needed. (That I have tested some, and so far I haven't had issues with it.)

Issues/TrackState manipulation remaining with mine:
Scope may get set for a split second to TrackState=SCOPE_IDLE when unparking, but that will be correct shortly thereafter within the function. due to the call to set IsParked
Same with parking (but to the correct TrackState=SCOPE_PARKED) so non issue

One thing that could be done is skip the OSStat == OldOSStat check. That would resolve the sync issue and why when you start/stop tracking it gets corrected. (With the isParked() guards around it shouldn't cause any issues for the correct things to be set with regards to TrackState, not sure about the rest of it.) So we'd need to make sure things don't cause issues like messing with TrackState can, but that I think is probably the best case. But it could mask TrackState and other issues as well.

Alright, I'm off, let me know what you all think. (Apologies, I left this up last night, but aside from me being less tired everything else should be the same.)
2 years 9 months ago #73335

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

  • Posts: 452
  • Thank you received: 71
Hi James,

Yes leaving coding away some time will do good.
Looking all the time at a problem makes us blind :-)

I will have a look on your code.
In the meantime "myTrackState" is removed (was just a testing variable)
I have now a situation where OnStep TrackState is sync with Ekos except for SCOPE_PARKING where Ekos still states Slewing.
But I notice no other strange behavior.
2 years 9 months ago #73338

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

Time to create page: 0.897 seconds