====== Tasks in implementing driver ====== To implement an RTS2 telescope driver, you need to create a child class inherited from [[rts2teld::Telescope]] abstract class. This class provides pure virtual methods, which you must overwrite. The method names should be self explanatory and are well documented. If you are using a serial port to communicate with your telescope, you can consider using [[Rts2ConnSerial]] class to handle for you communication over serial port. For example how to use this class refer to [[http://rts-2.svn.sf.net/viewvc/rts-2/trunk/rts-2/src/teld/gemini.cpp|src/teld/gemini.cpp]], which uses Rts2ConnSerial for serial port communication. This is a minimal example. Please refer to some real telescope driver for a more realistic example. #include "teld.h" using namespace rts2teld; class MyTelescope: public Telescope { protected: virtual int startMove (); virtual int stopMove (); virtual int startPark (); virtual int stopPark (); public: MyTelescope (int argc, char ** argv); }; int Telescope::startMove () { struct ln_equ_struct tar; getTarget (&tar); // do all what is needed to start move to tar.ra tar.dec // ... // return -1 in case of failure return 0; } int MyTelescope::stopMove () { return 0; // success } int MyTelescope::startPark () { // do all what is needed to move telescope to park position // return -1 in case of failure return 0; } int MyTelescope::endPark () { return 0; } MyTelescope::MyTelescope (int argc, char ** argv): Telescope (argc, argv) { } ====== Main method ====== After you implement your class, the main() method is trivial and effectively identical in all RTS2 devices (it basically allows you to pass in commandline arguments): int main (int argc, char **argv) { MyTelescope device = MyTelescope (argc, argv); return device.run (); } ====== Adding code to automake ====== After you are done with coding, you should add it to Makefile.am, so it will be generated. If your telescope driver needs some external routines, please see example provided in [[http://rts-2.svn.sf.net/viewvc/rts-2/trunk/rts-2/src/teld/Makefile.am|src/teld/Makefile.am]] for Paramount or OpenTPL telescope driver. In Makefile.am, please add the name of the new executable for your driver to bin_PROGRAMS. Also add the sourcefile name to rts2_teld_mytel_SOURCES (and edit LDFLAGS and CPPFLAGS, as needed). When you have made these changes, you need to run automake && ./config.status in rts2 directory to update the affected makefiles. ====== Debuging a new code ====== When you need to debug your code, you have two options: - Attach with attach command to running code - Start telescope daemon with -i option, so it will not detach from controlling terminal (set args -i in gdb) If you don't do this, rts2-teld-mytel will start the new daemon process and then exit - and gdb is tracking the parent, not the spawned process.