code:telescope_driver
Differences
This shows you the differences between two versions of the page.
code:telescope_driver [2008/12/29 22:03] – created pkubanek | — | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Tasks in implementing driver ====== | ||
- | To implement an RTS2 telescope driver, you need to create a child class inherited from [[Rts2DevTelescope]] 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:// | ||
- | |||
- | This is a minimal example. Please refer to some real telescope driver for a more realistic example. | ||
- | |||
- | <code c++> | ||
- | #include " | ||
- | |||
- | class Rts2DevMyTelescope: | ||
- | { | ||
- | protected: | ||
- | virtual int startMove (); | ||
- | virtual int stopMove (); | ||
- | virtual int startPark (); | ||
- | virtual int stopPark (); | ||
- | public: | ||
- | Rts2DevMyTelescope (int argc, char ** argv); | ||
- | }; | ||
- | |||
- | int | ||
- | Rts2DevMyTelescope:: | ||
- | { | ||
- | 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 | ||
- | Rts2DevMyTelescope:: | ||
- | { | ||
- | return 0; // success | ||
- | } | ||
- | |||
- | int | ||
- | Rts2DevMyTelescope:: | ||
- | { | ||
- | // do all what is needed to move telescope to park position | ||
- | // return -1 in case of failure | ||
- | return 0; | ||
- | } | ||
- | |||
- | int | ||
- | Rts2DevMyTelescope:: | ||
- | { | ||
- | return 0; | ||
- | } | ||
- | |||
- | Rts2DevMyTelescope:: | ||
- | { | ||
- | |||
- | } | ||
- | |||
- | </ | ||
- | |||
- | ====== 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): | ||
- | |||
- | <code c++> | ||
- | int | ||
- | main (int argc, char **argv) | ||
- | { | ||
- | Rts2DevMyTelescope device = Rts2DevMyTelescope (argc, argv); | ||
- | return device.run (); | ||
- | } | ||
- | </ | ||
- | |||
- | ====== Adding code to automake ====== | ||
- | |||
- | After you are done with coding, you should add it to Makefile.am, | ||
- | |||
- | In Makefile.am, | ||
- | |||
- | ====== Debuging a new code ====== | ||
- | |||
- | When you need to debug your code, you have two options: | ||
- | |||
- | - Attach with attach <pid> 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. |
code/telescope_driver.txt · Last modified: 2010/01/17 00:00 (external edit)