Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
YStepperMotor Class Reference

#include <yocto_steppermotor.h>

Inheritance diagram for YStepperMotor:
Inheritance graph
[legend]

Public Member Functions

virtual int _invokeValueCallback (string value)
 
virtual int abortAndBrake (void)
 
virtual int abortAndHiZ (void)
 
string alertMode (void)
 
virtual int alertStepDir (int dir)
 
virtual int alertStepOut (void)
 
string auxMode (void)
 
int auxSignal (void)
 
virtual int changeSpeed (double speed)
 
string command (void)
 
int diags (void)
 
virtual int emergencyStop (void)
 
virtual int findHomePosition (double speed)
 
string get_alertMode (void)
 
string get_auxMode (void)
 
int get_auxSignal (void)
 
string get_command (void)
 
int get_diags (void)
 
double get_maxAccel (void)
 
double get_maxSpeed (void)
 
Y_MOTORSTATE_enum get_motorState (void)
 
int get_overcurrent (void)
 
double get_pullinSpeed (void)
 
double get_speed (void)
 
Y_STEPPING_enum get_stepping (void)
 
double get_stepPos (void)
 
int get_tCurrRun (void)
 
int get_tCurrStop (void)
 
double maxAccel (void)
 
double maxSpeed (void)
 
Y_MOTORSTATE_enum motorState (void)
 
virtual int moveRel (double relPos)
 
virtual int moveRelSlow (double relPos, double maxSpeed)
 
virtual int moveTo (double absPos)
 
YStepperMotornext (void)
 
YStepperMotornextStepperMotor (void)
 
int overcurrent (void)
 
virtual int pause (int waitMs)
 
double pullinSpeed (void)
 
virtual int registerValueCallback (YStepperMotorValueCallback callback)
 
virtual int reset (void)
 
virtual int sendCommand (string command)
 
int set_alertMode (const string &newval)
 
int set_auxMode (const string &newval)
 
int set_auxSignal (int newval)
 
int set_command (const string &newval)
 
int set_maxAccel (double newval)
 
int set_maxSpeed (double newval)
 
int set_overcurrent (int newval)
 
int set_pullinSpeed (double newval)
 
int set_stepping (Y_STEPPING_enum newval)
 
int set_stepPos (double newval)
 
int set_tCurrRun (int newval)
 
int set_tCurrStop (int newval)
 
int setAlertMode (const string &newval)
 
int setAuxMode (const string &newval)
 
int setAuxSignal (int newval)
 
int setCommand (const string &newval)
 
int setMaxAccel (double newval)
 
int setMaxSpeed (double newval)
 
int setOvercurrent (int newval)
 
int setPullinSpeed (double newval)
 
int setStepping (Y_STEPPING_enum newval)
 
int setStepPos (double newval)
 
int setTCurrRun (int newval)
 
int setTCurrStop (int newval)
 
double speed (void)
 
Y_STEPPING_enum stepping (void)
 
double stepPos (void)
 
int tCurrRun (void)
 
int tCurrStop (void)
 
 ~YStepperMotor ()
 
- Public Member Functions inherited from YFunction
void _clearDataStreamCache ()
 
string _decode_json_string (const string &json)
 
string _download (const string &url)
 
YDataStream_findDataStream (YDataSet &dataset, const string &def)
 
string _get_json_path (const string &json, const string &path)
 
vector< string > _json_get_array (const string &json)
 
string _json_get_key (const string &json, const string &data)
 
string _json_get_string (const string &json)
 
int _parseEx (yJsonStateMachine &j)
 
virtual int _parserHelper (void)
 
string _parseString (yJsonStateMachine &j)
 
string _request (const string &request)
 
string _requestEx (int tcpchan, const string &request, yapiRequestProgressCallback callback, void *context)
 
void _throw (YRETCODE errType, string errMsg)
 
YRETCODE _upload (const string &path, const string &content)
 
YRETCODE _uploadWithProgress (const string &path, const string &content, yapiRequestProgressCallback callback, void *context)
 
string advertisedValue (void)
 
void clearCache ()
 
string describe (void)
 
string errMessage (void)
 
string errorMessage (void)
 
YRETCODE errorType (void)
 
YRETCODE errType (void)
 
YFUN_DESCR functionDescriptor (void)
 
string get_advertisedValue (void)
 
string get_errorMessage (void)
 
YRETCODE get_errorType (void)
 
virtual string get_friendlyName (void)
 
YFUN_DESCR get_functionDescriptor (void)
 
string get_functionId (void)
 
string get_hardwareId (void)
 
string get_hubSerial ()
 
string get_logicalName (void)
 
YModuleget_module (void)
 
void * get_userData (void)
 
bool isOnline (void)
 
YRETCODE load (int msValidity)
 
virtual string loadAttribute (string attrName)
 
string logicalName (void)
 
YModulemodule (void)
 
virtual int muteValueCallbacks (void)
 
YFunctionnext (void)
 
YFunctionnextFunction (void)
 
virtual int registerValueCallback (YFunctionValueCallback callback)
 
int set_advertisedValue (const string &newval)
 
int set_logicalName (const string &newval)
 
void set_userData (void *data)
 
int setAdvertisedValue (const string &newval)
 
int setLogicalName (const string &newval)
 
void setUserData (void *data)
 
virtual int unmuteValueCallbacks (void)
 
void * userData (void)
 
virtual ~YFunction ()
 

Static Public Member Functions

static YStepperMotorFind (string func)
 
static YStepperMotorFindStepperMotor (string func)
 
static YStepperMotorFirst (void)
 
static YStepperMotorFirstStepperMotor (void)
 
- Static Public Member Functions inherited from YFunction
static void _ClearCache (void)
 
static YFunctionFind (string func)
 
static YFunctionFindFunction (string func)
 
static YFunctionFirst (void)
 
static YFunctionFirstFunction (void)
 

Static Public Attributes

static const string ALERTMODE_INVALID = YAPI_INVALID_STRING
 
static const string AUXMODE_INVALID = YAPI_INVALID_STRING
 
static const int AUXSIGNAL_INVALID = YAPI_INVALID_INT
 
static const string COMMAND_INVALID = YAPI_INVALID_STRING
 
static const int DIAGS_INVALID = YAPI_INVALID_UINT
 
static const double MAXACCEL_INVALID = YAPI_INVALID_DOUBLE
 
static const double MAXSPEED_INVALID = YAPI_INVALID_DOUBLE
 
static const Y_MOTORSTATE_enum MOTORSTATE_ABSENT = Y_MOTORSTATE_ABSENT
 
static const Y_MOTORSTATE_enum MOTORSTATE_ALERT = Y_MOTORSTATE_ALERT
 
static const Y_MOTORSTATE_enum MOTORSTATE_BATCH = Y_MOTORSTATE_BATCH
 
static const Y_MOTORSTATE_enum MOTORSTATE_HI_Z = Y_MOTORSTATE_HI_Z
 
static const Y_MOTORSTATE_enum MOTORSTATE_INVALID = Y_MOTORSTATE_INVALID
 
static const Y_MOTORSTATE_enum MOTORSTATE_RUN = Y_MOTORSTATE_RUN
 
static const Y_MOTORSTATE_enum MOTORSTATE_STOP = Y_MOTORSTATE_STOP
 
static const int OVERCURRENT_INVALID = YAPI_INVALID_UINT
 
static const double PULLINSPEED_INVALID = YAPI_INVALID_DOUBLE
 
static const double SPEED_INVALID = YAPI_INVALID_DOUBLE
 
static const Y_STEPPING_enum STEPPING_FULLSTEP = Y_STEPPING_FULLSTEP
 
static const Y_STEPPING_enum STEPPING_HALFSTEP = Y_STEPPING_HALFSTEP
 
static const Y_STEPPING_enum STEPPING_INVALID = Y_STEPPING_INVALID
 
static const Y_STEPPING_enum STEPPING_MICROSTEP16 = Y_STEPPING_MICROSTEP16
 
static const Y_STEPPING_enum STEPPING_MICROSTEP4 = Y_STEPPING_MICROSTEP4
 
static const Y_STEPPING_enum STEPPING_MICROSTEP8 = Y_STEPPING_MICROSTEP8
 
static const double STEPPOS_INVALID = YAPI_INVALID_DOUBLE
 
static const int TCURRRUN_INVALID = YAPI_INVALID_UINT
 
static const int TCURRSTOP_INVALID = YAPI_INVALID_UINT
 
- Static Public Attributes inherited from YFunction
static const string ADVERTISEDVALUE_INVALID = YAPI_INVALID_STRING
 
static const string FRIENDLYNAME_INVALID = YAPI_INVALID_STRING
 
static const YFUN_DESCR FUNCTIONDESCRIPTOR_INVALID = Y_FUNCTIONDESCRIPTOR_INVALID
 
static const string FUNCTIONID_INVALID = YAPI_INVALID_STRING
 
static const string HARDWAREID_INVALID = YAPI_INVALID_STRING
 
static const string LOGICALNAME_INVALID = YAPI_INVALID_STRING
 

Protected Member Functions

virtual int _parseAttr (YJSONObject *json_val)
 
 YStepperMotor (const string &func)
 
- Protected Member Functions inherited from YFunction
YRETCODE _buildSetRequest (const string &changeattr, const string *changeval, string &request, string &errmsg)
 
string _escapeAttr (const string &changeval)
 
YRETCODE _getDescriptor (YFUN_DESCR &fundescr, string &errMsg)
 
YRETCODE _getDevice (YDevice *&dev, string &errMsg)
 
YRETCODE _load_unsafe (int msValidity)
 
YRETCODE _nextFunction (string &hwId)
 
int _parse (YJSONObject *j)
 
YRETCODE _setAttr (string attrname, string newvalue)
 
 YFunction (const string &func)
 

Protected Attributes

string _alertMode
 
string _auxMode
 
int _auxSignal
 
string _command
 
int _diags
 
double _maxAccel
 
double _maxSpeed
 
Y_MOTORSTATE_enum _motorState
 
int _overcurrent
 
double _pullinSpeed
 
double _speed
 
Y_STEPPING_enum _stepping
 
double _stepPos
 
int _tCurrRun
 
int _tCurrStop
 
YStepperMotorValueCallback _valueCallbackStepperMotor
 
- Protected Attributes inherited from YFunction
string _advertisedValue
 
u64 _cacheExpiration
 
string _className
 
std::map< string, YDataStream * > _dataStreams
 
string _func
 
YFUN_DESCR _fundescr
 
string _funId
 
string _hwId
 
string _lastErrorMsg
 
YRETCODE _lastErrorType
 
string _logicalName
 
string _serial
 
yCRITICAL_SECTION _this_cs
 
void * _userData
 
YFunctionValueCallback _valueCallbackFunction
 

Friends

YStepperMotoryFindStepperMotor (const string &func)
 
YStepperMotoryFirstStepperMotor (void)
 

Additional Inherited Members

- Static Protected Member Functions inherited from YFunction
static void _AddToCache (const string &classname, const string &func, YFunction *obj)
 
static YFunction_FindFromCache (const string &classname, const string &func)
 
static void _UpdateTimedReportCallbackList (YFunction *func, bool add)
 
static void _UpdateValueCallbackList (YFunction *func, bool add)
 
- Static Protected Attributes inherited from YFunction
static std::map< string, YFunction * > _cache
 

Detailed Description

YStepperMotor Class: StepperMotor function interface

The Yoctopuce application programming interface allows you to drive a stepper motor.

Definition at line 99 of file yocto_steppermotor.h.

Constructor & Destructor Documentation

YStepperMotor::YStepperMotor ( const string &  func)
protected

Definition at line 51 of file yocto_steppermotor.cpp.

YStepperMotor::~YStepperMotor ( )

Definition at line 74 of file yocto_steppermotor.cpp.

Member Function Documentation

int YStepperMotor::_invokeValueCallback ( string  value)
virtual

Reimplemented from YFunction.

Definition at line 922 of file yocto_steppermotor.cpp.

int YStepperMotor::_parseAttr ( YJSONObject json_val)
protectedvirtual

Reimplemented from YFunction.

Definition at line 90 of file yocto_steppermotor.cpp.

int YStepperMotor::abortAndBrake ( void  )
virtual

Stops the motor smoothly as soon as possible, without waiting for ongoing move completion.

Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1108 of file yocto_steppermotor.cpp.

int YStepperMotor::abortAndHiZ ( void  )
virtual

Turn the controller into Hi-Z mode immediately, without waiting for ongoing move completion.

Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1119 of file yocto_steppermotor.cpp.

string YStepperMotor::alertMode ( void  )
inline

Definition at line 418 of file yocto_steppermotor.h.

int YStepperMotor::alertStepDir ( int  dir)
virtual

Move one single step in the selected direction without regards to end switches. The move occures even if the system is still in alert mode (end switch depressed). Caution. use this function with great care as it may cause mechanical damages !

Parameters
dir: Value +1 ou -1, according to the desired direction of the move
Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1090 of file yocto_steppermotor.cpp.

int YStepperMotor::alertStepOut ( void  )
virtual

Move one step in the direction opposite the direction set when the most recent alert was raised. The move occures even if the system is still in alert mode (end switch depressed). Caution. use this function with great care as it may cause mechanical damages !

Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1075 of file yocto_steppermotor.cpp.

string YStepperMotor::auxMode ( void  )
inline

Definition at line 427 of file yocto_steppermotor.h.

int YStepperMotor::auxSignal ( void  )
inline

Definition at line 443 of file yocto_steppermotor.h.

int YStepperMotor::changeSpeed ( double  speed)
virtual

Starts the motor at a given speed. The time needed to reach the requested speed will depend on the acceleration parameters configured for the motor.

Parameters
speed: desired speed, in steps per second. The minimal non-zero speed is 0.001 pulse per second.
Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 992 of file yocto_steppermotor.cpp.

string YStepperMotor::command ( void  )
inline

Definition at line 462 of file yocto_steppermotor.h.

int YStepperMotor::diags ( void  )
inline

Definition at line 187 of file yocto_steppermotor.h.

int YStepperMotor::emergencyStop ( void  )
virtual

Stops the motor with an emergency alert, without taking any additional precaution.

Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1062 of file yocto_steppermotor.cpp.

static YStepperMotor* YStepperMotor::Find ( string  func)
inlinestatic

Definition at line 640 of file yocto_steppermotor.h.

int YStepperMotor::findHomePosition ( double  speed)
virtual

Starts the motor backward at the specified speed, to search for the motor home position.

Parameters
speed: desired speed, in steps per second.
Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 977 of file yocto_steppermotor.cpp.

YStepperMotor * YStepperMotor::FindStepperMotor ( string  func)
static

Retrieves a stepper motor for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the stepper motor is online at the time it is invoked. The returned object is nevertheless valid. Use the method YStepperMotor.isOnline() to test if the stepper motor is indeed online at a given time. In case of ambiguity when looking for a stepper motor by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.

If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.

Parameters
func: a string that uniquely characterizes the stepper motor
Returns
a YStepperMotor object allowing you to drive the stepper motor.

Definition at line 871 of file yocto_steppermotor.cpp.

static YStepperMotor* YStepperMotor::First ( void  )
inlinestatic

Definition at line 664 of file yocto_steppermotor.h.

YStepperMotor * YStepperMotor::FirstStepperMotor ( void  )
static

Starts the enumeration of stepper motors currently accessible. Use the method YStepperMotor.nextStepperMotor() to iterate on next stepper motors.

Returns
a pointer to a YStepperMotor object, corresponding to the first stepper motor currently online, or a NULL pointer if there are none.

Definition at line 1134 of file yocto_steppermotor.cpp.

string YStepperMotor::get_alertMode ( void  )

Definition at line 675 of file yocto_steppermotor.cpp.

string YStepperMotor::get_auxMode ( void  )

Definition at line 713 of file yocto_steppermotor.cpp.

int YStepperMotor::get_auxSignal ( void  )

Returns the current value of the signal generated on the auxiliary output.

Returns
an integer corresponding to the current value of the signal generated on the auxiliary output

On failure, throws an exception or returns Y_AUXSIGNAL_INVALID.

Definition at line 758 of file yocto_steppermotor.cpp.

string YStepperMotor::get_command ( void  )

Definition at line 806 of file yocto_steppermotor.cpp.

int YStepperMotor::get_diags ( void  )

Returns the stepper motor controller diagnostics, as a bitmap.

Returns
an integer corresponding to the stepper motor controller diagnostics, as a bitmap

On failure, throws an exception or returns Y_DIAGS_INVALID.

Definition at line 178 of file yocto_steppermotor.cpp.

double YStepperMotor::get_maxAccel ( void  )

Returns the maximal motor acceleration, measured in steps per second^2.

Returns
a floating point number corresponding to the maximal motor acceleration, measured in steps per second^2

On failure, throws an exception or returns Y_MAXACCEL_INVALID.

Definition at line 379 of file yocto_steppermotor.cpp.

double YStepperMotor::get_maxSpeed ( void  )

Returns the maximal motor speed, measured in steps per second.

Returns
a floating point number corresponding to the maximal motor speed, measured in steps per second

On failure, throws an exception or returns Y_MAXSPEED_INVALID.

Definition at line 433 of file yocto_steppermotor.cpp.

Y_MOTORSTATE_enum YStepperMotor::get_motorState ( void  )

Returns the motor working state.

Returns
a value among Y_MOTORSTATE_ABSENT, Y_MOTORSTATE_ALERT, Y_MOTORSTATE_HI_Z, Y_MOTORSTATE_STOP, Y_MOTORSTATE_RUN and Y_MOTORSTATE_BATCH corresponding to the motor working state

On failure, throws an exception or returns Y_MOTORSTATE_INVALID.

Definition at line 149 of file yocto_steppermotor.cpp.

int YStepperMotor::get_overcurrent ( void  )

Returns the overcurrent alert and emergency stop threshold, measured in mA.

Returns
an integer corresponding to the overcurrent alert and emergency stop threshold, measured in mA

On failure, throws an exception or returns Y_OVERCURRENT_INVALID.

Definition at line 518 of file yocto_steppermotor.cpp.

double YStepperMotor::get_pullinSpeed ( void  )

Returns the motor speed immediately reachable from stop state, measured in steps per second.

Returns
a floating point number corresponding to the motor speed immediately reachable from stop state, measured in steps per second

On failure, throws an exception or returns Y_PULLINSPEED_INVALID.

Definition at line 324 of file yocto_steppermotor.cpp.

double YStepperMotor::get_speed ( void  )

Returns current motor speed, measured in steps per second. To change speed, use method changeSpeed().

Returns
a floating point number corresponding to current motor speed, measured in steps per second

On failure, throws an exception or returns Y_SPEED_INVALID.

Definition at line 268 of file yocto_steppermotor.cpp.

Y_STEPPING_enum YStepperMotor::get_stepping ( void  )

Returns the stepping mode used to drive the motor.

Returns
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 motor

On failure, throws an exception or returns Y_STEPPING_INVALID.

Definition at line 463 of file yocto_steppermotor.cpp.

double YStepperMotor::get_stepPos ( void  )

Returns the current logical motor position, measured in steps. The value may include a fractional part when micro-stepping is in use.

Returns
a floating point number corresponding to the current logical motor position, measured in steps

On failure, throws an exception or returns Y_STEPPOS_INVALID.

Definition at line 238 of file yocto_steppermotor.cpp.

int YStepperMotor::get_tCurrRun ( void  )

Returns the torque regulation current when the motor is running, measured in mA.

Returns
an integer corresponding to the torque regulation current when the motor is running, measured in mA

On failure, throws an exception or returns Y_TCURRRUN_INVALID.

Definition at line 627 of file yocto_steppermotor.cpp.

int YStepperMotor::get_tCurrStop ( void  )

Returns the torque regulation current when the motor is stopped, measured in mA.

Returns
an integer corresponding to the torque regulation current when the motor is stopped, measured in mA

On failure, throws an exception or returns Y_TCURRSTOP_INVALID.

Definition at line 572 of file yocto_steppermotor.cpp.

double YStepperMotor::maxAccel ( void  )
inline

Definition at line 284 of file yocto_steppermotor.h.

double YStepperMotor::maxSpeed ( void  )
inline

Definition at line 309 of file yocto_steppermotor.h.

Y_MOTORSTATE_enum YStepperMotor::motorState ( void  )
inline

Definition at line 175 of file yocto_steppermotor.h.

int YStepperMotor::moveRel ( double  relPos)
virtual

Starts the motor to reach a given relative position. The time needed to reach the requested position will depend on the acceleration and max speed parameters configured for the motor.

Parameters
relPos: relative position, measured in steps from the current position.
Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1022 of file yocto_steppermotor.cpp.

int YStepperMotor::moveRelSlow ( double  relPos,
double  maxSpeed 
)
virtual

Starts the motor to reach a given relative position, keeping the speed under the specified limit. The time needed to reach the requested position will depend on the acceleration parameters configured for the motor.

Parameters
relPos: relative position, measured in steps from the current position.
maxSpeed: limit speed, in steps per second.
Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1038 of file yocto_steppermotor.cpp.

int YStepperMotor::moveTo ( double  absPos)
virtual

Starts the motor to reach a given absolute position. The time needed to reach the requested position will depend on the acceleration and max speed parameters configured for the motor.

Parameters
absPos: absolute position, measured in steps from the origin.
Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1007 of file yocto_steppermotor.cpp.

YStepperMotor* YStepperMotor::next ( void  )
inline

Definition at line 651 of file yocto_steppermotor.h.

YStepperMotor * YStepperMotor::nextStepperMotor ( void  )

Continues the enumeration of stepper motors started using yFirstStepperMotor().

Returns
a pointer to a YStepperMotor object, corresponding to a stepper motor currently online, or a NULL pointer if there are no more stepper motors to enumerate.

Definition at line 1124 of file yocto_steppermotor.cpp.

int YStepperMotor::overcurrent ( void  )
inline

Definition at line 348 of file yocto_steppermotor.h.

int YStepperMotor::pause ( int  waitMs)
virtual

Keep the motor in the same state for the specified amount of time, before processing next command.

Parameters
waitMs: wait time, specified in milliseconds.
Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 1051 of file yocto_steppermotor.cpp.

double YStepperMotor::pullinSpeed ( void  )
inline

Definition at line 258 of file yocto_steppermotor.h.

int YStepperMotor::registerValueCallback ( YStepperMotorValueCallback  callback)
virtual

Registers the callback function that is invoked on every change of advertised value. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.

Parameters
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.

Definition at line 903 of file yocto_steppermotor.cpp.

int YStepperMotor::reset ( void  )
virtual

Reinitialize the controller and clear all alert flags.

Returns
YAPI_SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.

Definition at line 964 of file yocto_steppermotor.cpp.

int YStepperMotor::sendCommand ( string  command)
virtual

Definition at line 932 of file yocto_steppermotor.cpp.

int YStepperMotor::set_alertMode ( const string &  newval)

Definition at line 697 of file yocto_steppermotor.cpp.

int YStepperMotor::set_auxMode ( const string &  newval)

Definition at line 735 of file yocto_steppermotor.cpp.

int YStepperMotor::set_auxSignal ( int  newval)

Changes the value of the signal generated on the auxiliary output. Acceptable values depend on the auxiliary output signal type configured.

Parameters
newval: an integer corresponding to the value of the signal generated on the auxiliary output
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 790 of file yocto_steppermotor.cpp.

int YStepperMotor::set_command ( const string &  newval)

Definition at line 828 of file yocto_steppermotor.cpp.

int YStepperMotor::set_maxAccel ( double  newval)

Changes the maximal motor acceleration, measured in steps per second^2.

Parameters
newval: a floating point number corresponding to the maximal motor acceleration, measured in steps per second^2
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 356 of file yocto_steppermotor.cpp.

int YStepperMotor::set_maxSpeed ( double  newval)

Changes the maximal motor speed, measured in steps per second.

Parameters
newval: a floating point number corresponding to the maximal motor speed, measured in steps per second
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 410 of file yocto_steppermotor.cpp.

int YStepperMotor::set_overcurrent ( int  newval)

Changes the overcurrent alert and emergency stop threshold, measured in mA.

Parameters
newval: an integer corresponding to the overcurrent alert and emergency stop threshold, measured in mA
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 549 of file yocto_steppermotor.cpp.

int YStepperMotor::set_pullinSpeed ( double  newval)

Changes the motor speed immediately reachable from stop state, measured in steps per second.

Parameters
newval: a floating point number corresponding to the motor speed immediately reachable from stop state, measured in steps per second
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 300 of file yocto_steppermotor.cpp.

int YStepperMotor::set_stepping ( Y_STEPPING_enum  newval)

Changes the stepping mode used to drive the motor.

Parameters
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 motor
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 495 of file yocto_steppermotor.cpp.

int YStepperMotor::set_stepPos ( double  newval)

Changes the current logical motor position, measured in steps. This command does not cause any motor move, as its purpose is only to setup the origin of the position counter. The fractional part of the position, that corresponds to the physical position of the rotor, is not changed. To trigger a motor move, use methods moveTo() or moveRel() instead.

Parameters
newval: a floating point number corresponding to the current logical motor position, measured in steps
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 214 of file yocto_steppermotor.cpp.

int YStepperMotor::set_tCurrRun ( int  newval)

Changes the torque regulation current when the motor is running, measured in mA.

Parameters
newval: an integer corresponding to the torque regulation current when the motor is running, measured in mA
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 659 of file yocto_steppermotor.cpp.

int YStepperMotor::set_tCurrStop ( int  newval)

Changes the torque regulation current when the motor is stopped, measured in mA.

Parameters
newval: an integer corresponding to the torque regulation current when the motor is stopped, measured in mA
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 604 of file yocto_steppermotor.cpp.

int YStepperMotor::setAlertMode ( const string &  newval)
inline

Definition at line 422 of file yocto_steppermotor.h.

int YStepperMotor::setAuxMode ( const string &  newval)
inline

Definition at line 431 of file yocto_steppermotor.h.

int YStepperMotor::setAuxSignal ( int  newval)
inline

Definition at line 457 of file yocto_steppermotor.h.

int YStepperMotor::setCommand ( const string &  newval)
inline

Definition at line 466 of file yocto_steppermotor.h.

int YStepperMotor::setMaxAccel ( double  newval)
inline

Definition at line 272 of file yocto_steppermotor.h.

int YStepperMotor::setMaxSpeed ( double  newval)
inline

Definition at line 297 of file yocto_steppermotor.h.

int YStepperMotor::setOvercurrent ( int  newval)
inline

Definition at line 361 of file yocto_steppermotor.h.

int YStepperMotor::setPullinSpeed ( double  newval)
inline

Definition at line 245 of file yocto_steppermotor.h.

int YStepperMotor::setStepping ( Y_STEPPING_enum  newval)
inline

Definition at line 336 of file yocto_steppermotor.h.

int YStepperMotor::setStepPos ( double  newval)
inline

Definition at line 205 of file yocto_steppermotor.h.

int YStepperMotor::setTCurrRun ( int  newval)
inline

Definition at line 413 of file yocto_steppermotor.h.

int YStepperMotor::setTCurrStop ( int  newval)
inline

Definition at line 387 of file yocto_steppermotor.h.

double YStepperMotor::speed ( void  )
inline

Definition at line 231 of file yocto_steppermotor.h.

Y_STEPPING_enum YStepperMotor::stepping ( void  )
inline

Definition at line 322 of file yocto_steppermotor.h.

double YStepperMotor::stepPos ( void  )
inline

Definition at line 218 of file yocto_steppermotor.h.

int YStepperMotor::tCurrRun ( void  )
inline

Definition at line 399 of file yocto_steppermotor.h.

int YStepperMotor::tCurrStop ( void  )
inline

Definition at line 373 of file yocto_steppermotor.h.

Friends And Related Function Documentation

YStepperMotor* yFindStepperMotor ( const string &  func)
friend

Retrieves a stepper motor for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the stepper motor is online at the time it is invoked. The returned object is nevertheless valid. Use the method YStepperMotor.isOnline() to test if the stepper motor is indeed online at a given time. In case of ambiguity when looking for a stepper motor by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.

If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.

Parameters
func: a string that uniquely characterizes the stepper motor
Returns
a YStepperMotor object allowing you to drive the stepper motor.

Definition at line 701 of file yocto_steppermotor.h.

YStepperMotor* yFirstStepperMotor ( void  )
friend

Starts the enumeration of stepper motors currently accessible. Use the method YStepperMotor.nextStepperMotor() to iterate on next stepper motors.

Returns
a pointer to a YStepperMotor object, corresponding to the first stepper motor currently online, or a NULL pointer if there are none.

Definition at line 712 of file yocto_steppermotor.h.

Member Data Documentation

string YStepperMotor::_alertMode
protected

Definition at line 118 of file yocto_steppermotor.h.

string YStepperMotor::_auxMode
protected

Definition at line 119 of file yocto_steppermotor.h.

int YStepperMotor::_auxSignal
protected

Definition at line 120 of file yocto_steppermotor.h.

string YStepperMotor::_command
protected

Definition at line 121 of file yocto_steppermotor.h.

int YStepperMotor::_diags
protected

Definition at line 108 of file yocto_steppermotor.h.

double YStepperMotor::_maxAccel
protected

Definition at line 112 of file yocto_steppermotor.h.

double YStepperMotor::_maxSpeed
protected

Definition at line 113 of file yocto_steppermotor.h.

Y_MOTORSTATE_enum YStepperMotor::_motorState
protected

Definition at line 107 of file yocto_steppermotor.h.

int YStepperMotor::_overcurrent
protected

Definition at line 115 of file yocto_steppermotor.h.

double YStepperMotor::_pullinSpeed
protected

Definition at line 111 of file yocto_steppermotor.h.

double YStepperMotor::_speed
protected

Definition at line 110 of file yocto_steppermotor.h.

Y_STEPPING_enum YStepperMotor::_stepping
protected

Definition at line 114 of file yocto_steppermotor.h.

double YStepperMotor::_stepPos
protected

Definition at line 109 of file yocto_steppermotor.h.

int YStepperMotor::_tCurrRun
protected

Definition at line 117 of file yocto_steppermotor.h.

int YStepperMotor::_tCurrStop
protected

Definition at line 116 of file yocto_steppermotor.h.

YStepperMotorValueCallback YStepperMotor::_valueCallbackStepperMotor
protected

Definition at line 122 of file yocto_steppermotor.h.

const string YStepperMotor::ALERTMODE_INVALID = YAPI_INVALID_STRING
static

Definition at line 160 of file yocto_steppermotor.h.

const string YStepperMotor::AUXMODE_INVALID = YAPI_INVALID_STRING
static

Definition at line 161 of file yocto_steppermotor.h.

const int YStepperMotor::AUXSIGNAL_INVALID = YAPI_INVALID_INT
static

Definition at line 162 of file yocto_steppermotor.h.

const string YStepperMotor::COMMAND_INVALID = YAPI_INVALID_STRING
static

Definition at line 163 of file yocto_steppermotor.h.

const int YStepperMotor::DIAGS_INVALID = YAPI_INVALID_UINT
static

Definition at line 145 of file yocto_steppermotor.h.

const double YStepperMotor::MAXACCEL_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 149 of file yocto_steppermotor.h.

const double YStepperMotor::MAXSPEED_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 150 of file yocto_steppermotor.h.

const Y_MOTORSTATE_enum YStepperMotor::MOTORSTATE_ABSENT = Y_MOTORSTATE_ABSENT
static

Definition at line 138 of file yocto_steppermotor.h.

const Y_MOTORSTATE_enum YStepperMotor::MOTORSTATE_ALERT = Y_MOTORSTATE_ALERT
static

Definition at line 139 of file yocto_steppermotor.h.

const Y_MOTORSTATE_enum YStepperMotor::MOTORSTATE_BATCH = Y_MOTORSTATE_BATCH
static

Definition at line 143 of file yocto_steppermotor.h.

const Y_MOTORSTATE_enum YStepperMotor::MOTORSTATE_HI_Z = Y_MOTORSTATE_HI_Z
static

Definition at line 140 of file yocto_steppermotor.h.

const Y_MOTORSTATE_enum YStepperMotor::MOTORSTATE_INVALID = Y_MOTORSTATE_INVALID
static

Definition at line 144 of file yocto_steppermotor.h.

const Y_MOTORSTATE_enum YStepperMotor::MOTORSTATE_RUN = Y_MOTORSTATE_RUN
static

Definition at line 142 of file yocto_steppermotor.h.

const Y_MOTORSTATE_enum YStepperMotor::MOTORSTATE_STOP = Y_MOTORSTATE_STOP
static

Definition at line 141 of file yocto_steppermotor.h.

const int YStepperMotor::OVERCURRENT_INVALID = YAPI_INVALID_UINT
static

Definition at line 157 of file yocto_steppermotor.h.

const double YStepperMotor::PULLINSPEED_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 148 of file yocto_steppermotor.h.

const double YStepperMotor::SPEED_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 147 of file yocto_steppermotor.h.

const Y_STEPPING_enum YStepperMotor::STEPPING_FULLSTEP = Y_STEPPING_FULLSTEP
static

Definition at line 155 of file yocto_steppermotor.h.

const Y_STEPPING_enum YStepperMotor::STEPPING_HALFSTEP = Y_STEPPING_HALFSTEP
static

Definition at line 154 of file yocto_steppermotor.h.

const Y_STEPPING_enum YStepperMotor::STEPPING_INVALID = Y_STEPPING_INVALID
static

Definition at line 156 of file yocto_steppermotor.h.

const Y_STEPPING_enum YStepperMotor::STEPPING_MICROSTEP16 = Y_STEPPING_MICROSTEP16
static

Definition at line 151 of file yocto_steppermotor.h.

const Y_STEPPING_enum YStepperMotor::STEPPING_MICROSTEP4 = Y_STEPPING_MICROSTEP4
static

Definition at line 153 of file yocto_steppermotor.h.

const Y_STEPPING_enum YStepperMotor::STEPPING_MICROSTEP8 = Y_STEPPING_MICROSTEP8
static

Definition at line 152 of file yocto_steppermotor.h.

const double YStepperMotor::STEPPOS_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 146 of file yocto_steppermotor.h.

const int YStepperMotor::TCURRRUN_INVALID = YAPI_INVALID_UINT
static

Definition at line 159 of file yocto_steppermotor.h.

const int YStepperMotor::TCURRSTOP_INVALID = YAPI_INVALID_UINT
static

Definition at line 158 of file yocto_steppermotor.h.


The documentation for this class was generated from the following files:


yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:14