INOS
cinosfollowaxis.h
Go to the documentation of this file.
1//******************************************************************************
27//******************************************************************************
28
29#pragma once
30//
31//------------------------------------------------------------------------------
32// defines
33//------------------------------------------------------------------------------
34//
35//
36#include <cmath>
37
38// --- synchronized axes states -------------------------------------------------------------
39//
40#define DF_INOS_FOLLOW_AXIS_FLAG_NO 0x00000000 // no flag
41#define DF_INOS_FOLLOW_AXIS_FLAG_IGN_CYCLEID 0x00000001 // ignore the cycle id of the axes
42#define DF_INOS_FOLLOW_AXIS_FLAG_ALLOW_DIFF_CYCLETIMES 0x00000002 // allow axes with different if, and only if, the master axis uses the lower cycle time (= higher frequency)
43#define DF_INOS_FOLLOW_AXIS_FLAG_LIMIT_TORQUE 0x00000004 //
44//
45// --- synchronized axes errors -------------------------------------------------------------
46//
47#define ER_INOS_FOLLOW_AXIS_NOT_SETUP 0x00000001 // The follow axis object has not been setup or setup failed
48#define ER_INOS_FOLLOW_AXIS_MASTER_NOTFOUND 0x00000002 // Master axis could not be found
49#define ER_INOS_FOLLOW_AXIS_FOLLOWER_NOTFOUND 0x00000004 // Slave axis could not be found
50#define ER_INOS_FOLLOW_AXIS_SAME 0x00000008 // Same axis passed as master and slave
51#define ER_INOS_FOLLOW_AXIS_CYCLENUMBER 0x00000010 // Axes use different cycle number
52#define ER_INOS_FOLLOW_AXIS_CYCLETIME 0x00000020 // Axes use different cycle time
53#define ER_INOS_FOLLOW_AXIS_CYCLETIME_SLAVE_SMALLER 0x00000040 // Slave axis uses smaller cycle time than master axis
54#define ER_INOS_FOLLOW_AXIS_MASTER_NOT_PEACE 0x00000080 // Following will not be enabled as master axis is currently not in peace
55
56#define ER_INOS_FOLLOW_AXIS_SLAVE_PULL_FAILED 0x00000100 // Passing new pull data to the slave axis failed
57#define ER_INOS_FOLLOW_AXIS_MASTER_INACTIVE 0x00000200 // Master axis got disabled
58#define ER_INOS_FOLLOW_AXIS_MASTER_ERROR 0x00000400 // master axis encountered an error
59#define ER_INOS_FOLLOW_AXIS_SLAVE_ERROR 0x00000800 // slave axis encountered an error
60
115 public:
119 CINOSFollowAxis(const char* apMasterAxis, const char* apFollowerAxis);
130 uint32 Setup(uint32 auFlags = DF_INOS_FOLLOW_AXIS_FLAG_NO);
139 uint32 Enable(real64 arFactor = REAL64(1.0));
150 void Disable();
154 uint32 GetError() {
155 return m_uError;
156 }
159 bool IsSetup() const;
160
161 private:
164 void iHandle();
165 void iDisable();
166 void iCreateCommonAxisTorqueLimits();
167 void iDestroyCommonAxisTorqueLimits();
168 bool iIsCommonAxisTorqueLimitRequested() const;
169 bool iIsCommonAxisTorqueLimitSetup() const;
170 void iSetupCommonAxisTorqueLimit();
171 void iRestoreOriginalAxisTorqueLimits();
172
173 private:
175 inosName32 m_cMasterAxis{};
177 inosName32 m_cSlaveAxis{};
179 CINOSBaseAxis* m_pMasterAxis{};
181 CINOSBaseAxis* m_pSlaveAxis{};
183 uintid m_uHookId{};
184 SINOSBaseRampTrqLimit* m_pAccelerationLimit{};
185 SINOSBaseRampTrqLimit* m_pDecelerationLimit{};
186 SINOSBaseRampTrqLimit* m_pAccelerationLimitOrig{};
187 SINOSBaseRampTrqLimit* m_pDecelerationLimitOrig{};
189 uint32 m_uError{};
191 real64 m_rFactor{REAL64(1.0)};
193 real64 m_PrevMasterPos{};
194 real64 m_PrevFollowerPos{};
195 bool m_bHookEnabled{false};
196 bool m_bDisableRequest{};
197 CINOSSync m_DisableSync;
208 bool m_bEnablingRequest{};
210 CINOSSync m_EnableSync;
215 uint32 m_nPullDataMultiplier{1};
217 uint32 m_nPullDataCnt{0};
218
220};
221//
222//------------------------------------------------------------------------------
223// end of file
224//------------------------------------------------------------------------------
#define DECLARE_DYNAMIC(aClass)
Definition cinospartitionmemory.h:328
Provides axis functionality.
Definition cinosbaseaxis.h:676
Definition cinosfollowaxis.h:114
bool IsSetup() const
CINOSFollowAxis(const char *apMasterAxis, const char *apFollowerAxis)
uint32 GetError()
Definition cinosfollowaxis.h:154
uint32 Enable(real64 arFactor=REAL64(1.0))
uint32 Setup(uint32 auFlags=0x00000000)
Definition inos_syn.h:67
torque limitation
Definition cinosbaseramp.h:661