yocto_multiaxiscontroller.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_multiaxiscontroller.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindMultiAxisController(), the high-level API for MultiAxisController functions
6  *
7  * - - - - - - - - - License information: - - - - - - - - -
8  *
9  * Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
10  *
11  * Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
12  * non-exclusive license to use, modify, copy and integrate this
13  * file into your software for the sole purpose of interfacing
14  * with Yoctopuce products.
15  *
16  * You may reproduce and distribute copies of this file in
17  * source or object form, as long as the sole purpose of this
18  * code is to interface with Yoctopuce products. You must retain
19  * this notice in the distributed source file.
20  *
21  * You should refer to Yoctopuce General Terms and Conditions
22  * for additional information regarding your rights and
23  * obligations.
24  *
25  * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
26  * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
27  * WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
28  * FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
29  * EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
30  * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
31  * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
32  * SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
33  * LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
34  * CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
35  * BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
36  * WARRANTY, OR OTHERWISE.
37  *
38  *********************************************************************/
39 
40 
41 #ifndef YOCTO_MULTIAXISCONTROLLER_H
42 #define YOCTO_MULTIAXISCONTROLLER_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YMultiAxisController return codes)
50 //--- (end of YMultiAxisController return codes)
51 //--- (YMultiAxisController definitions)
52 class YMultiAxisController; // forward declaration
53 
54 typedef void (*YMultiAxisControllerValueCallback)(YMultiAxisController *func, const string& functionValue);
55 #ifndef _Y_GLOBALSTATE_ENUM
56 #define _Y_GLOBALSTATE_ENUM
57 typedef enum {
66 #endif
67 #define Y_NAXIS_INVALID (YAPI_INVALID_UINT)
68 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
69 //--- (end of YMultiAxisController definitions)
70 
71 //--- (YMultiAxisController declaration)
78 #ifdef __BORLANDC__
79 #pragma option push -w-8022
80 #endif
81 //--- (end of YMultiAxisController declaration)
82 protected:
83  //--- (YMultiAxisController attributes)
84  // Attributes (function value cache)
85  int _nAxis;
87  string _command;
89 
90  friend YMultiAxisController *yFindMultiAxisController(const string& func);
92 
93  // Function-specific method for parsing of JSON output and caching result
94  virtual int _parseAttr(YJSONObject* json_val);
95 
96  // Constructor is protected, use yFindMultiAxisController factory function to instantiate
97  YMultiAxisController(const string& func);
98  //--- (end of YMultiAxisController attributes)
99 
100 public:
102  //--- (YMultiAxisController accessors declaration)
103 
104  static const int NAXIS_INVALID = YAPI_INVALID_UINT;
105  static const Y_GLOBALSTATE_enum GLOBALSTATE_ABSENT = Y_GLOBALSTATE_ABSENT;
106  static const Y_GLOBALSTATE_enum GLOBALSTATE_ALERT = Y_GLOBALSTATE_ALERT;
107  static const Y_GLOBALSTATE_enum GLOBALSTATE_HI_Z = Y_GLOBALSTATE_HI_Z;
108  static const Y_GLOBALSTATE_enum GLOBALSTATE_STOP = Y_GLOBALSTATE_STOP;
109  static const Y_GLOBALSTATE_enum GLOBALSTATE_RUN = Y_GLOBALSTATE_RUN;
110  static const Y_GLOBALSTATE_enum GLOBALSTATE_BATCH = Y_GLOBALSTATE_BATCH;
111  static const Y_GLOBALSTATE_enum GLOBALSTATE_INVALID = Y_GLOBALSTATE_INVALID;
112  static const string COMMAND_INVALID;
113 
121  int get_nAxis(void);
122 
123  inline int nAxis(void)
124  { return this->get_nAxis(); }
125 
135  int set_nAxis(int newval);
136  inline int setNAxis(int newval)
137  { return this->set_nAxis(newval); }
138 
148  Y_GLOBALSTATE_enum get_globalState(void);
149 
151  { return this->get_globalState(); }
152 
153  string get_command(void);
154 
155  inline string command(void)
156  { return this->get_command(); }
157 
158  int set_command(const string& newval);
159  inline int setCommand(const string& newval)
160  { return this->set_command(newval); }
161 
189  static YMultiAxisController* FindMultiAxisController(string func);
190 
204 
205  virtual int _invokeValueCallback(string value);
206 
207  virtual int sendCommand(string command);
208 
215  virtual int reset(void);
216 
225  virtual int findHomePosition(vector<double> speed);
226 
238  virtual int moveTo(vector<double> absPos);
239 
251  virtual int moveRel(vector<double> relPos);
252 
261  virtual int pause(int waitMs);
262 
269  virtual int emergencyStop(void);
270 
277  virtual int abortAndBrake(void);
278 
285  virtual int abortAndHiZ(void);
286 
287 
288  inline static YMultiAxisController* Find(string func)
290 
298  YMultiAxisController *nextMultiAxisController(void);
300  { return this->nextMultiAxisController();}
301 
311  static YMultiAxisController* FirstMultiAxisController(void);
312  inline static YMultiAxisController* First(void)
314 #ifdef __BORLANDC__
315 #pragma option pop
316 #endif
317  //--- (end of YMultiAxisController accessors declaration)
318 };
319 
320 //--- (YMultiAxisController functions declaration)
321 
362 
363 //--- (end of YMultiAxisController functions declaration)
364 
365 #endif
static YMultiAxisController * FirstMultiAxisController(void)
YMultiAxisControllerValueCallback _valueCallbackMultiAxisController
YMultiAxisController * yFirstMultiAxisController(void)
static const string COMMAND_INVALID
Y_GLOBALSTATE_enum _globalState
static YMultiAxisController * Find(string func)
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
YMultiAxisController * next(void)
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
ROSLIB_DECL std::string command(const std::string &cmd)
YMultiAxisController * yFindMultiAxisController(const string &func)
int setCommand(const string &newval)
static YMultiAxisController * FindMultiAxisController(string func)
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
Y_GLOBALSTATE_enum globalState(void)
void(* YMultiAxisControllerValueCallback)(YMultiAxisController *func, const string &functionValue)
static YMultiAxisController * First(void)
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563


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