Ask the person who installed xyd where the software has been installed (normally /usr/local or ~yamada).
It should be possible to learn to do simple control functions just by using the examples.
The source code for the examples can also be found in the examples directory, though an appropriate system-specific Makefile cannot be provided here.
All functions described here will return a status code (which will be negative if there is an error). If the command completed correctly, the status code will be a zero.
If there is an error, then the global character array xy_cmd_err_msg will contain an error message (a zero-terminated character array).
Positive status codes indicate that the command requires special processing. The only positive status code that normal code is likely to recieve is XYERR_PENDING. Only commands that require you to pass in an id (a pointer to an integer variable) will return XYERR_PENDING. If the status code is XYERR_PENDING, then the application code should use the returned id and call xy_cmd_wait(). This will allow the command to complete and return a status code to indicate proper completion.
Unless otherwise stated, all of these functions treat a 0 value as "TRUE" or "set" and a non-0 values as "FALSE" or "unset".
The functions in this section are all rather special, and do not follow the rules that the other functions do.
This function is used to connect to the xy daemon. It accepts the name of the host that is running the daemon and the port that the daemon is listening on. If the host is NULL, then a default host that was compiled at the time that the library was built will be used. If the port is 0, then a default port that was compiled at the time that the library was built will be used.
This function returns a file descriptor which all of the other functions require for connecting to the daemon. If there is a problem, then a negative value will be returned.
This function is used to disconnect from the xy daemon. It requires a file descriptor (obtained from xy_cmd_connect()).
This function waits for an operation to complete. It expects a file descriptor, obtained from xy_cmd_connect. It also expects an id, which is obtained from every command that takes time to complete. It returns an error code which describes the status of specified operation.
If an asynchronous message arrives while xy_cmd_wait() is waiting for a result, it will call the appropriate handler.
This function checks if an asynchronous message has arrived. If an asynchronous message has arrived, it calls the appropriate handler.
The functions in this section all behave similarly. They
expect a file descriptor (obtained from xy_cmd_connect()) as
their first argument. Following that are a mixture of integers,
doubles, and zero-terminated character arrays (strings). These are
parameters that will be passed to the daemon. Following those
parameters are a mixture of pointers to integers, pointers to
doubles, and strings, which receive data from the daemon. The
character arrays consist of a character array (pointer to character)
followed by an integer. The integer must contain the size of the
character array.
All of these functions return an integer status code. A negative value indicates an error. A 0 value indicates success. A value of 1 indicates that the operation was successfully started, but will not be completed until later. (Completion can be checked using the cmd_wait() function.) More details about the return codes can be found in src/xyerr.h.
The user-authentication system is currently not enabled. There is no need to use this function.
This command cancels a xy_cmd_do_movexy() , xy_cmd_do_moverelxy() , xy_cmd_do_moverd() , xy_cmd_do_moverelrd() , xy_cmd_do_reset() , or xy_cmd_do_monitorreset() command.
| Warning |
This command cannot actually stop the hardware from rebooting. It only stops the daemon from constantly monitoring the reboot. |
This commands shuts down the daemon immediately. This command brings down the daemon, regardless of the current state of the daemon. If it is necessary, to shut down the daemon, it is normally better to use shutdown instead. This command is only for use when shutdown fails (e.g., if the daemon is busy, and cannot be interrupted).
| Warning |
Normal users should never need to shut down the daemon. |
Download a new boot program to the Galil hardware.
| Warning |
Only the system maintainer should download a boot program. |
Stops tracking (non-sidereal guiding).
This command for debugging purposes only. It always fails and generates an error.
Adjusts the focus by a relative amount. duration is the amount of time that the motors should be enabled. Negative values of duration move the focus in the reverse direction.
The focus is not encoded, so positioning is only approximate. The end of travel is not detected.
Force the daemon to connect to the hardware.
| Warning |
The daemon normally connects automatically. The only time that it will not connect automatically, is if the terminal server is rebooted or if the user explicitly uses xy_cmd_do_galildisconnect() . |
Force the daemon to disconnect from the hardware.
| Warning |
The only time that the daemon should be disconnected is for system maintenance. |
Get the current state of the asynchronous mode flag.
Get the state of the busy flag. The busy flag is set whenever the daemon is performing an operation that does not complete immediately.
Get the state of the init0 flag. The init0 flag indicates the state of the Galil hardware. If it is DONE then all initialization completed successfully. If it is FAIL then initialization failed. If it is anything else, then initialization is still in progress.
Note that this command only returns the last known value of the init0 flag. Use xy_cmd_do_monitorreset() or xy_cmd_do_readinit0() to force the system to read the flag (normally not necessary unless the hardware has been rebooted). The xy_cmd_do_reset() command always monitors the reboot.
This command returns a string that is set whenever the daemon is performing an operation that takes a long time to complete (such as moving or focusing). The string provides a brief description of the operation.
This command returns the number of axes that is supported by the controller.
This command returns the current position of the xy stage, in the current relative R.A. and Dec coordinates.
It is generally wise to call xy_cmd_do_readrotang() before invoking this function.
Get the daemon's current value of the rotator angle.
Get the current scale factor that is used to convert from R.A. and Dec offsets to encoder units.
scaleid is the index which identifies the currently active scale factor (0-9).
scalefactor is the numeric value of the scale factor.
scaledescr is a text description of the scale factor.
Get the information for the specified scale factor.
ind is the index of the desired scale factor.
scaleid is the index which identifies the currently active scale factor (0-9). (This should be identical to ind. It is provided as a convenience, so that xy_cmd_do_getscale() and xy_cmd_do_getscaleinfo() provide identical data.)
scalefactor is the numeric value of the scale factor.
scaledescr is a text description of the scale factor.
Get the current value of the Galil hardware switches.
swx and swy return the numeric values of the switches.
swxstr and swystr return a text equivalent of the switches that is intended to be slightly more readable for humans.
Get the current state of the tracking flag.
The tracking flag is set whenever the system is tracking (non-sidereal guiding).
Get the current value of the rate variables for tracking (non-sidereal guiding).
Get the current version of the Galil hardware.
Gets the position of the xy stage in encoder units.
Updates the current value of a Galil hardware parameter.
The following parameters are supported: speed, accel (acceleration/deceleration), errlim (error limit), integ (integration servo parameters), gain (servo gain).
Note that this command only modifies the internal state of the daemon, and does not return the current value.
Gets the current value of a Galil hardware parameter.
The parameters are the same as are listed for gread.
Sets the current value of a Galil hardware parameter.
The parameters are the same as are listed for gread.
If the hardware is currently resetting, continuously check the state of the INIT0 flag.
Move the xy stage, using R.A. and Dec offsets relative to the origin of the xy stage.
It is generally a good idea to use xy_cmd_do_readrotang() before calling xy_cmd_do_moverd() .
Move the xy stage, using R.A. and Dec offsets, relative to the current position.
It is generally a good idea to use xy_cmd_do_readrotang() before calling xy_cmd_do_moverelrd() .
Move the xy stage, using encoder units, relative to the current position.
Not written.
Read back the current Galil start up code.
This is primarily used to verify that download worked correctly. It should not necessary to use it for any other purpose.
Updates the current value of the init0 flag.
This command does not return a value to the user. It only updates the internal state of the daemon. Use xy_cmd_do_getinit0() to get the value of the init0 flag.
This is identical to the xy_cmd_do_readxy() command, and is provided only for completeness.
Read the current rotator angle from the TCS controller.
Read the current values of the Galil hardware switches.
Force the daemon to re-read the position of the x and y axes from the hardware. Note that under normal circumstances, this is not necessary, because the daemon keeps track of when the x and y axes are changed. This command only updates the internal state of the daemon, and does not return the value to the user. To get the current value, use getxy.
Force a Galil hardware reset and monitor the init0 variable until the reset completes.
Sets the value of the asynchronous mode flag.
Manually set the value of the rotator angle.
Select one of the scale factors (0-9). Use xy_cmd_do_getscaleinfo() to get a description of the available scale factors.
Set the R.A. and Dec offset rates (marcsec / s)
This commands shuts down the daemon, after verifying that the daemon is in an idle state (i.e., that no mechanisms are moving).
| Warning |
Normal users should never need to shut down the daemon. |
Start tracking (non-sidereal guiding).
It is generally a good idea to use xy_cmd_do_readrotang() before calling xy_cmd_do_track() .
Normally, the daemon does not send an messages back except
in response to a user command. The user can request that the
messages be sent when an internal variable of the daemon changes
or when an operation completes. This is called "asynchronous
mode", and is set by the xy_cmd_do_func_setasync()
function.
The user may assign values to the following global
pointers-to-functions: xy_cmd_done_handler and
xy_cmd_update_handler. The user may also
assign values to the following global pointers-to-arbitrary-data:
xy_cmd_done_arg and xy_cmd_update_arg.
When asynchronous mode is enabled, and a message arrives while
or before xy_cmd_wait()
is invoked or before xy_cmd_do_get_async()
is invoked, then the function (*xy_cmd_done_handler)()
or (*xy_cmd_update_handler)() will be called.
xy_cmd_done_arg or xy_cmd_update_arg
will be passed as the first argument. The remaining arguments are
an integer, which contains the number of words in the asynchronous
message and an array of pointers-to-characters which contains the
words of the message.
For reference purposes, the definitions of the functions are provided here (though for programming, they are better obtained from src/xycmd.h.)
extern void (*xy_cmd_done_handler)(void *, int, char *[]); extern void *xy_cmd_done_arg; extern void (*xy_cmd_update_handler)(void *, int, char *[]); extern void *xy_cmd_update_arg;