Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
GmiInterface.h
Go to the documentation of this file.
1#pragma once
4#include <gmi/iface/global.h>
5#include <misc/gen/TVector.h>
6#include <misc/gen/Value.h>
7
8namespace sf::gmi
9{
10
15
20{
21 public:
26
30 ParamState(const std::string& name, const Value& value);
31
35 bool operator==(const ParamState& ps) const;
36
40 std::string _name;
45
50};
51
56{
58 pfREADONLY = 1 << 0,
60 pfEFFECTPARAM = 1 << 1,
64 pfAXIS = 1 << 3,
66 pfMOVE = 1 << 4,
68 pfMOVEPOS = 1 << 5,
70 pfMOVEVEL = 1 << 6,
72 pfEXPORT = 1 << 7,
74 pfSYSTEM = 1 << 8,
76 pfWRITEABLE = 1 << 9,
78 pfALIAS = 1 << 10,
79 //
80 // Parameters like these must not be used to restore.
81 //
83 pfARCHIVE = 1 << 11,
85 pfMOVECON = 1 << 12,
86};
87
92{
94 rfINDEX = 1 << 0,
96 rfASYNC = 1 << 1,
98 rfASYNCINDEX = 1 << 2,
100 rfHUGE = 1 << 3,
101};
102
107{
111 ParamInfo() = default;
112
118 {
119 copyFrom(pi);
120 }
121
128
132 void init();
133
138
140 IdType Id{0};
144 unsigned Axis{0};
146 unsigned Index{0};
148 std::string Name;
150 std::string Unit;
152 std::string Description;
154 Value Round{Value::vitUndefined};
156 Value Default{Value::vitUndefined};
158 Value Minimum{Value::vitUndefined};
160 Value Maximum{Value::vitUndefined};
164 int Flags{0};
165};
166
171{
172 ResultInfo() = default;
173
175 {
176 copy(pi);
177 }
178
180 {
181 return copy(pi);
182 }
183
184 void init();
185
187
191 IdType Id{0};
195 int Flags{0};
200 unsigned Axis{0};
204 unsigned Index{0};
208 std::string Name;
212 std::string Description;
216 unsigned Bits{0};
220 unsigned WordSize{0};
224 unsigned ArraySize{0};
225};
226
231{
235 BufferInfo() = default;
236
240 void Clear();
241
249 void* Buffer{nullptr};
253 unsigned Size{0};
257 unsigned Remain{0};
261 unsigned Counter{0};
262};
263
264inline void BufferInfo::Clear()
265{
266 Id = 0;
267 Buffer = nullptr;
268 Size = 0;
269 Remain = 0;
270 Counter = 0;
271}
272
277typedef void (*NotifyProc)(void* data, IdType id);
278
284{
288 mpNONE = 0x0000,
292 mpVERSION = 0x0001,
296 mpAXISCOUNT = 0x0002,
300 mpMOVEPOS = 0x0003,
304 mpMOVEVEL = 0x0004,
308 mpJOYSTICK = 0x0005,
321
329 mpPOP_AXIS = 0x000A,
337 mpMOVECON = 0x000C,
341 mpCHUCKJAW = 0x000D,
347 mpERROR = 0x000E,
359 mpTIMEUNIT = 0x0011,
363 mpLAST = 0x0200,
367 mpAXIS_MASK = 0x8000,
371 mpAXIS_NAME = 0x8001,
379 mpAXIS_MODE = 0x8003,
388 //
389 // Axis minimum and maximum positions.
390 //
411 //
412 // Volatile data. It changes when moving.
413 //
422 //
423 // Targeting data before move.
424 //
437 //
438 // Effects all position fields.
439 //
451 mpAXIS_LAST = 0x8200,
452};
453
458{
462 mrLAST = 0x0200,
463 //
464 // Axis results from here.
465 //
470 // measurement trigger. Position is relative from
474 mrAXIS_LAST = 0x8200,
475};
476
503
526
549
554{
563
571 jscON = 2,
572};
573
601
605enum EAxisMinMax : unsigned int
606{
622 ammMAX_ACC = 3
624
629{
633 cjOFF = 0,
642};
647{
651 ceSTATUS = 0x0000,
655 ceHOOKED = 0x1001,
659 ceUNHOOKED = 0x1002,
663 ceCOMPLETE = 0x2001,
667 cePOPEVENT = 0x3001,
668};
669
673typedef void (*ControllerEvent)(Controller* ctrl, EControllerEvent event);
674
675}// namespace sf::gmi
Counted vector having additional methods and operators for ease of usage.
Definition TVector.h:25
Value container class able to performing arithmetic functions.
Definition Value.h:19
Pure virtual class for implementation of motion controllers.
Definition Controller.h:13
Structure to hold a single state.
Definition GmiInterface.h:20
TVector< ParamState > Vector
Vector holding param-state instances.
Definition GmiInterface.h:49
Value _value
Holds the value of the state.
Definition GmiInterface.h:44
ParamState(const std::string &name, const Value &value)
Copy constructor.
bool operator==(const ParamState &ps) const
Compare equal operator.
std::string _name
Holds the name of the state.
Definition GmiInterface.h:40
ParamState(const ParamState &ps)
Copy constructor.
#define _GMI_CLASS
Definition gmi/iface/global.h:35
Definition AxesCoord.h:7
void(* NotifyProc)(void *data, IdType id)
Function type for the function type which is called when a parameter changes as a result of changes i...
Definition GmiInterface.h:277
EChuckJaw
Definition GmiInterface.h:629
@ cjOFF
ChuckJaw is off.
Definition GmiInterface.h:633
@ cjOPEN
ChuckJaw is open.
Definition GmiInterface.h:637
@ cjCLOSE
ChuckJaw is closed.
Definition GmiInterface.h:641
unsigned long long IdType
Type for gathering parameter ID's.
Definition GmiTypes.h:19
EMovePosCmd
Enumerate for controller position movement command.
Definition GmiInterface.h:481
@ mpcSTOP
Stop current movement smooth.
Definition GmiInterface.h:493
@ mpcABORT
Abort current movement abrupt.
Definition GmiInterface.h:489
@ mpcCOMPLETE
Stop current movement smooth.
Definition GmiInterface.h:485
@ mpcCURVE
Move along the downloaded curve.
Definition GmiInterface.h:501
@ mpcPOSITION
Move in position mode using targeting position,.
Definition GmiInterface.h:497
EAxisMode
Enumerate for controller mode of operation.
Definition GmiInterface.h:578
@ amCONTINUE
Axis is moved with a specified velocity.
Definition GmiInterface.h:599
@ amHOME
Axis executes home sequence on position command.(is optional)
Definition GmiInterface.h:595
@ amPOSITION
Axis is moved only to specified position.
Definition GmiInterface.h:586
@ amVELOCITY
Axis is moved with a specified velocity.
Definition GmiInterface.h:591
@ amDISABLED
Axis is cannot be moved at all.
Definition GmiInterface.h:582
EAxisMinMax
Enumerate for retrieving axis extremes.
Definition GmiInterface.h:606
@ ammMIN_POS
Axis minimum position.
Definition GmiInterface.h:610
@ ammMAX_ACC
Axis maximum acceleration.
Definition GmiInterface.h:622
@ ammMAX_POS
Axis maximum position.
Definition GmiInterface.h:614
@ ammMAX_VEL
Axis maximum velocity.
Definition GmiInterface.h:618
EParamFlag
Parameter flags for defining parameter behaviour.
Definition GmiInterface.h:56
@ pfSYSTEM
Parameter is a system setting.
Definition GmiInterface.h:74
@ pfMOVECON
Parameter cannot be changed when moving in continuous mode.
Definition GmiInterface.h:85
@ pfEXPORT
Parameter is exported globally.
Definition GmiInterface.h:72
@ pfEFFECTRESULT
Parameter effects results.
Definition GmiInterface.h:62
@ pfREADONLY
Parameter cannot be changed at all times.
Definition GmiInterface.h:58
@ pfARCHIVE
Parameter can be stored for restoring settings.
Definition GmiInterface.h:83
@ pfAXIS
Parameter is axis specific.
Definition GmiInterface.h:64
@ pfMOVE
Parameter cannot be changed when moving in any mode.
Definition GmiInterface.h:66
@ pfMOVEPOS
Parameter cannot be changed when moving in position mode.
Definition GmiInterface.h:68
@ pfALIAS
Alias of another parameter in a different form.
Definition GmiInterface.h:78
@ pfMOVEVEL
Parameter cannot be changed when moving in velocity mode.
Definition GmiInterface.h:70
@ pfEFFECTPARAM
Parameter effects other parameters.
Definition GmiInterface.h:60
@ pfWRITEABLE
Parameter is always writeable in any mode.
Definition GmiInterface.h:76
EResultFlag
Result flags for defining result behaviour.
Definition GmiInterface.h:92
@ rfASYNCINDEX
Result keeps track of sync counter values at the time async data was generated.
Definition GmiInterface.h:98
@ rfINDEX
Result contains synced i/o input.
Definition GmiInterface.h:94
@ rfASYNC
Result data is not sync synchrone.
Definition GmiInterface.h:96
@ rfHUGE
Result that generates a huge amount of data.
Definition GmiInterface.h:100
EResult
Motion default results.
Definition GmiInterface.h:458
@ mrLAST
Free number from here.
Definition GmiInterface.h:462
@ mrAXIS_LAST
Free axis parameters numbers from here.
Definition GmiInterface.h:474
@ mrAXIS_INDEX_POS
Positions of the axis at each index or.
Definition GmiInterface.h:469
EMoveVelCmd
Enumerate for controller velocity movement command.
Definition GmiInterface.h:508
@ mvcSTOP
Stop with target deceleration value.
Definition GmiInterface.h:520
@ mvcCOMPLETE
No movement.
Definition GmiInterface.h:512
@ mvcON
Moving with target velocity.
Definition GmiInterface.h:524
@ mvcABORT
Abort current movement abrupt.
Definition GmiInterface.h:516
EMoveConCmd
Enumerate for controller continuous movement command.
Definition GmiInterface.h:531
@ mccCOMPLETE
No movement.
Definition GmiInterface.h:535
@ mccSTOP
Stop with target deceleration value.
Definition GmiInterface.h:543
@ mccABORT
Abort current movement abrupt.
Definition GmiInterface.h:539
@ mccON
Moving with target velocity.
Definition GmiInterface.h:547
EJoystickCmd
Enumerate for controller Joy movement command.
Definition GmiInterface.h:554
@ jscSTOP
Stops movement, and waits for off.
Definition GmiInterface.h:567
@ jscINHIBIT
Inhibits the joystick control.
Definition GmiInterface.h:558
@ jscOFF
Status report of movement stop.
Definition GmiInterface.h:562
@ jscON
Joystick active.
Definition GmiInterface.h:571
EParam
Motion default parameters. List of ids which must always be implemented for each motion implementatio...
Definition GmiInterface.h:284
@ mpTRIGGER_AXIS
Sets the axis which pulses are used to derive the trigger pulses. Values are as EAxisLoc.
Definition GmiInterface.h:312
@ mpJOYSTICK_AXIS
Joystick axis selection. Values are as EAxisLoc.
Definition GmiInterface.h:325
@ mpAXISCOUNT
Amount of implemented axes. The states carry the axes names.
Definition GmiInterface.h:296
@ mpAXIS_MODE
Mode of the axis (Disabled, Position, Velocity, Home, Contineous)
Definition GmiInterface.h:379
@ mpCHUCKJAW
Controls chuck-jaw Off=0, Open=1 and Close=2.
Definition GmiInterface.h:341
@ mpMOVECON
Starts a movement using the target velocity for axis in the continuous mode group.
Definition GmiInterface.h:337
@ mpMOVEVEL
Starts a movement using the target velocity for axis in the velocity mode group.
Definition GmiInterface.h:304
@ mpAXIS_MIN_POS
Minimum position of the axis.
Definition GmiInterface.h:394
@ mpTRIGGER_DENSITY
Density of measurements in radians or meters depending on selected axis.
Definition GmiInterface.h:316
@ mpAXIS_MOVEMENT
Defines Movement of axis ( linear=0, radial=1, radial_limited=2) .
Definition GmiInterface.h:447
@ mpAXIS_TRG_POS
Target position of the axis.
Definition GmiInterface.h:428
@ mpTIMEUNIT
Time unit in Seconds.
Definition GmiInterface.h:359
@ mpERROR_MESSAGE
Error message from above error code.
Definition GmiInterface.h:351
@ mpJOYSTICK
Controls the access to the joystick. Inhibit=-1 (Only when Off), Off=0, Stop=1 or On=2.
Definition GmiInterface.h:308
@ mpAXIS_NAME
Name of this axis.
Definition GmiInterface.h:371
@ mpAXIS_IDX_POS
Multiplication factor for the index positions.
Definition GmiInterface.h:375
@ mpAXIS_MASK
Mask to detect gated parameter.
Definition GmiInterface.h:367
@ mpVERSION
Version information of software and hardware drivers and implementation.
Definition GmiInterface.h:292
@ mpAXIS_MAX_ACC
Maximum acceleration of the axis.
Definition GmiInterface.h:406
@ mpAXIS_MAX_POS
Maximum position of the axis.
Definition GmiInterface.h:398
@ mpERROR
Reports error and is used to clear it if possible. No error=0, Warning=1, Soft Error=2,...
Definition GmiInterface.h:347
@ mpAXIS_RESOLUTION
Resolution of the axis for velocity and position. (readonly)
Definition GmiInterface.h:387
@ mpAXIS_LAST
Free axis parameters numbers from here.
Definition GmiInterface.h:451
@ mpAXIS_CUR_POS
Current position of the axis.
Definition GmiInterface.h:417
@ mpTRIGGER_FREQ
Trigger frequency in Hz.
Definition GmiInterface.h:355
@ mpLAST
Free number from here. Axis parameters from here.
Definition GmiInterface.h:363
@ mpAXIS_OFS_POS
offset to position of Axis.
Definition GmiInterface.h:410
@ mpAXIS_MAX_VEL
Maximum velocity of the axis.
Definition GmiInterface.h:402
@ mpAXIS_CUR_VEL
Current velocity of the axis.
Definition GmiInterface.h:421
@ mpMOVEPOS
Definition GmiInterface.h:300
@ mpTRIGGER_MODE
Trigger mode 'true' is intern 'false' is extern.
Definition GmiInterface.h:320
@ mpTRIGGER_ENABLE
Enable output of trigger, true is enable.
Definition GmiInterface.h:333
@ mpNONE
Used to indicate no parameter. Interface parameters from here.
Definition GmiInterface.h:288
@ mpAXIS_TRG_ACC
Target acceleration of the axis.
Definition GmiInterface.h:436
@ mpAXIS_ACCURACY
Accuracy of the axis for velocity and position. (readonly)
Definition GmiInterface.h:383
@ mpAXIS_TRG_VEL
Target velocity of the axis.
Definition GmiInterface.h:432
@ mpPOP_AXIS
Position orientation event source selection. Values are as EAxisLoc.
Definition GmiInterface.h:329
@ mpAXIS_HOME_OFS
Defines position after homing of the axis.
Definition GmiInterface.h:443
void(* ControllerEvent)(Controller *ctrl, EControllerEvent event)
Handler type for motion event handling.
Definition GmiInterface.h:673
EControllerEvent
Enumerate for controller events.
Definition GmiInterface.h:647
@ ceCOMPLETE
Complete event on an axis group. Not implemented yet.
Definition GmiInterface.h:663
@ ceSTATUS
Controller status changed.
Definition GmiInterface.h:651
@ ceUNHOOKED
Handler was unhooked to the controller.
Definition GmiInterface.h:659
@ ceHOOKED
Handler was hooked to the controller.
Definition GmiInterface.h:655
@ cePOPEVENT
POP axis has made a rotation.
Definition GmiInterface.h:667
Structure to hold data update information.
Definition GmiInterface.h:231
IdType Id
Holds the ID of the result which is responsible for this data.
Definition GmiInterface.h:245
void Clear()
Clears all members.
Definition GmiInterface.h:264
unsigned Counter
Holds the counter value of the amount of measurements since the last reset of the implementation.
Definition GmiInterface.h:261
BufferInfo()=default
Initializing constructor.
void * Buffer
Holds the buffer pointer.
Definition GmiInterface.h:249
unsigned Size
Holds the size of the buffer.
Definition GmiInterface.h:253
unsigned Remain
Holds the remaining size to store.
Definition GmiInterface.h:257
Structure to hold parameter information.
Definition GmiInterface.h:107
ParamState::Vector States
Number of specified states for this.
Definition GmiInterface.h:162
std::string Unit
Unit of the parameter.
Definition GmiInterface.h:150
ParamInfo(const ParamInfo &pi)
Copy constructor.
Definition GmiInterface.h:117
ParamInfo & operator=(const ParamInfo &pi)
Assignment operator.
ParamInfo & copyFrom(const ParamInfo &pi)
Sets the e instance as when it was constructed.
ParamInfo()=default
Default constructor.
std::string Description
Usage off the parameter of the parameter.
Definition GmiInterface.h:152
std::string Name
Name of the parameter.
Definition GmiInterface.h:148
void init()
initialize/reset the instance as when it was constructed.
Structure to hold parameter information.
Definition GmiInterface.h:171
std::string Name
Name of the parameter.
Definition GmiInterface.h:208
ResultInfo(const ResultInfo &pi)
Definition GmiInterface.h:174
ResultInfo & operator=(const ResultInfo &pi)
Definition GmiInterface.h:179
ResultInfo & copy(const ResultInfo &pi)
std::string Description
Usage off the parameter of the parameter.
Definition GmiInterface.h:212