public class YMotor extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YMotor.TimedReportCallback
TimedReportCallback for Motor
|
static interface |
YMotor.UpdateCallback
Deprecated UpdateCallback for Motor
|
Modifier and Type | Field and Description |
---|---|
protected double |
_brakingForce |
protected String |
_command |
protected double |
_cutOffVoltage |
protected double |
_drivingForce |
protected int |
_failSafeTimeout |
protected double |
_frequency |
protected int |
_motorStatus |
protected int |
_overCurrentLimit |
protected int |
_starterTime |
protected YMotor.UpdateCallback |
_valueCallbackMotor |
static double |
BRAKINGFORCE_INVALID
invalid brakingForce value
|
static String |
COMMAND_INVALID
invalid command value
|
static double |
CUTOFFVOLTAGE_INVALID
invalid cutOffVoltage value
|
static double |
DRIVINGFORCE_INVALID
invalid drivingForce value
|
static int |
FAILSAFETIMEOUT_INVALID
invalid failSafeTimeout value
|
static double |
FREQUENCY_INVALID
invalid frequency value
|
static int |
MOTORSTATUS_BACKWD |
static int |
MOTORSTATUS_BRAKE |
static int |
MOTORSTATUS_FAILSF |
static int |
MOTORSTATUS_FORWD |
static int |
MOTORSTATUS_HICURR |
static int |
MOTORSTATUS_HIHEAT |
static int |
MOTORSTATUS_IDLE
invalid motorStatus value
|
static int |
MOTORSTATUS_INVALID |
static int |
MOTORSTATUS_LOVOLT |
static int |
OVERCURRENTLIMIT_INVALID
invalid overCurrentLimit value
|
static int |
STARTERTIME_INVALID
invalid starterTime 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 |
YMotor(String func) |
protected |
YMotor(YAPIContext ctx,
String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) |
int |
brakingForceMove(double targetPower,
int delay)
Changes progressively the braking force applied to the motor for a specific duration.
|
int |
drivingForceMove(double targetPower,
int delay)
Changes progressively the power sent to the moteur for a specific duration.
|
static YMotor |
FindMotor(String func)
Retrieves a motor for a given identifier.
|
static YMotor |
FindMotorInContext(YAPIContext yctx,
String func)
Retrieves a motor for a given identifier in a YAPI context.
|
static YMotor |
FirstMotor()
Starts the enumeration of motors currently accessible.
|
static YMotor |
FirstMotorInContext(YAPIContext yctx)
Starts the enumeration of motors currently accessible.
|
double |
get_brakingForce()
Returns the braking force applied to the motor, as a percentage.
|
String |
get_command() |
double |
get_cutOffVoltage()
Returns the threshold voltage under which the controller automatically switches to error state
and prevents further current draw.
|
double |
get_drivingForce()
Returns the power sent to the motor, as a percentage between -100% and +100%.
|
int |
get_failSafeTimeout()
Returns the delay in milliseconds allowed for the controller to run autonomously without
receiving any instruction from the control process.
|
double |
get_frequency()
Returns the PWM frequency used to control the motor.
|
int |
get_motorStatus()
Return the controller state.
|
int |
get_overCurrentLimit()
Returns the current threshold (in mA) above which the controller automatically
switches to error state.
|
int |
get_starterTime()
Returns the duration (in ms) during which the motor is driven at low frequency to help
it start up.
|
double |
getBrakingForce()
Returns the braking force applied to the motor, as a percentage.
|
double |
getCutOffVoltage()
Returns the threshold voltage under which the controller automatically switches to error state
and prevents further current draw.
|
double |
getDrivingForce()
Returns the power sent to the motor, as a percentage between -100% and +100%.
|
int |
getFailSafeTimeout()
Returns the delay in milliseconds allowed for the controller to run autonomously without
receiving any instruction from the control process.
|
double |
getFrequency()
Returns the PWM frequency used to control the motor.
|
int |
getMotorStatus()
Return the controller state.
|
int |
getOverCurrentLimit()
Returns the current threshold (in mA) above which the controller automatically
switches to error state.
|
int |
getStarterTime()
Returns the duration (in ms) during which the motor is driven at low frequency to help
it start up.
|
int |
keepALive()
Rearms the controller failsafe timer.
|
YMotor |
nextMotor()
Continues the enumeration of motors started using yFirstMotor().
|
int |
registerValueCallback(YMotor.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
resetStatus()
Reset the controller state to IDLE.
|
int |
set_brakingForce(double newval)
Changes immediately the braking force applied to the motor (in percents).
|
int |
set_command(String newval) |
int |
set_cutOffVoltage(double newval)
Changes the threshold voltage under which the controller automatically switches to error state
and prevents further current draw.
|
int |
set_drivingForce(double newval)
Changes immediately the power sent to the motor.
|
int |
set_failSafeTimeout(int newval)
Changes the delay in milliseconds allowed for the controller to run autonomously without
receiving any instruction from the control process.
|
int |
set_frequency(double newval)
Changes the PWM frequency used to control the motor.
|
int |
set_motorStatus(int newval) |
int |
set_overCurrentLimit(int newval)
Changes the current threshold (in mA) above which the controller automatically
switches to error state.
|
int |
set_starterTime(int newval)
Changes the duration (in ms) during which the motor is driven at low frequency to help
it start up.
|
int |
setBrakingForce(double newval)
Changes immediately the braking force applied to the motor (in percents).
|
int |
setCutOffVoltage(double newval)
Changes the threshold voltage under which the controller automatically switches to error state
and prevents further current draw.
|
int |
setDrivingForce(double newval)
Changes immediately the power sent to the motor.
|
int |
setFailSafeTimeout(int newval)
Changes the delay in milliseconds allowed for the controller to run autonomously without
receiving any instruction from the control process.
|
int |
setFrequency(double newval)
Changes the PWM frequency used to control the motor.
|
int |
setOverCurrentLimit(int newval)
Changes the current threshold (in mA) above which the controller automatically
switches to error state.
|
int |
setStarterTime(int newval)
Changes the duration (in ms) during which the motor is driven at low frequency to help
it start up.
|
_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, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final int MOTORSTATUS_IDLE
public static final int MOTORSTATUS_BRAKE
public static final int MOTORSTATUS_FORWD
public static final int MOTORSTATUS_BACKWD
public static final int MOTORSTATUS_LOVOLT
public static final int MOTORSTATUS_HICURR
public static final int MOTORSTATUS_HIHEAT
public static final int MOTORSTATUS_FAILSF
public static final int MOTORSTATUS_INVALID
public static final double DRIVINGFORCE_INVALID
public static final double BRAKINGFORCE_INVALID
public static final double CUTOFFVOLTAGE_INVALID
public static final int OVERCURRENTLIMIT_INVALID
public static final double FREQUENCY_INVALID
public static final int STARTERTIME_INVALID
public static final int FAILSAFETIMEOUT_INVALID
public static final String COMMAND_INVALID
protected int _motorStatus
protected double _drivingForce
protected double _brakingForce
protected double _cutOffVoltage
protected int _overCurrentLimit
protected double _frequency
protected int _starterTime
protected int _failSafeTimeout
protected String _command
protected YMotor.UpdateCallback _valueCallbackMotor
protected YMotor(YAPIContext ctx, String func)
func
- : functionidprotected YMotor(String func)
func
- : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) throws Exception
_parseAttr
in class YFunction
Exception
public int get_motorStatus() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getMotorStatus() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_motorStatus(int newval) throws YAPI_Exception
YAPI_Exception
public int set_drivingForce(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to immediately the power sent to the motorYAPI_Exception
- on errorpublic int setDrivingForce(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to immediately the power sent to the motorYAPI_Exception
- on errorpublic double get_drivingForce() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getDrivingForce() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_brakingForce(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to immediately the braking force applied to
the motor (in percents)YAPI_Exception
- on errorpublic int setBrakingForce(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to immediately the braking force applied to
the motor (in percents)YAPI_Exception
- on errorpublic double get_brakingForce() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getBrakingForce() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_cutOffVoltage(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the threshold voltage under which the
controller automatically switches to error state
and prevents further current drawYAPI_Exception
- on errorpublic int setCutOffVoltage(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the threshold voltage under which the
controller automatically switches to error state
and prevents further current drawYAPI_Exception
- on errorpublic double get_cutOffVoltage() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getCutOffVoltage() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_overCurrentLimit() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getOverCurrentLimit() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_overCurrentLimit(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the current threshold (in mA) above which the
controller automatically
switches to error stateYAPI_Exception
- on errorpublic int setOverCurrentLimit(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the current threshold (in mA) above which the
controller automatically
switches to error stateYAPI_Exception
- on errorpublic int set_frequency(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM frequency used to control the motorYAPI_Exception
- on errorpublic int setFrequency(double newval) throws YAPI_Exception
newval
- : a floating point number corresponding to the PWM frequency used to control the motorYAPI_Exception
- on errorpublic double get_frequency() throws YAPI_Exception
YAPI_Exception
- on errorpublic double getFrequency() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_starterTime() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getStarterTime() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_starterTime(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the duration (in ms) during which the motor is driven
at low frequency to help
it start upYAPI_Exception
- on errorpublic int setStarterTime(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the duration (in ms) during which the motor is driven
at low frequency to help
it start upYAPI_Exception
- on errorpublic int get_failSafeTimeout() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getFailSafeTimeout() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_failSafeTimeout(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the delay in milliseconds allowed for the controller to
run autonomously without
receiving any instruction from the control processYAPI_Exception
- on errorpublic int setFailSafeTimeout(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the delay in milliseconds allowed for the controller to
run autonomously without
receiving any instruction from the control processYAPI_Exception
- on errorpublic String get_command() throws YAPI_Exception
YAPI_Exception
public int set_command(String newval) throws YAPI_Exception
YAPI_Exception
public static YMotor FindMotor(String func)
func
- : a string that uniquely characterizes the motorpublic static YMotor FindMotorInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the motorpublic int registerValueCallback(YMotor.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 keepALive() throws YAPI_Exception
YAPI_Exception
public int resetStatus() throws YAPI_Exception
YAPI_Exception
public int drivingForceMove(double targetPower, int delay) throws YAPI_Exception
targetPower
- : desired motor power, in percents (between -100% and +100%)delay
- : duration (in ms) of the transitionYAPI_Exception
- on errorpublic int brakingForceMove(double targetPower, int delay) throws YAPI_Exception
targetPower
- : desired braking force, in percentsdelay
- : duration (in ms) of the transitionYAPI_Exception
- on errorpublic YMotor nextMotor()
public static YMotor FirstMotor()
public static YMotor FirstMotorInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2018. All rights reserved.