Stellarium / stellarium

Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
https://stellarium.org
GNU General Public License v2.0
7.71k stars 821 forks source link

Az.Alt.: LMX200 with arduino. #705

Open 303055 opened 5 years ago

303055 commented 5 years ago

Hi guys,

I tried then search on the telescope plugins the commands: GA # and: GZ # for the altitude coordinates and Azimuth of an object, but they do not seem present. I use a telescope Dobson type, and have to do the math to pass in equatorial and vice versa is counter productive knowing that stellarium calculates..

Why are these orders not present?

thx :)

gzotti commented 5 years ago

Because you have not sent your patches yet :-)

303055 commented 5 years ago

I'll try to do it ^^ But I'm not a coding pro: p

it is enough that I modify this file? https://github.com/Stellarium/stellarium/blob/master/plugins/TelescopeControl/src/Lx200/Lx200Command.cpp

thx

gzotti commented 5 years ago

I think you should extend the protocol for all instruments. The original developer of the telescope plugin has unfortunately left the project, and I don't know who could test your development.

Maybe somebody else can answer this?

303055 commented 5 years ago

Ah, if anyone can show me, I want to :) I saw for example:


bool Lx200CommandGetRa::writeCommandToBuffer(char &p, char end) { if (end-p < 5) return false;

  // get RA:
*p++ = '#';
*p++ = ':';
*p++ = 'G';
*p++ = 'R';
*p++ = '#';
has_been_written_to_buffer = true;
return true;

}

int Lx200CommandGetRa::readAnswerFromBuffer(const char &buff, const char end) { if (buff < end && *buff=='#') buff++; // ignore silly byte

if (end-buff < 8)
    return 0;

bool long_format = true;
int ra;
const char *p = buff;
ra = ((*p++) - '0');
ra *= 10;
ra += ((*p++) - '0');
if (*p++ != ':')
{
    #ifdef DEBUG4
    *log_file << Now()
              << "Lx200CommandGetRa::readAnswerFromBuffer: "
                 "error: ':' expected"
              << endl;
    #endif
    return -1;
}

ra *=  6; ra += ((*p++) - '0');
ra *= 10; ra += ((*p++) - '0');
switch (*p++)
{
    case ':':
        ra *=  6; ra += ((*p++) - '0');
        ra *= 10; ra += ((*p++) - '0');
        if (end-buff < 9)
            return 0;
        break;

    case '.':
        ra *= 10; ra += ((*p++) - '0');
        ra *= 6;
        long_format = false;
        break;

    default:
        *log_file << Now()
                  << "Lx200CommandGetRa::readAnswerFromBuffer: "
                     "error: '.' or ':' expected"
                  << endl;
        return -1;
}

if (*p++ != '#')
{
    *log_file << Now()
              << "Lx200CommandGetRa::readAnswerFromBuffer: "
                 "error: '#' expected"
              << endl;
    return -1;
}

#ifdef DEBUG4
*log_file << Now()
          << "Lx200CommandGetRa::readAnswerFromBuffer: "
          << "RA = "
          << qSetPadChar('0')
          << qSetFieldWidth(2)  << (ra/3600)
          << qSetFieldWidth(0) << ':'
          << qSetFieldWidth(2) << ((ra/60)%60)
          << qSetFieldWidth(0) << ':'
          << qSetFieldWidth(2) << (ra%60)
          << qSetFieldWidth(0) << qSetPadChar(' ')
          << endl;
#endif

buff = p;
server.longFormatUsedReceived(long_format);
server.raReceived((unsigned int)floor(ra * (4294967296.0/86400.0)));
return 1;

}

void Lx200CommandGetRa::print(QTextStream &o) const { o << "Lx200CommandGetRa"; }


I can copy it and replace in GA? and change the code after?


bool Lx200CommandGetRa::writeCommandToBuffer(char &p, char end) { if (end-p < 5) return false;

  // get RA:
*p++ = '#';
*p++ = ':';
*p++ = 'G';
*p++ = 'A';
*p++ = '#';
has_been_written_to_buffer = true;
return true;
 .....

thx

sferixx commented 5 years ago

303055 Hello! Could You tell me did You make it (the plugin ehacement) and is it working or not i need it in the same purpose as you im building arduino scope and i would be very gratefull if i could skip the math.

gzotti commented 5 years ago

It seems some extensions to the telescope control protocols could be implemented for and by somebody with alt-azimuthal telescopes like Dobsons modified with Arduino-based control devices. Now, who wants to do sferixx's homework and develop support for some reference DIY kit?

alex-w commented 2 years ago

This is a good task for the community to participate in the contribution into Stellarium. Who wants to help us?

huntflex commented 2 years ago

Hi! Very new to this codebase (actually just cloned the repo today) but I'd like to try to tackle this issue if that's ok. It might take some time.

gzotti commented 2 years ago

Sure, go ahead. You will only have to extend the TelescopeControl plugin. If possible, all telescope models will have to support the protocol. I cannot test any, though.