×

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

Bi-monthly release with minor bug fixes and improvements

Bug in LX200 Basic driver on macOS [SOLVED]

  • Posts: 1957
  • Thank you received: 420
Hi!

It has been a while since I read this forum so it is very well possible that this already has been reported. I did a quick search on the forum but didn't find anything which is why I decided to open a topic.

I am working on a custom motor system for my dobsonian telescopes and I use the LX200 protocol. I have it working with SkySafari and AstroPlanner (only simulator so far, no hardware yet) and started looking into getting it to work with INDI. This is how I discovered the small bug in the LX200 Basic INDI driver. The bug is that, when retrieving the telescope coordinates, RA and DEC are swapped. And only when retrieving, not when setting or when sending a slew command.

This leads to very funny but slightly annoying display issues, where the telescope seems to be pointing at a very different position than it really is. The interesting thing is that this only starts going wrong after an initial slew command is given. When INDI connects to the telescope, it first displays the telescope in the correct position. As soon as I give a slew command though, RA and DEC are swapped and the display of the telescope position is completely wrong.

This is visiible in KStars and Cartes du Ciel/SkyChart on macOS. I didn't test KStars on Linux since I currently don't have a Raspberry Pi with KStars installed.

Apart from this display issue everything seems to work well with this driver. No big issue but I thought you'd like to know.


Clear, dark and transparent skies, Wouter
6 months 1 week ago #96629

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

  • Posts: 1187
  • Thank you received: 370
Hi Wouter,
I took a quick look into the basic driver, but it seems to be correct. LX200Basic::ReadScopeStatus() calls getLX200RA() for the RA value and getLX200DEC() for the DEC value and sets them via NewRaDec(currentRA, currentDEC), which also looks good.
Could you be more specific where the problem occurs?
Cheers
Wolfgang
The following user(s) said Thank You: Jasem Mutlaq
6 months 1 week ago #96630

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

  • Posts: 1957
  • Thank you received: 420
Hi Wolfgang,

Thanks for the super fast follow up. What I do is this:

- Go to the device manager in KStars (under Tools) and connect to LX200 Basic via TCP/IP.
- At that moment the RA and DEC are correct.
- Slew to an object.
- From that moment on RA and DEC are swapped. This can be seen in the device control panel. If you enter a RA/DEC combination and click the Set button, you can see in the same screen that they get set correctly and then get swapped after a few seconds.


HTH, Wouter
6 months 1 week ago #96632

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

  • Posts: 1187
  • Thank you received: 370
Wouter, I checked the LXBasic driver with my Avalon mount. At least with this combination it works correct, it does not show the effect yo are describing.

Are you 100% sure that the error is not somewhere in your mount firmware?

Wolfgang
6 months 1 week ago #96635

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

  • Posts: 1957
  • Thank you received: 420

Like I wrote, the code works fine with SkySafari and AstroPlanner but of course that doesn't rule out that there is an issue with my code. Perhaps the format of the RA and DEC strings that are sent by my code is incorrect. Would it be possible for you to capture those strings from your mount and post them here so I can compare with my code? I'll send examples of output from my code as soon as I get access to my MacBook.


Thanks, Wouter
6 months 1 week ago #96637

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

  • Posts: 1957
  • Thank you received: 420
OK, here we go. When INDI sends a slew command, it sends the following commands:

2023-10-22 19:55:47,034:DEBUG:LX200Mount:Read command line: 'Sr14:16:44#'
2023-10-22 19:55:47,034:DEBUG:Lx200CommandResponder:Setting RA to 14:16:44
2023-10-22 19:55:47,034:DEBUG:LX200Mount:Read command line: 'Sd+19*03:56#'
2023-10-22 19:55:47,034:DEBUG:Lx200CommandResponder:Setting DEC to +19*03:56
2023-10-22 19:55:47,034:DEBUG:LX200Mount:Read command line: 'MS#'
2023-10-22 19:55:47,035:DEBUG:Lx200CommandResponder:Slewing to RaDec (14:16:44, +19*03:56).

So it first sends an Sr command with the RA and then an Sd command with the DEC. Finally it sends an MS command that initiates the slew. Before that, my code sends the following RA and DEC strings, to indicate that the telescope is at AZ 0.0 and ALT 0.0:

2023-10-22 19:55:45,945:DEBUG:Lx200CommandResponder:ra_str='07:43:51.18'
2023-10-22 19:55:45,953:DEBUG:Lx200CommandResponder:dec_str="49*16'37.50"

The telescope is correctly displayed on the northern horizon. As soon as the MS command is received, the telescope code starts slewing to the position of, in this case, Arcturus and sends these strings:

2023-10-22 19:55:47,982:DEBUG:Lx200CommandResponder:ra_str='07:56:56.31'
2023-10-22 19:55:48,986:DEBUG:Lx200CommandResponder:ra_str='08:51:5.20'
2023-10-22 19:55:48,993:DEBUG:Lx200CommandResponder:dec_str="57*26'6.05"
2023-10-22 19:55:49,997:DEBUG:Lx200CommandResponder:ra_str='10:22:29.87'
2023-10-22 19:55:50,006:DEBUG:Lx200CommandResponder:dec_str="60*35'29.43"

And there I see the cause of the issue. Apparently the ra_str reply is sent twice. My guess is that this is a timing issue with two consecutive commands being received to request the telescope RA but I'll dig into my code to make sure that it is not an issue on my side.


Wouter
6 months 1 week ago #96638

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

  • Posts: 1957
  • Thank you received: 420
I enabled command logging in my code and found that indeed a duplicate GR command is sent by INDI. I added some code to ignore duplicate commands and now it works in KStars and Cartes du Ciel. I think there may be some timing issue or some other problem in INDI causing a duplicate GR command to be sent. No idea why it works with the Avalon Mount though!

I will keep ignoring duplicate commands in my code so it works well with INDI.

Thanks for helping me get to the bottom of this, Wolfgang!


Wouter
6 months 1 week ago #96639

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

  • Posts: 1187
  • Thank you received: 370
Strange thing, these duplicated commands. But anyway, good to hear that you resolved it!
6 months 1 week ago #96641

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

  • Posts: 1957
  • Thank you received: 420
Yes, I am happy that it is working for me now. I hope someone will take some time to dig into these duplicate GR commands. My python code for the LX200 protocol worked without the need to filter that out about two years ago and now not anymore. Seems like some regression in INDI to me.
6 months 1 week ago #96642

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

  • Posts: 1187
  • Thank you received: 370
I'll check it with my mount tomorrow whether it shows the duplicate code as well.
The following user(s) said Thank You: Wouter van Reeven
6 months 1 week ago #96643

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

  • Posts: 1187
  • Thank you received: 370
Hi Wouter,
the problem with the doubled commands must be somewhere in your setup. With the Avalon Legacy (using LXBasic), I get the following log entries in the INDI log when issuing a slew command
SCOPE	43.983334 sec	: CMD <:GD#>
SCOPE	44.015012 sec	: RES <+01*44:21>
SCOPE	44.015123 sec	: VAL [1.73917]
SCOPE	45.016280 sec	: CMD <:GR#>
SCOPE	45.038899 sec	: RES <15:25:05>
SCOPE	45.039048 sec	: VAL [15.4181]
SCOPE	45.039087 sec	: CMD <:GD#>
SCOPE	45.070813 sec	: RES <+01*44:21>
SCOPE	45.070993 sec	: VAL [1.73917]
SCOPE	45.072931 sec	: <setObjectRA>
SCOPE	45.073050 sec	: CMD <:Sr16:42:10#>
SCOPE	45.102746 sec	: CMD <:Sr16:42:10#> successful.
SCOPE	45.102862 sec	: <setObjectDEC>
SCOPE	45.102895 sec	: CMD <:Sd+31*33:40#>
SCOPE	45.134718 sec	: CMD <:Sd+31*33:40#> successful.
SCOPE	45.134826 sec	: <Slew>
SCOPE	45.134851 sec	: CMD <:MS#>
SCOPE	45.166737 sec	: RES <0>
INFO	45.166872 sec	: Slewing to RA: 16:42:10 - DEC: 31:33:40

- Wolfgang
6 months 1 week ago #96658

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

  • Posts: 1957
  • Thank you received: 420
Hi Wolfgang,

Thanks for looking into this again. What happens after the MS command? That part is missing from the log you posted and that is where I receive two consecutive GR commands.


Wouter
6 months 1 week ago #96660

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

Time to create page: 0.520 seconds