For Windows, Linux, Unix. Mac OS X not supported (TCL-incompatible)
-->zaber // abstract < 10000 chars in this page
function [out] = zaber(command,target,varargin)
Scilab Driver for Zaber devices
Input arguments:
#1: Command name
#2: Device name or serial port number
#3: Data (position, etc)
GENERAL CONDITIONS
------------------
This function handles zaber devices set on one or several lines connected
to the serial ports of the computer (one line per port).
Each port (and related line) can be made of several zaber devices serially
plugged to each others.
Translation and rotation devices are supported and can be mixed along a line.
Hereafter, (NV) stands for Non-Volatile data. These data are stored in a
non-volatile memory into each device. Then, they are automatically
recovered after powering off/on the device.
REQUIREMENTS
------------
* Devices parameters must be known through a tab-separated CSV file.
A default file is provided herebelow.
Source: http://www.zaber.com/support/?tab=Device%20ids#tabs
In Scilab, a global variable named zaber_devs_params_file
must be set to point the pathfile.
* Scilab >= 5.4.0 is required
* Serial TCL toolbox 0.2 (E. Segre) must be loaded
http://atoms.scilab.org/toolboxes/serial
================
LIST OF COMMANDS
================
PORTS HANDLING
--------------
'open', ports :
Open the RS-232 communication for the given RS-232 ports.
[more infos in extended help]
Connexion parameters are set by the script. They are not tunable:
9600 bauds, 8 data bits, no parity, one stop bit, no hand shaking.
'close', ports :
Close the RS-232 communication for the given ports.
[more infos in extended help]
BUILDING a SETUP
----------------
Device internal format: [nickname portNumber rankOnLine idOnLine ToR ]
[more infos in the full help]
'listdevices', port:
List all declared zaber devices connected to the given serial port.
port 0 or unspecified => lists devices for all ports.
'adddev', port, devName {, rankOnLine {,aliasNum {, ToR }}} :
Adds a device to a setup & returns its current position [mm|°].
port: serial port number to which the device is connected.
If port is not yet declared, it is then opened prior to device
declaration.
devName: nickName of the device (string). Must be unique over all ports.
Nicknames are case sensitive.
rankOnLine: Rank at which the device is inserted (integer>0).
The device closest to the computer gets rank 1.
aliasNum: Alias number ascribed to the device (0 < number < 254).
ToR: 'R' for a rotation, 'T' for a translation.
(optional, only for checking purpose)
'rmdev', devNames :
Remove device(s) from a setup, plugged to one or several ports.
Remaining devices are renumbered afterwards if necessary.
SETTINGS
--------
'rename', devNames, newDevNames :
Renames a device or a set of devices
* devNames: Vector of nicknames of devices to be renamed
* newDevNames: Vector of new respective nicknames
Names of 2 devices may be commuted:
devName=[ 'dev1' 'dev2' ] newDevName=[ 'dev2' 'dev1']
'renum', ports : Renumbers device(s).
ports: vector of integers = number(s) of serial port(s) on which
plugged devices must be renumbered: The device closest to the
computer gets number 1, and so forth.
'reset',devNames :
Resets the devices given in the vector of devices names,
as if it was powered off, and then powered on again.
'set', devNames,'default': Resets devices to their default factory settings
'set', devName, properties, values :
'set', devName, 'property1=value, property2=value2,...'
The list of available properties is given herebelow (for 'get')
INFOS
-----
'zaber' : Displays the full help
'pos', devNames :
Returns the current position [mm|°] for the vector of named devices.
'status', devNames :
Returns the current status for the specified devices.
For each one, a list(code, keyword) is returned.
Possible (code, keyword) pairs describing the ongoing movement are:
0 idle, 1 home, 10 knob, 18 mvs, 20 mva, 21 mvr, 22 mvc, 23 stop
'get', devName [,properties][,%t]:
Reads and returns values of the querried properties, for the given device.
* If no property is specified, all properties are read and returned.
The full list with 28 ordered components is given below.
* If %t is set in last parameter, a string array A is returned, with
A(:,1): properties names in the query order. A property may be query
several times.
A(:,2): respective values of properties (in strings)
Else, a vector N of numbers is returned, with N(i) = value of properties(i)
Default mode is %F.
* Boolean properties have a name ending with "?".
Returned values are then 0 (meaning %F) or 1 (meaning %T)
* AVAILABLE PROPERTIES: (are case insensitive)
--------------------
[much more infos are provided in the full help]
(1) id: integer>0 identifying the model of device
(2) aliasId: integer 0|>0 = n° of pseudo-device (for grouping)
(3) version: Release number of the firmware of the device
(4) locked?: [0] | 1. 1 => non-volatile settings can't be changed
(like speed, range, etc)
(5) position: in mm | ° : (volatile)
default after power ON = mechanical position - homeOffset
(6) storedPos: 'set', devName, 'storedPos', #mem
stores the current position of the device in its
non-volatile memory number #mem (integer 0 - 15)
'get', devName, 'storedPos', #mem :
returns the position recorded in memory #mm in mm|°
(7) homeOffset: in mm | ° : When a 'home' is performed, this mechanical
position is set as the logical 0 position.
The 'range' parameter is changed accordingly.
(8) homeSet?: [0] | 1 : Flag set to 1 by some 'home', 'set..' or 'reset'
commands. [more infos in full help]
(9) autoHome?: [non-volatile] 0 | 1 :
1 => any movement reaching the mechanical 0 stops and
triggers a "home" command (see this command).
0 => prevents the auto-home behavior.
(10) resolution: 1 2 4 8 16 32 _64_ 128 are possible values of numbers
of microsteps/step.
(11) range: upper logical limit [mm|°]. can be > to mechanical limit!
(12) maxMvr: (to be implemented)
(13) acceleration: Acceleration [°/s^2 | mm/s^2 ]
(14) speed: Nominal speed [°/s | mm/s ]
(15) circularPhase?: 1 enables the smooth phase mode for microstepping [0]
(16) antiBacklash?: 1 enables compensation of mechanical hysteresis [0]
(17) antiStriction?: 1 enables anti-striction: Garanties that even very
small movements are performed. [0]
(18) voltage: Voltage [V] powering the device
(19) idleCurrent: current at rest = fraction of maximal current [0]
(20) activeCurrent: current at move = fraction of maximal current [1]
(21) powerLED?: The green LED is ON if the line is powered [1]
(22) dataLED?: The orange LED is ON when data are sent on the line [1]
(23) knob?: knob available and enable (for hand control) [1]
(24) knobReverse?: knob direction is inverted with respect to movement [0]
(25) moveTracking?: 1 enables tracking positions when the device moves [0]
manualMoveTracking?: 0 cancels tracking positions while the device is moved
with the knob [1]
(27) autoReply?: 0 cancels sending the final position into the buffer[1]
(28) messageByte6?: Byte#4 of data can be used to code any info [0]
MOVEMENTS
---------
Each command can be applied to a set of devices, with respective ranges.
If %t is passed in final parameter, a vector of the actual final positions
is returned after the last device has stopped. Else, 1000 is immediately
returned while devices are still running.
REMARK : Negative logical positions | angles are not allowed
(firmware limitation)[more infos in fulll help]
The logical home must be considered as the low-limit of the device.
Negative _relative_ movements are allowed, provided that they do not
reach negative logical positions.
'home' : Move to the mechanical home position, then
move to the homeOffset, and finally
set this position as 0.
'mva', devname, pos :
MoVe Absolute: Go to the position given as pos [mm|°]
'mvr', devName, shift:
MoVe Relative: Shifts the current position by the given shift
'mvc', devName, speed:
MoVe Continuously at the given constant speed [mm/s|°/s]
'mvs', devName, #mem:
MoVe the device to its position Stored in non-volatil memory
number #mem, with 0 <= #mem <=15.
The default positions stored in memories is 0 [mm|°].
devName and #mem may be vectors, to move several devices in a
once (untested)
'stop' : Decelerates the device from its current position, until it stops
'wait' : Waits for all given devices to stop. Then returns their position
EXAMPLES:
zaber('mva','rot',45.5) // 'rot' is run to reach 45.5.
zaber mva rot 45.5 // equivalent syntax
[more examples in extended help]
INTERNALS :
---------
A TCL zaber session contains all useful data.
ports & devices arrays are described in the full help