Telescope server RA coordinate sometimes zero

Asked by David

Hi,

Some time ago I had this correspondence with the Stellarium team, as shown below. Since then, I have managed to build and debug why this problem is happening. There is the following code in stellarium/plugins/TelescopeControl/src/clients/TelescopeClient.cpp:

void TelescopeTCP::telescopeGoto(const Vec3d &j2000Pos)
{
        if (isConnected())
        {
                if (writeBufferEnd - writeBuffer + 20 < (int)sizeof(writeBuffer))
                {
                        const double ra = atan2(j2000Pos[1], j2000Pos[0]);

Basically, the problem is that "ra" will be < 0, for objects east of the meridian and this screws up the calculations further down, which expect "ra" to be positive. The fix is to replace the last line above with this code:

                        double ra = atan2(j2000Pos[1], j2000Pos[0]);
                        if (ra < 0)
                                ra += 2.0 * M_PI;

This seems to produce correct results with my remote telescope server application for objects east and west of the meridian.

Is there any chance of including this in a build fairly soon as although I have managed to find the problem, I cannot seem to build a version of Stellarium that performs in a responsive manner on my Mac. The pre-built binary I download works fine, but when I build it, mouse and key events seem to be very unresponsive and I cannot figure out why.

Support Requests item #2883392, was opened at 2009-10-21 20:20
Message generated for change (Comment added) made by daggerstab
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=454374&aid=2883392&group_id=48857

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: Current release
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: David (dhulse)
Assigned to: Nobody/Anonymous (nobody)
Summary: Telescope Control Protocol RA == 0

Initial Comment:
I am using the current release of Stellarium on Mac OS X Snow Leopard. I have configured a telescope server in config.ini and I have developed an application for Mac OS X that receives connections from Stellarium and correctly parses the received messages.

What I am finding is that clicking on stars east of the Meridian (and initiating a slew command) will correctly send me RA and DEC values, but if I try to slew to stars in the west, I get the correct DEC but the RA is always 0. I have verified that it is not my code at fault here. Packet dumps of the received messages show that the 4 bytes for RA are all 0 whenever I choose a star west of the Meridian.

I am wondering if this is a known bug, or if it is something easily fixed? I guess it is possible that I could fix this myself since I'm a developer, but I wonder if anyone can comment on this, and if thought to be a bug, point me in the right direction to fix it?

----------------------------------------------------------------------

Comment By: Bogdan Marinov (daggerstab)
Date: 2009-10-21 20:55

Message:
Yes, this is a known bug.

The workaround is to run Stellarium through Rosetta - this forces your Mac
to use the PPC version contained in the universal binary. It seems to be a
compiler issue.

If you want to have a look at the code, the related methods are in the
TelescopeTcp class - see /src/modules/Telescope.hpp and Telescope.cpp. The
method that encodes the command is called "TelescopeTcp::telescopeGoto".

Also, there was a change in TelescopeTcp's network code between the last
released version and the current development version, so it may turn out
that the bug is fixed.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=454374&aid=2883392&group_id=48857

Question information

Language:
English Edit question
Status:
Solved
For:
Stellarium Edit question
Assignee:
No assignee Edit question
Solved by:
Bogdan Marinov
Solved:
Last query:
Last reply:
Revision history for this message
Bogdan Marinov (daggerstab) said :
#1

Thanks for this, I'll have a look into it. (And into why it is an issue only on Intel Macs.)

Revision history for this message
Best Bogdan Marinov (daggerstab) said :
#2

Sorry for being so slow with this: I tried to research the reason and find other possible solutions, and then I got distracted and forgot about your solution.

The fix has been committed as revison 6025. I don't know when the next release will be, and I don't have a Mac, so I can't help you with a package. The Stellarium Wiki contains instructions for creating an universal binary:
http://www.stellarium.org/wiki/index.php/Compilation_on_Macosx#We_recommend_Qt_Creator
It may be possible that you need to re-build Stellarium's dependencies, or at least the Qt libraries.

Revision history for this message
David (dave-hulse) said :
#3

The patch looks good, although I've not tried to build a new version yet. However, I expect it will be ok once a release is made, or I manage to build one.