29#ifndef INC_CINOSBASECONTROL_H
30#define INC_CINOSBASECONTROL_H
36#define DF_INOS_BASE_CONTROL_DBT "INOS-BASE-CONTROL"
40#define DF_INOS_CONTROL_STATE_PEACE 0
41#define DF_INOS_CONTROL_STATE_ACTIVATING 1
42#define DF_INOS_CONTROL_STATE_ACTIVE 2
43#define DF_INOS_CONTROL_STATE_INACTIVATING 3
48#define DF_INOS_CONTROL_SUBSTATE_ACTIVE_HALT 0
49#define DF_INOS_CONTROL_SUBSTATE_ACTIVE_RUN 1
50#define DF_INOS_CONTROL_SUBSTATE_ACTIVE_UMOVE 2
56#define ER_INOS_BASE_CONTROL_MCROBOT_ERROR_BASE 0x00000000
57#define ER_INOS_GSB_CONTROL_MCROBOT_ERROR_BASE 0x40031300
58#define ER_INOS_SL2_CONTROL_MCROBOT_ERROR_BASE 0x40032300
59#define ER_INOS_HSSI_CONTROL_MCROBOT_ERROR_BASE 0x40033300
61#define ER_INOS_CONTROL_POSCHK 0x00000001
62#define ER_INOS_CONTROL_POSOVR 0x00000002
63#define ER_INOS_CONTROL_OSCICHK 0x00000004
64#define ER_INOS_CONTROL_ENBMISSING 0x00000008
65#define ER_INOS_CONTROL_HOMEFAILED 0x00000010
66#define ER_INOS_CONTROL_SAFE_SYNCFAILED 0x00000020
67#define ER_INOS_CONTROL_WATCHDOG 0x00000040
68#define ER_INOS_CONTROL_POWER_FAILURE 0x00000080
69#define ER_INOS_CONTROL_POSCHN 0x00001000
70#define ER_INOS_CONTROL_ACTIVATE 0x00002000
71#define ER_INOS_CONTROL_EXTERN 0x00004000
72#define ER_INOS_CONTROL_OFFLINE 0x00008000
76#define WR_INOS_CONTROL_INTLIMIT 0x00000001
77#define WR_INOS_CONTROL_FSLIMIT 0x00000002
78#define WR_INOS_CONTROL_EXTERN 0x00004000
82#define DF_INOS_BASE_CONTROL_FLAG_CHK_POS 0x00000001
83#define DF_INOS_BASE_CONTROL_FLAG_SIM_POS 0x00000002
84#define DF_INOS_BASE_CONTROL_FLAG_SIM_OUT 0x00000004
85#define DF_INOS_BASE_CONTROL_FLAG_SIM_ACT 0x00000008
86#define DF_INOS_BASE_CONTROL_FLAG_ENB_NRD 0x00000010
87#define DF_INOS_BASE_CONTROL_FLAG_DEAD_INC 0x00000020
88#define DF_INOS_BASE_CONTROL_FLAG_ENB_SYN 0x00000040
89#define DF_INOS_BASE_CONTROL_FLAG_ENB_NRM 0x00000080
90#define DF_INOS_BASE_CONTROL_FLAG_POS_OVRS 0x00000100
91#define DF_INOS_BASE_CONTROL_FLAG_FFV_100 0x00000200
92#define DF_INOS_BASE_CONTROL_FLAG_NO_PID 0x00000400
93#define DF_INOS_BASE_CONTROL_FLAG_POS_ABS 0x00000800
94#define DF_INOS_BASE_CONTROL_FLAG_NO_MPE 0x00001000
95#define DF_INOS_BASE_CONTROL_FLAG_POSEX 0x00002000
96#define DF_INOS_BASE_CONTROL_FLAG_INIT_V_ADJ_DIS 0x00004000
97#define DF_INOS_BASE_CONTROL_FLAG_DEAD_INC2 0x00008000
98#define DF_INOS_BASE_CONTROL_FLAG_LIFETIME 0x00010000
99#define DF_INOS_BASE_CONTROL_FLAG_NRM_POS 0x00020000
100#define DF_INOS_BASE_CONTROL_FLAG_DISTANCE_CODED_CALIB 0x00040000
101#define DF_INOS_BASE_CONTROL_FLAG_INC_FRACT 0x00080000
102#define DF_INOS_BASE_CONTROL_FLAG_POWER 0x00100000
107#define DF_INOS_BASE_CONTROL_FLAG_ENB_SAFE_SYNC 0x40000000
108#define DF_INOS_BASE_CONTROL_FLAG_DIS_SERR 0x80000000
115#define DF_INOS_BASE_CONTROL_OPT_DEAD_INC 0x00000001
118#define DF_INOS_BASE_CONTROL_OPT_POS_OVRS 0x00000002
122#define DF_INOS_BASE_CONTROL_OPT_FFV_100 0x00000004
126#define DF_INOS_BASE_CONTROL_OPT_NO_PID 0x00000008
129#define DF_INOS_BASE_CONTROL_OPT_POS_ABS 0x00000010
134#define DF_INOS_BASE_CONTROL_OPT_NO_MPE 0x00000020
138#define DF_INOS_BASE_CONTROL_OPT_POSEX 0x00000040
142#define DF_INOS_BASE_CONTROL_OPT_INIT_V_ADJ_DIS 0x00000080
146#define DF_INOS_BASE_CONTROL_OPT_DEAD_INC2 0x00000100
151#define DF_INOS_BASE_CONTROL_OPT_DISTANCE_CODED_CALIB 0x00000200
154#define DF_INOS_BASE_CONTROL_OPT_CUSTOMER1_SYNC_INTERFACE 0x00000400
159#define DF_INOS_BASE_CONTROL_OPT_LIMIT_OUT 0x00000800
164#define DF_INOS_BASE_CONTROL_OPT_IGNORE_CYCLEID 0x00001000
167#define DF_INOS_BASE_CONTROL_OPT_INC_FRACT 0x00002000
172#define DF_INOS_BASE_CONTROL_OPT_EXT_POS_ERR 0x00004000
175#define DF_INOS_BASE_CONTROL_OPT_POWER_FAILURE 0x00008000
188#ifdef INOS_SAFETY_SUPPORT
266 real64 m_rSINOSBaseControl_Internal0[2];
303 uint8 m_rSINOSBaseControl_Internal1;
321class CINOSOscillationDetector;
342 const char* apControlType);
352 virtual void Activate(
bool abCheckPos =
true,
bool abSimulatePos =
false,
353 bool abSimulateOut =
false,
bool abSimulateAct =
false);
355 virtual void InActivate();
362 ICACHE
virtual uint32 Pull(real64 arPosition, real64 arVelocity,
363 real64 arAcceleration, real64 arJerk);
366 virtual void GetCmdPosition(real64& arPosition);
368 virtual void GetCmdVelocity(real64& arVelocity);
370 virtual void GetCmdAcceleration(real64& arAcceleration);
372 virtual void GetCmdJerk(real64& arJerk);
374 ICACHE
virtual void SetActPosition(real64 arPosition);
376 ICACHE
virtual void AdjActPosition(real64 arPosition);
378 ICACHE
virtual void GetActPosition(real64& arPosition);
380 ICACHE
virtual void GetActPositionEx(real64& arPosition);
382 INOS_INLINE void GetActPositionFst(real64& arPosition)
383 { arPosition = m_rSact; };
387 virtual void GetActAcceleration(real64& arAcceleration);
389 virtual void GetActJerk(real64& arJerk);
391 virtual void GetActPosError(real64& arPosError);
393 virtual void GetActVelocityError(real64& arVelocityError,
bool abFiltered =
false);
396 virtual uint32 GetParam(
const char* apName, real64& arResult);
398 virtual volatile real64* GetParamAdr(
const char* apName);
400 virtual uint32 SetParam(
const char* apName, real64 arValue);
402 virtual void SetIncsPerUnit(real64 arIncs);
404 virtual void SetUnitsPerInc(real64 arUnits);
406 virtual void OnGearRatioChanged(){};
410 void SetFlag(uint32 auFlag)
413 void ClrFlag(uint32 auFlag)
416 uint32 GetFlag()
const
419 const char* GetType()
422 ICACHE
virtual uint32 GetState();
424 ICACHE
virtual uint32 GetState(uint32& auSubState);
426 virtual uint32 SetError(uint32 auError);
428 ICACHE
virtual uint32 GetError(
bool abResolveExternal =
false);
430 ICACHE
virtual uint64 GetErrorEx(
bool abResolveExternal =
false);
432 ICACHE
virtual real64 GetPosError()
435 virtual bool IsErrorFatal();
437 virtual uint32 GetWarning(
bool abResolveExternal =
false);
439 virtual uint64 GetWarningEx(
bool abResolveExternal =
false);
441 virtual void AcceptError(uint64 auError=0xffffffffffffffffLL);
443 virtual void AcceptWarning(uint64 auWarning=0xffffffffffffffffLL);
446 virtual bool Sync(real64 arPosition);
448 ICACHE
virtual void AbortSync();
450 virtual bool GetZeroImpuls();
452 virtual void GetSyncPos(real64& arSyncPos)
453 { arSyncPos = m_rSyncPos;};
455 virtual void SetSyncPos(real64 arSyncPos);
457 virtual void GetSyncCnt(uint32& auSyncCnt)
458 { auSyncCnt = m_uSyncCnt;};
460 virtual void SetSyncCnt(uint32 auSyncCnt)
461 { m_uSyncCnt = auSyncCnt;};
463 virtual void GetSyncCor(real64& arSyncCor)
464 { arSyncCor = m_rSyncCor;};
466 virtual void SetNormPos(real64 arNormPos);
468 void SetPathS(real64 arSpath)
469 { m_rSpath = arSpath; };
476 ICACHE
virtual void SetAxisEnable(
bool abEnable);
478 ICACHE
virtual bool GetAxisEnable();
480 ICACHE
virtual bool GetAxisEnabled();
482 ICACHE
virtual bool GetAxisReady();
484 ICACHE
virtual void SetSyncEnable(
bool abEnable);
486 ICACHE
virtual bool GetSyncEnabled();
488 ICACHE
virtual void ResetSync();
490 ICACHE
virtual void ResetEnabled();
492 ICACHE
virtual void SetControlOut(real64 arControl);
494 ICACHE
virtual void SetSerrorOut(real64 arError);
496 virtual bool GetAutoComRequested();
498 virtual void OnActivated(){};
500 virtual void OnInActivated(){};
503 virtual void BorderRelaxStart();
505 virtual void BorderRelaxStop();
508 ICACHE
virtual void SetCoupled(
bool abCoupled);
510 ICACHE
virtual bool GetCoupled();
513 virtual bool SafeSyncEnable();
515 virtual void SafeSyncDisable();
517 virtual bool SafeSyncCheck()
522 virtual bool SafeSyncAvailable()
528 virtual void GetCycleTime(real64& arCycleTime,
bool abOversampled=
false);
530 virtual void SetCycleTime(real64 arCycleTime);
532 virtual uint8 GetOversampling()
533 {
return m_uOversampling;};
535 virtual uint16 GetCycleNumber();
537 virtual uint16 GetCycleId();
539 virtual uint8 GetBusId();
541 virtual void SetDeadTime(real64 arDeadTime);
543 virtual void GetDeadTime(real64& arDeadTime);
554 virtual bool IsOnline()
const;
563 virtual CINCOObject* GetRegister();
566 virtual uint32 GetMcRobotBaseCode()
567 {
return ER_INOS_BASE_CONTROL_MCROBOT_ERROR_BASE; };
569 const char* GetAxisName()
const
582 #ifdef INOS_SAFETY_SUPPORT
585 virtual bool MoveMicro();
594 virtual bool IsMoveMicroSupported(
bool abVerbose =
false);
605 friend class CINCODelayToHalt;
606 friend class CINCODeadTimeMs;
607 friend class CINCOactSEx;
608 friend class CINCOlifeS;
609 friend void _INI_0400_CINOSBaseControl();
613 virtual void Reset();
616 virtual void Control();
618 virtual void Activating() {};
620 virtual void InActivating() {};
622 void iCalcDeadTime();
625 {
return m_rSyncCor;};
627 int64 iCalcSinc(real64 arPosition);
629 ICACHE real64 iCalcSact(int64 aiPosition);
631 ICACHE real64 iCalcSactEx(int64 aiPositionEx);
633 ICACHE
void iCalcSerr();
635 bool HasExtendedErrorWarning();
637 ICACHE uint32 iGetError()
638 {
return (uint32) m_uError; };
640 ICACHE uint32 iGetWarning()
641 {
return (uint32) m_uWarning; };
643 void iRegisterTrqCurrent();
645 virtual void UpdateCycleId(uint16 auCycleId);
647 void SetMaxVelocity(real64 arVmax)
648 {
if (arVmax > REAL64(0.0)) m_rVmax_1 = REAL64(1.0)/arVmax;
else m_rVmax_1 = REAL64(0.0);}
656 virtual const char* GetStateText();
678 CINCOObject* m_pRegister;
680 CINCOObject* m_pError;
682 CINCOObject* m_pWarning;
684 CINCOObject* m_pFlag;
690 CINCOObject* m_pLife;
696 CINCOObject* m_pMisc;
702 uint32* m_pPosConfig;
704 uint32* m_pPosOffline;
706 int32* m_pPosPosition;
708 int32* m_pPosPositionEx;
716 uint8 m_uBusCategory{};
788 real64 m_rCycleTimeMs;
792 real64 m_rDeadTimeMs;
794 real64 m_rDelayToHalt;
798 uint8 m_uOversampling;
820 real64 m_rSactExOffset;
826 real64 m_rVactFiltered;
844 real64 m_rVerrFiltered;
859 real64 m_rSerrMaxPos;
861 real64 m_rSerrMinPos;
863 real64 m_rSerrMaxNeg;
865 real64 m_rSerrMinNeg;
894 real64 m_rPositionFract;
906 uint16 m_uSarraySize;
908 uint16 m_uSarrayIndex;
910 uint32 m_uCharacteristics;
912 uint32 m_uDelayToHalt;
914 int32 m_iDelayToHalt;
930 static char m_cStateCombo[494];
947 CINOSOscillationDetector* m_pOsciChk;
950 uint32* m_pDiEnable =
nullptr;
951 uint32 m_uDiEnableMask = 0;
952 inosName64 m_cDiEnable{};
955 uint32* m_pDiPower =
nullptr;
956 uint32 m_uDiPowerMask = 0;
957 inosName64 m_cDiPower{};
958 uint32* m_pDiUccOk =
nullptr;
959 uint32 m_uDiUccOkMask = 0;
962 #ifdef INOS_SAFETY_SUPPORT
967 bool m_bMicroMoveParamsValid =
false;
969 bool m_bMicroMoveReturning =
false;
971 real64 m_rMicroMoveDistance = 0;
984#define INOS_BASECONTROL_UPDATE_CMD_BUFFER()\
985 if (nullptr != m_pCmdBuf) {\
986 m_uCmdWrt = (m_uCmdWrt + 1) & m_uCmdMsk;\
987 m_pCmdBuf[m_uCmdWrt].m_rS = apData->m_rS;\
988 m_pCmdBuf[m_uCmdWrt].m_rV = apData->m_rV;\
989 m_pCmdBuf[m_uCmdWrt].m_rA = apData->m_rA;\
990 m_pCmdBuf[m_uCmdWrt].m_rJ = apData->m_rJ;\
1002 friend void _INI_0000_CINOSBaseControl();
1013 TCreateControl m_pCreate;
1015 const char* m_pControlType;
1022 const char* apControlType);
1026 const char* apControlType);
CINOSJerkRamp declaration file.
#define DECLARE_DYNAMIC(aClass)
Definition cinospartitionmemory.h:328
Definition cinosadcchannel.h:53
Definition cinosbasecontrol.h:329
void SetAxisPowerInput(const char *apInputName)
set name of power input
uint32 m_uMaskCfgSynced
synced mask
Definition cinosbasecontrol.h:782
virtual void GetActVelocity(real64 &arVelocity, bool abFiltered=false)
get actual position fast
CINOSBit * m_pOutActivate
pointer to activate output
Definition cinosbasecontrol.h:722
real64 m_rOutSerrorRawGain
serror raw gain
Definition cinosbasecontrol.h:768
CINOSBit * m_pInpActivated
pointer to activated input
Definition cinosbasecontrol.h:739
CINOSDacChannel * m_pOutTrqCurrent
pointer to trqcurrent output
Definition cinosbasecontrol.h:770
CINOSBit * m_pInpSynced
pointer to synced input
Definition cinosbasecontrol.h:749
uint32 m_uMaskCfgWarning
warning mask
Definition cinosbasecontrol.h:780
CINOSBit * m_pOutCurLimit
pointer to currentlimit bit
Definition cinosbasecontrol.h:728
CINOSBit * m_pInpWarning
pointer to warning input
Definition cinosbasecontrol.h:743
CINOSBit * m_pOutCurAdd
pointer to current add bit
Definition cinosbasecontrol.h:730
CINOSBit * m_pOutCurCmd
pointer to current cmd bit
Definition cinosbasecontrol.h:732
void SetLifetimeDistance(real64 arDistance)
set lifetime distance (only used at startup by either mcrobot or user code)
CINOSDacChannel * m_pOutSpeed
pointer to speed output
Definition cinosbasecontrol.h:758
CINOSBit * m_pOutSyncEnbEx
pointer to extended sync enable output
Definition cinosbasecontrol.h:726
void SetAxisEnableInput(const char *apInputName)
set name of axis enable input
int64 m_iLifetimeDistance
lifetime distance in inc
Definition cinosbasecontrol.h:836
CINOSBit * m_pOutPosRelax
pointer to pos relax (used at border)
Definition cinosbasecontrol.h:734
CINOSBit * m_pInpSync
pointer to sync input
Definition cinosbasecontrol.h:753
void GetLifetimeDistance(real64 &arDistance)
get current lifetime distance
real64 m_rOutSpeedRawGain
speed raw gain
Definition cinosbasecontrol.h:762
uint32 m_uMaskCfgError
error mask
Definition cinosbasecontrol.h:778
virtual uint32 Connect()
Connect control to hardware.
CINOSBit * m_pInpUccOk
pointer to ucc ok input
Definition cinosbasecontrol.h:755
CINOSBit * m_pInpAutoCom
pointer to autocom input
Definition cinosbasecontrol.h:741
CINOSDacChannel * m_pOutSerror
pointer to error output
Definition cinosbasecontrol.h:764
bool iSetAxisPowerInput()
set name of axis ucc ok input
CINOSBit * m_pInpSyncDeltaOk
pointer to syncdeltaok input
Definition cinosbasecontrol.h:751
void * m_pOutSerrorRaw
pointer to error output
Definition cinosbasecontrol.h:766
void GetAxisPowerInput(char *apResult, uint32 auSize) const
get name of power input
CINOSBit * m_pInpError
pointer to error input
Definition cinosbasecontrol.h:745
CINOSBit * m_pInpFatalError
pointer to fatal error input
Definition cinosbasecontrol.h:747
CINOSBit * m_pOutSyncEnb
pointer to sync enable output
Definition cinosbasecontrol.h:724
CINOSAdcChannel * m_pInpTrqCurrent
pointer to trqcurrent input
Definition cinosbasecontrol.h:773
bool iSetAxisEnableInput()
set name of axis enable input
void GetAxisEnableInput(char *apResult, uint32 auSize) const
get name of axis enable input
CINOSBit * m_pOutCoupled
pointer to coupled
Definition cinosbasecontrol.h:736
void * m_pOutSpeedRaw
pointer to speed output
Definition cinosbasecontrol.h:760
Definition cinosbaseramp.h:752
Definition cinosbus.h:565
Definition cinosdacchannel.h:52
definition of the CINOSJerkRamp class
Definition cinosjerkramp.h:72
Provides physical aka real axis functionality.
Definition cinosphysicalaxis.h:289
Definition cinosposchannel.h:59
Definition cinosbasecontrol.h:1000
#define INOS_INLINE
Definition inosdefine.h:60
#define INOS_OR(variable, mask)
Definition inosmacro.h:201
#define INOS_AND(variable, mask)
Definition inosmacro.h:210
Descriptor structure used to configure a controller. It is usually defined in a corresponding xxx....
Definition cinosbasecontrol.h:201
real64 m_rCycleTime
Axis cycletime the controller generator should work with [ms]. Do not configure this value in modern ...
Definition cinosbasecontrol.h:238
inosName64 m_cPowerName
Optional power input channel name. This parameter can be used to define the name of a digital input,...
Definition cinosbasecontrol.h:226
uint8 m_uOversampling
Requested oversampling, e.g. axis sampling rate is 96kHz and fieldbus cycle time 16kHz -> oversamplin...
Definition cinosbasecontrol.h:300
inosName m_cUnit
Axis unit, e.g. m, mm, deg, ... The string has no special meaning and is just for displaying purposes...
Definition cinosbasecontrol.h:231
real64 m_rSmaxRun
factor to calculate max. allowed position error at move maxSerr = m_rSmax*(1.0 + m_rSmaxRun*(V/Vmax))
Definition cinosbasecontrol.h:255
inosName64 m_cPosName
Position channel name. If working with Indel motor controllers this name is equal to the axis name.
Definition cinosbasecontrol.h:209
real64 m_rSmax
Max. allowed position check error [unit].
Definition cinosbasecontrol.h:250
real64 m_rMicroMoveTime
Duration used for a 'micromove' in milliseconds (one-way, e.g. moving there and back again takes twic...
Definition cinosbasecontrol.h:310
uint8 m_uVfilter
Size of requested speed filter.
Definition cinosbasecontrol.h:295
real64 m_rPosExUnitsPerInc
Units per increment factor for a possible extended position channel.
Definition cinosbasecontrol.h:263
real64 m_rDelayToHalt
Delay [ms] before the controller should switch from run to halt parameters.
Definition cinosbasecontrol.h:259
real64 m_rDeadTime
Controller dead time [ms]. is calculated incrementally to the fieldbus delays if option DF_INOS_BASE_...
Definition cinosbasecontrol.h:246
inosName64 m_cEnbName
Optional enable input channel name. This parameter can be used to define the name of a digital input,...
Definition cinosbasecontrol.h:220
uint8 m_uDigits
Number of digits to use in INCO explorer. This parameter has no functional meaning and has just displ...
Definition cinosbasecontrol.h:291
inosName64 m_cDacName
Optional dac channel name. This parameter is only used if one uses a stone aged analog interface to a...
Definition cinosbasecontrol.h:214
inosName64 m_cName
Axis name.
Definition cinosbasecontrol.h:204
uint32 m_uOptions
Controller options, see DF_INOS_BASE_CONTROL_OPT_DEAD_INC, DF_INOS_BASE_CONTROL_OPT_POS_OVRS,...
Definition cinosbasecontrol.h:286
extended ramp data
Definition cinosbaseramp.h:617
ramp data
Definition cinosbaseramp.h:602