Go to the source code of this file.
Data Structures | |
struct | Commands |
Client command action function data structure. More... | |
Defines | |
#define | CMD_OK 0 |
Command executed OK, return completion status. | |
#define | CMD_ERR -1 |
Command execution resulted in an error. | |
#define | CMD_NOOP 1 |
Command execution requires no further action (no-op). | |
Functions | |
int | cmd_quit (char *, MsgType, char *) |
QUIT command - terminate the client session. | |
int | cmd_ping (char *, MsgType, char *) |
PING command - communication handshaking request. | |
int | cmd_pong (char *, MsgType, char *) |
PONG command - communication handshaking acknowledgment. | |
int | cmd_info (char *, MsgType, char *) |
INFO command - report client application runtime information. | |
int | cmd_version (char *, MsgType, char *) |
VERSION command - report application version and compilation info. | |
int | cmd_verbose (char *, MsgType, char *) |
VERBOSE command - toggle verbose console output on/off. | |
int | cmd_debug (char *, MsgType, char *) |
DEBUG command - toggle debugging (super-verbose) console output on/off. | |
int | cmd_help (char *, MsgType, char *) |
HELP command - print a list of commands on the client console. | |
int | cmd_history (char *, MsgType, char *) |
HISTORY command - show the application's interactive command history. | |
int | cmd_status (char *, MsgType, char *) |
STATUS command - report microstep drive motion status. | |
int | cmd_mstatus (char *, MsgType, char *) |
MSTATUS command - report detailed microstep drive status. | |
int | cmd_ports (char *, MsgType, char *) |
PORTS command - report info about open mechanism comm comm ports. | |
int | cmd_rdpos (char *, MsgType, char *) |
RDPOS command - read filter wheel position encoders. | |
int | cmd_setcur (char *, MsgType, char *) |
CURRENT command - set/query drive current in Amps. | |
int | cmd_seticur (char *, MsgType, char *) |
IDLECUR command - set/query idle current in Amps. | |
int | cmd_setsp (char *, MsgType, char *) |
SPEED command - set/query drive speed in rev/sec. | |
int | cmd_setacc (char *, MsgType, char *) |
ACCEL command - set/query move acceleration in rev/sec/sec. | |
int | cmd_setdec (char *, MsgType, char *) |
DECEL command - set/query move deceleration in rev/sec/sec. | |
int | cmd_setdist (char *, MsgType, char *) |
DIST command - set/query the motion profile move distance in steps. | |
int | cmd_setto (char *, MsgType, char *) |
TIMEOUT command - set/query the communication timeout interval in seconds. | |
int | cmd_setpt (char *, MsgType, char *) |
POLLTIME command - set/query the microstep drive polling interval in msec. | |
int | cmd_settopo (char *, MsgType, char *) |
TOPOLOGY command - set/query the mechanism topology. | |
int | cmd_idle (char *, MsgType, char *) |
IDLE command - enable/disable the microstep drive idle current. | |
int | cmd_reset (char *, MsgType, char *) |
RESET command - reload the runtime config paramters and re-initialize the microstep drive. | |
int | cmd_init (char *, MsgType, char *) |
INIT command - (re)initialize the microstep drive. | |
int | cmd_abort (char *, MsgType, char *) |
ABORT command - abort a move in progress. | |
int | cmd_sclcmds (char *, MsgType, char *) |
CMDS command - print a list of SCL microstep drive commands. | |
int | cmd_ismask (char *, MsgType, char *) |
ISMASK command - set/query the input status bitmask. | |
int | cmd_ndata (char *, MsgType, char *) |
NDATA command - set/query the number of encoder data bits. | |
int | cmd_inpos (char *, MsgType, char *) |
INPOS command - set/query the address of the in-position sensor input. | |
int | cmd_homeaddr (char *, MsgType, char *) |
HOMEADDR command - set/query the address of the home sensor input. | |
int | cmd_limits (char *, MsgType, char *) |
LIMITS command - set/query the limit switch settings. | |
int | cmd_moveit (char *, MsgType, char *) |
MOVE command - execute a generic move with verbose feedback. | |
int | cmd_moveabs (char *, MsgType, char *) |
MOVEABS command - move mechanism to an absolute step-count position. | |
int | cmd_moverel (char *, MsgType, char *) |
MOVEREL command - move mechanism relative to the current position. | |
int | cmd_moveto (char *, MsgType, char *) |
MOVETO command - move to indexed position N. | |
int | cmd_findpos (char *, MsgType, char *) |
FINDPOS command - seek the nearest valid indexed position. | |
Variables | |
Commands | cmdtab [] |
Client command action function data structure. | |
int | NumCommands = sizeof(cmdtab)/sizeof(struct Commands) |
number of commands defined |
To add a command, you need to
See commands.c for the full implementation details.
|
Command executed OK, return completion status.
|
|
Command execution resulted in an error.
|
|
Command execution requires no further action (no-op).
|
|
QUIT command - terminate the client session.
|
|
PING command - communication handshaking request.
PINGs are actually handled separately in the SocketCommand() handler (nothing is done by the KeyboardCommand() handler) because the PONG sent back acknowledging the comm handshaking request is, in effect, a pseudo-command (implicit REQ:), not a "DONE:" response to a command request. This exception to the general messaging syntax has to be handled carefully to prevent problems, especially to ensure backwards compatibility with older IMPv applications.
|
|
PONG command - communication handshaking acknowledgment.
cmd_pong doesn't do anything except return a CMD_NOOP (since this "command" must NOT result in a reply back to the sender). In more sophisticated apps, we might actually use receipt of a pong to do something useful (e.g., help build up a node table), so at the very least this module works as a placeholder for future expansion.
|
|
INFO command - report client application runtime information.
The format of cmd_info should be tailored specifically for the particular client application. If a client controls specific instrument or interface functions, the state of those functions should be reported in the info string, making it an omnibus "what is your status" command. Example Output: ID=SCL2 Host=darkstar:10702 Mode=STANDALONE SCLPort=172.16.1.56:8002 Verbose -DEBUG rcfile=port2.ini |
|
VERSION command - report application version and compilation info.
Example output: Version=v1.0 CompileDate=2004-Jun-11 CompileTime=17:08:15 |
|
VERBOSE command - toggle verbose console output on/off.
In general "Verbose" output refers only to client application level output (i.e., echoing socket message traffic, printing status update info, etc.). An more chatty DEBUG mode is provided that prints more engineering-level info for detailed low-level system debugging.
|
|
DEBUG command - toggle debugging (super-verbose) console output on/off.
DEBUG mode is a super-verbose mode that spews lots of I/O chatter onto the application console, useful during client debugging or for troubleshooting. For example, in client applications that control stepper motors, the full motor control chatter is echoed to the console during DEBUG mode to enable the user to follow the steps the system is (or is not) taking, watch encoder and limit switches assert (or not), etc. DEBUG is normally disabled during normal user operations.
|
|
HELP command - print a list of commands on the client console.
If an argument is given, it tries to find that string in the command list, and if successful, prints a brief description and usage message. Help is meant to be simple. It can give help on particular commands (really a reminder of the command's function and syntax), or a list of all commands. |
|
HISTORY command - show the application's interactive command history.
|
|
STATUS command - report microstep drive motion status.
The report is formatted as IMPv2-compliant message with the parameters given as keyword=value pairs. For example: For the current microstep drive internal parameters, use the MSTATUS command (cmd_mstatus()).
|
|
MSTATUS command - report detailed microstep drive status.
This is low-level stuff, meaningful only to people who know the SCL command set, or have the manual at hand. If you have to look at mstatus, you have to be ready to get down to the nitty-gritty. Use the STATUS command if you only want to view the motion and input parameters. MSTATUS shows everything... Example:
|
|
PORTS command - report info about open mechanism comm comm ports.
FWPort=/dev/ttyS0 Open |
|
RDPOS command - read filter wheel position encoders.
Typical output: RawIn=01111111 Inputs=10000000 ISMask=00000000 IPos=63737This shows the raw input bits, the masked input bits, the input status mask used (see cmd_ismask()), and the step count position. |
|
CURRENT command - set/query drive current in Amps.
The default idle current (CI parameter) is 50% of the drive current. If we are using a non-default idle current, we need to restore that value after setting CC (since CI is recomputed by the CC set command). A default idle current is denoted by scl.IdleCurrent<0.0 amps. NOTE: the maximum current is not specified a priori, so we need to find some way to set this in the header. At present, until we work this out, this could allow dangerously high currents to be set.
|
|
IDLECUR command - set/query idle current in Amps.
If the idle current is set to -1, the default idle current, which is 50% of the drive current, is used. NOTE: the maximum current is not specified a priori, so we need to find some way to set this in the header. At present, until we work this out, this could allow dangerously high currents to be set.
|
|
SPEED command - set/query drive speed in rev/sec.
Speeds must be in the range #SI_MINVEL to #SI_MAXVEL (defined in siutils.h) |
|
ACCEL command - set/query move acceleration in rev/sec/sec.
Accelerations are in integer steps from #SI_MINVDOT to #SI_MAXVDOT (defined in siutils.h). |
|
DECEL command - set/query move deceleration in rev/sec/sec.
Decelerations are in integer steps from #SI_MINVDOT to #SI_MAXVDOT (defined in siutils.h), in units of rev/s/s. |
|
DIST command - set/query the motion profile move distance in steps.
Move distances are in integer units of steps, + or -, with value in the range #SI_MAXMOVE (see scutils.h) |
|
TIMEOUT command - set/query the communication timeout interval in seconds.
This is an internal variable, no microstep controller setting is required. |
|
POLLTIME command - set/query the microstep drive polling interval in msec.
In practice, roundtrip communications via 9600 baud serial to this family of microstep drives is around 40-50msec for a typical parameter query or parameter setting operation. The polling time should not be so fast as to harrass the controller, possibly intefering with its ability to execute a move. A typical polling time we use is 100-200msec, providing 5 status messages/second which seems more than sufficient when debugging drive performance. |
|
TOPOLOGY command - set/query the mechanism topology.
The drive topology tells the system how to move between fixed ("indexed") positions. In a linear drive, it simply moves directly to the position requested, but in a rotary drive, which can approach a position from clockwise or counter-clockwise around the circle, it selects the shortest path to that position. |
|
IDLE command - enable/disable the microstep drive idle current.
Sets the scl.Idle flag (1=enabled, 0=disabled), and uploads either the "MD" ("Motor Disable") or "ME" ("Motor Enable") commands to the Si controller. Note that a move can in fact be launched even if the drive is "disabled", as all that is disabled is the idle current (i.e., ME sets the idle current to 50% of the drive current and turns the drive on, while MD sets the idle current to 0 and turns the drive off. The next FL or other "move" command will start the drive at full current). If IDLE is given with no arguments, it reports the current idle setting (as it is known) |
|
RESET command - reload the runtime config paramters and re-initialize the microstep drive.
This provides the client application with a warm restart facility. |
|
INIT command - (re)initialize the microstep drive.
|
|
ABORT command - abort a move in progress.
It then queries the drive status after sending the abort to try to determine the drive status. |
|
CMDS command - print a list of SCL microstep drive commands.
For a list of client commands, see HELP (cmd_help()).
|
|
ISMASK command - set/query the input status bitmask.
The input status mask (ISMask) needs to be set correctly to interpret the input sensors, since in practice inputs may be either normally open or normally closed depending on the application. The input status mask is a string of eight (8) 1s and 0s, defined as follows. For the i-th mask bit, 0 means the input is asserted (true) when INi=0 (closed) 1 means the input is asserted (true) when INi=1 (open)Beware: the order of bits in ismask is identical to the order of bits in the raw controller IS string (i.e., IN8..IN1).
ismask 00001111; IN1..IN4 is 1 if there is a hole under the proximity sensor (binary 1 = "asserted"), and 0 if there is metal under the sensor (binary 0 = "deasserted"). We mask IN5..IN8 as 0 so that they always be deasserted 0 since they are unused. The result of using this mask on the above IS string is as follows: raw status = 11111001 ismask = 00001111 result = 00001001The masked status bits make it easy to see that only IN1 (position 1s bit) and IN4 (the in-position bit) are asserted.
|
|
NDATA command - set/query the number of encoder data bits.
If NDATA was given without arguments, it returns the current number of data bits. The command "NDATA 0" disabled sensing position with the inputs. The input status mask (ISMask) needs to be set correctly to interpret the input sensors. See cmd_ismask() for the gory details.
|
|
INPOS command - set/query the address of the in-position sensor input.
If INPOS was given without arguments, it returns the current address of the in-position bit. The input status mask (ISMask) needs to be set correctly to interpret the input sensors. See cmd_ismask() for the gory details.
|
|
HOMEADDR command - set/query the address of the home sensor input.
If HOMEADDR was given without arguments, it returns the current address of the home sensor input. The input status mask (ISMask) needs to be set correctly to interpret the input sensors. See cmd_ismask() for the gory details.
|
|
LIMITS command - set/query the limit switch settings.
|
|
MOVE command - execute a generic move with verbose feedback.
The argument must be a valid raw move command (FL, FP, etc.) which it is to execute then monitor to completion. If MOVE is given with no arguments a usage error message is printed. |
|
MOVEABS command - move mechanism to an absolute step-count position.
|
|
MOVEREL command - move mechanism relative to the current position.
|
|
MOVETO command - move to indexed position N.
In a rotary indexed mechanism, it moves to the requested position via the least path clockwise or counterclockwise. If MOVETO is issued without arguments, it reports the current indexed position. |
|
FINDPOS command - seek the nearest valid indexed position.
|
|
Client command action function data structure.
|
|
number of commands defined
|