public class YStepperMotor extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YStepperMotor.TimedReportCallback
TimedReportCallback for StepperMotor
|
static interface |
YStepperMotor.UpdateCallback
Deprecated UpdateCallback for StepperMotor
|
Modifier and Type | Field and Description |
---|---|
protected String |
_alertMode |
protected String |
_auxMode |
protected int |
_auxSignal |
protected String |
_command |
protected int |
_diags |
protected double |
_maxAccel |
protected double |
_maxSpeed |
protected int |
_motorState |
protected int |
_overcurrent |
protected double |
_pullinSpeed |
protected double |
_speed |
protected int |
_stepping |
protected double |
_stepPos |
protected int |
_tCurrRun |
protected int |
_tCurrStop |
protected YStepperMotor.UpdateCallback |
_valueCallbackStepperMotor |
static String |
ALERTMODE_INVALID
invalid alertMode value
|
static String |
AUXMODE_INVALID
invalid auxMode value
|
static int |
AUXSIGNAL_INVALID
invalid auxSignal value
|
static String |
COMMAND_INVALID
invalid command value
|
static int |
DIAGS_INVALID
invalid diags value
|
static double |
MAXACCEL_INVALID
invalid maxAccel value
|
static double |
MAXSPEED_INVALID
invalid maxSpeed value
|
static int |
MOTORSTATE_ABSENT
invalid motorState value
|
static int |
MOTORSTATE_ALERT |
static int |
MOTORSTATE_BATCH |
static int |
MOTORSTATE_HI_Z |
static int |
MOTORSTATE_INVALID |
static int |
MOTORSTATE_RUN |
static int |
MOTORSTATE_STOP |
static int |
OVERCURRENT_INVALID
invalid overcurrent value
|
static double |
PULLINSPEED_INVALID
invalid pullinSpeed value
|
static double |
SPEED_INVALID
invalid speed value
|
static int |
STEPPING_FULLSTEP |
static int |
STEPPING_HALFSTEP |
static int |
STEPPING_INVALID |
static int |
STEPPING_MICROSTEP16
invalid stepping value
|
static int |
STEPPING_MICROSTEP4 |
static int |
STEPPING_MICROSTEP8 |
static double |
STEPPOS_INVALID
invalid stepPos value
|
static int |
TCURRRUN_INVALID
invalid tCurrRun value
|
static int |
TCURRSTOP_INVALID
invalid tCurrStop value
|
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID
Modifier | Constructor and Description |
---|---|
protected |
YStepperMotor(String func) |
protected |
YStepperMotor(YAPIContext ctx,
String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(org.json.JSONObject json_val) |
int |
abortAndBrake()
Stops the motor smoothly as soon as possible, without waiting for ongoing move completion.
|
int |
abortAndHiZ()
Turn the controller into Hi-Z mode immediately, without waiting for ongoing move completion.
|
int |
alertStepOut()
Move one step in the direction opposite the direction set when the most recent alert was raised.
|
int |
changeSpeed(double speed)
Starts the motor at a given speed.
|
int |
emergencyStop()
Stops the motor with an emergency alert, without taking any additional precaution.
|
int |
findHomePosition(double speed)
Starts the motor backward at the specified speed, to search for the motor home position.
|
static YStepperMotor |
FindStepperMotor(String func)
Retrieves a stepper motor for a given identifier.
|
static YStepperMotor |
FindStepperMotorInContext(YAPIContext yctx,
String func)
Retrieves a stepper motor for a given identifier in a YAPI context.
|
static YStepperMotor |
FirstStepperMotor()
Starts the enumeration of stepper motors currently accessible.
|
static YStepperMotor |
FirstStepperMotorInContext(YAPIContext yctx)
Starts the enumeration of stepper motors currently accessible.
|
String |
get_alertMode() |
String |
get_auxMode() |
int |
get_auxSignal()
Returns the current value of the signal generated on the auxiliary output.
|
String |
get_command() |
int |
get_diags()
Returns the stepper motor controller diagnostics, as a bitmap.
|
double |
get_maxAccel()
Returns the maximal motor acceleration, measured in steps per second^2.
|
double |
get_maxSpeed()
Returns the maximal motor speed, measured in steps per second.
|
int |
get_motorState()
Returns the motor working state.
|
int |
get_overcurrent()
Returns the overcurrent alert and emergency stop threshold, measured in mA.
|
double |
get_pullinSpeed()
Returns the motor speed immediately reachable from stop state, measured in steps per second.
|
double |
get_speed()
Returns current motor speed, measured in steps per second.
|
int |
get_stepping()
Returns the stepping mode used to drive the motor.
|
double |
get_stepPos()
Returns the current logical motor position, measured in steps.
|
int |
get_tCurrRun()
Returns the torque regulation current when the motor is running, measured in mA.
|
int |
get_tCurrStop()
Returns the torque regulation current when the motor is stopped, measured in mA.
|
String |
getAlertMode() |
String |
getAuxMode() |
int |
getAuxSignal()
Returns the current value of the signal generated on the auxiliary output.
|
String |
getCommand() |
int |
getDiags()
Returns the stepper motor controller diagnostics, as a bitmap.
|
double |
getMaxAccel()
Returns the maximal motor acceleration, measured in steps per second^2.
|
double |
getMaxSpeed()
Returns the maximal motor speed, measured in steps per second.
|
int |
getMotorState()
Returns the motor working state.
|
int |
getOvercurrent()
Returns the overcurrent alert and emergency stop threshold, measured in mA.
|
double |
getPullinSpeed()
Returns the motor speed immediately reachable from stop state, measured in steps per second.
|
double |
getSpeed()
Returns current motor speed, measured in steps per second.
|
int |
getStepping()
Returns the stepping mode used to drive the motor.
|
double |
getStepPos()
Returns the current logical motor position, measured in steps.
|
int |
getTCurrRun()
Returns the torque regulation current when the motor is running, measured in mA.
|
int |
getTCurrStop()
Returns the torque regulation current when the motor is stopped, measured in mA.
|
int |
moveRel(double relPos)
Starts the motor to reach a given relative position.
|
int |
moveTo(double absPos)
Starts the motor to reach a given absolute position.
|
YStepperMotor |
nextStepperMotor()
Continues the enumeration of stepper motors started using yFirstStepperMotor().
|
int |
pause(int waitMs)
Keep the motor in the same state for the specified amount of time, before processing next command.
|
int |
registerValueCallback(YStepperMotor.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
reset()
Reinitialize the controller and clear all alert flags.
|
int |
sendCommand(String command) |
int |
set_alertMode(String newval) |
int |
set_auxMode(String newval) |
int |
set_auxSignal(int newval)
Changes the value of the signal generated on the auxiliary output.
|
int |
set_command(String newval) |
int |
set_maxAccel(double newval)
Changes the maximal motor acceleration, measured in steps per second^2.
|
int |
set_maxSpeed(double newval)
Changes the maximal motor speed, measured in steps per second.
|
int |
set_overcurrent(int newval)
Changes the overcurrent alert and emergency stop threshold, measured in mA.
|
int |
set_pullinSpeed(double newval)
Changes the motor speed immediately reachable from stop state, measured in steps per second.
|
int |
set_stepping(int newval)
Changes the stepping mode used to drive the motor.
|
int |
set_stepPos(double newval)
Changes the current logical motor position, measured in steps.
|
int |
set_tCurrRun(int newval)
Changes the torque regulation current when the motor is running, measured in mA.
|
int |
set_tCurrStop(int newval)
Changes the torque regulation current when the motor is stopped, measured in mA.
|
int |
setAlertMode(String newval) |
int |
setAuxMode(String newval) |
int |
setAuxSignal(int newval)
Changes the value of the signal generated on the auxiliary output.
|
int |
setCommand(String newval) |
int |
setMaxAccel(double newval)
Changes the maximal motor acceleration, measured in steps per second^2.
|
int |
setMaxSpeed(double newval)
Changes the maximal motor speed, measured in steps per second.
|
int |
setOvercurrent(int newval)
Changes the overcurrent alert and emergency stop threshold, measured in mA.
|
int |
setPullinSpeed(double newval)
Changes the motor speed immediately reachable from stop state, measured in steps per second.
|
int |
setStepping(int newval)
Changes the stepping mode used to drive the motor.
|
int |
setStepPos(double newval)
Changes the current logical motor position, measured in steps.
|
int |
setTCurrRun(int newval)
Changes the torque regulation current when the motor is running, measured in mA.
|
int |
setTCurrStop(int newval)
Changes the torque regulation current when the motor is stopped, measured in mA.
|
_AddToCache, _clearDataStreamCache, _devRequest, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setAdvertisedValue, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final int MOTORSTATE_ABSENT
public static final int MOTORSTATE_ALERT
public static final int MOTORSTATE_HI_Z
public static final int MOTORSTATE_STOP
public static final int MOTORSTATE_RUN
public static final int MOTORSTATE_BATCH
public static final int MOTORSTATE_INVALID
public static final int DIAGS_INVALID
public static final double STEPPOS_INVALID
public static final double SPEED_INVALID
public static final double PULLINSPEED_INVALID
public static final double MAXACCEL_INVALID
public static final double MAXSPEED_INVALID
public static final int STEPPING_MICROSTEP16
public static final int STEPPING_MICROSTEP8
public static final int STEPPING_MICROSTEP4
public static final int STEPPING_HALFSTEP
public static final int STEPPING_FULLSTEP
public static final int STEPPING_INVALID
public static final int OVERCURRENT_INVALID
public static final int TCURRSTOP_INVALID
public static final int TCURRRUN_INVALID
public static final String ALERTMODE_INVALID
public static final String AUXMODE_INVALID
public static final int AUXSIGNAL_INVALID
public static final String COMMAND_INVALID
protected int _motorState
protected int _diags
protected double _stepPos
protected double _speed
protected double _pullinSpeed
protected double _maxAccel
protected double _maxSpeed
protected int _stepping
protected int _overcurrent
protected int _tCurrStop
protected int _tCurrRun
protected String _alertMode
protected String _auxMode
protected int _auxSignal
protected String _command
protected YStepperMotor.UpdateCallback _valueCallbackStepperMotor
protected YStepperMotor(YAPIContext ctx, String func)
func
- : functionidprotected YStepperMotor(String func)
func
- : functionidprotected void _parseAttr(org.json.JSONObject json_val) throws org.json.JSONException
_parseAttr
in class YFunction
org.json.JSONException
public int get_motorState() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getMotorState() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_diags() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getDiags() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_stepPos(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the current logical motor position, measured in stepsYAPI_Exception
- on errorpublic int setStepPos(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the current logical motor position, measured in stepsYAPI_Exception
- on errorpublic double get_stepPos() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getStepPos() throws YAPI_Exception
YAPI_Exception
- on errorpublic double get_speed() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getSpeed() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_pullinSpeed(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the motor speed immediately reachable from
stop state, measured in steps per secondYAPI_Exception
- on errorpublic int setPullinSpeed(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the motor speed immediately reachable from
stop state, measured in steps per secondYAPI_Exception
- on errorpublic double get_pullinSpeed() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getPullinSpeed() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_maxAccel(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the maximal motor acceleration, measured
in steps per second^2YAPI_Exception
- on errorpublic int setMaxAccel(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the maximal motor acceleration, measured
in steps per second^2YAPI_Exception
- on errorpublic double get_maxAccel() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getMaxAccel() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_maxSpeed(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the maximal motor speed, measured in steps per secondYAPI_Exception
- on errorpublic int setMaxSpeed(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the maximal motor speed, measured in steps per secondYAPI_Exception
- on errorpublic double get_maxSpeed() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getMaxSpeed() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_stepping() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getStepping() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_stepping(int newval) throws YAPI_Exception
newval
- : a value among YStepperMotor.STEPPING_MICROSTEP16,
YStepperMotor.STEPPING_MICROSTEP8, YStepperMotor.STEPPING_MICROSTEP4,
YStepperMotor.STEPPING_HALFSTEP and YStepperMotor.STEPPING_FULLSTEP corresponding to the stepping
mode used to drive the motorYAPI_Exception
- on errorpublic int setStepping(int newval) throws YAPI_Exception
newval
- : a value among Y_STEPPING_MICROSTEP16, Y_STEPPING_MICROSTEP8, Y_STEPPING_MICROSTEP4,
Y_STEPPING_HALFSTEP and Y_STEPPING_FULLSTEP corresponding to the stepping mode used to drive the motorYAPI_Exception
- on errorpublic int get_overcurrent() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getOvercurrent() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_overcurrent(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the overcurrent alert and emergency stop threshold, measured in mAYAPI_Exception
- on errorpublic int setOvercurrent(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the overcurrent alert and emergency stop threshold, measured in mAYAPI_Exception
- on errorpublic int get_tCurrStop() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getTCurrStop() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_tCurrStop(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the torque regulation current when the motor is
stopped, measured in mAYAPI_Exception
- on errorpublic int setTCurrStop(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the torque regulation current when the motor is
stopped, measured in mAYAPI_Exception
- on errorpublic int get_tCurrRun() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getTCurrRun() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_tCurrRun(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the torque regulation current when the motor is
running, measured in mAYAPI_Exception
- on errorpublic int setTCurrRun(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the torque regulation current when the motor is
running, measured in mAYAPI_Exception
- on errorpublic String get_alertMode() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getAlertMode() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_alertMode(String newval) throws YAPI_Exception
YAPI_Exception
public int setAlertMode(String newval) throws YAPI_Exception
YAPI_Exception
public String get_auxMode() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getAuxMode() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_auxMode(String newval) throws YAPI_Exception
YAPI_Exception
public int setAuxMode(String newval) throws YAPI_Exception
YAPI_Exception
public int get_auxSignal() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getAuxSignal() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_auxSignal(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the value of the signal generated on the auxiliary outputYAPI_Exception
- on errorpublic int setAuxSignal(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the value of the signal generated on the auxiliary outputYAPI_Exception
- on errorpublic String get_command() throws YAPI_Exception
YAPI_Exception
- on errorpublic String getCommand() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_command(String newval) throws YAPI_Exception
YAPI_Exception
public int setCommand(String newval) throws YAPI_Exception
YAPI_Exception
public static YStepperMotor FindStepperMotor(String func)
func
- : a string that uniquely characterizes the stepper motorpublic static YStepperMotor FindStepperMotorInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the stepper motorpublic int registerValueCallback(YStepperMotor.UpdateCallback callback)
callback
- : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and the character string describing
the new advertised value.public int _invokeValueCallback(String value)
_invokeValueCallback
in class YFunction
public int sendCommand(String command) throws YAPI_Exception
YAPI_Exception
public int reset() throws YAPI_Exception
YAPI_Exception
- on errorpublic int findHomePosition(double speed) throws YAPI_Exception
speed
- : desired speed, in steps per second.YAPI_Exception
- on errorpublic int changeSpeed(double speed) throws YAPI_Exception
speed
- : desired speed, in steps per second. The minimal non-zero speed
is 0.001 pulse per second.YAPI_Exception
- on errorpublic int moveTo(double absPos) throws YAPI_Exception
absPos
- : absolute position, measured in steps from the origin.YAPI_Exception
- on errorpublic int moveRel(double relPos) throws YAPI_Exception
relPos
- : relative position, measured in steps from the current position.YAPI_Exception
- on errorpublic int pause(int waitMs) throws YAPI_Exception
waitMs
- : wait time, specified in milliseconds.YAPI_Exception
- on errorpublic int emergencyStop() throws YAPI_Exception
YAPI_Exception
- on errorpublic int alertStepOut() throws YAPI_Exception
YAPI_Exception
- on errorpublic int abortAndBrake() throws YAPI_Exception
YAPI_Exception
- on errorpublic int abortAndHiZ() throws YAPI_Exception
YAPI_Exception
- on errorpublic YStepperMotor nextStepperMotor()
public static YStepperMotor FirstStepperMotor()
public static YStepperMotor FirstStepperMotorInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2017. All rights reserved.