29 #ifndef INC_CINOSBASERAMP_H
30 #define INC_CINOSBASERAMP_H
36 #define DF_INOS_BASE_RAMP_DBT "INOS-BASE-RAMP"// db table name
37 #define DF_INOS_BASE_RAMP_TRQ_LIMIT_ACC_DBT "INOS-BASE-RAMP-TRQ-LIMIT-ACC" // db table name
38 #define DF_INOS_BASE_RAMP_TRQ_LIMIT_DEC_DBT "INOS-BASE-RAMP-TRQ-LIMIT-DEC" // db table name
40 #define DF_INOS_RAMP_MAX_JERK 4 // max. number of supported jerks
44 #define DF_INOS_RAMP_STATE_PEACE 0 // state 'peace'
45 #define DF_INOS_RAMP_STATE_BREAK 1 // state 'break'
46 #define DF_INOS_RAMP_STATE_RUNNING 2 // state 'running'
47 #define DF_INOS_RAMP_STATE_PULLING 3 // state 'pulling'
48 #define DF_INOS_RAMP_STATE_STOPPING 4 // state 'stopping'
52 #define ER_INOS_RAMP_POSRANGE 0x00000001 // position out of range
53 #define ER_INOS_RAMP_FAILED 0x00000002 // requested command failed
54 #define ER_INOS_RAMP_MIM_RANGE 0x00000004 // position out of range during mov in move
55 #define ER_INOS_RAMP_OVERSAMPLING 0x00000008 // number of samples was not a
57 #define ER_INOS_RAMP_VMAX_REACHED 0x00000010 // allowed Vmax reached
58 #define ER_INOS_RAMP_MOVE_NOT_IN_CACHE 0x00000020 // trajectory was not in cache as expected
59 #define ER_INOS_RAMP_CORE_MISMATCH 0x00000040 // core mismatch
61 #define DF_INOS_RAMP_MAX_ERR 32 // max. number of errors
65 #define WR_INOS_RAMP_MIM_DEC 0x00000001 // move in move during deceleration
66 #define WR_INOS_RAMP_CORE_MISMATCH 0x00000002 // core mismatch
70 #define DF_INOS_BASE_RAMP_FLAG_CHK_LIMITS 0x00000001 // check position limits
71 #define DF_INOS_BASE_RAMP_FLAG_ENB_BASE 0x00000002 // take base class geni
72 #define DF_INOS_BASE_RAMP_FLAG_ENB_TRQLIMIT 0x00000004 // enable torque limitation
73 #define DF_INOS_BASE_RAMP_FLAG_DIS_MIM 0x00000008 // disable 'move in move'
74 #define DF_INOS_BASE_RAMP_FLAG_LIMIT_MOVE 0x00000010 // limit move to min/max instead of range error
75 #define DF_INOS_BASE_RAMP_FLAG_DIS_MIM_DEC 0x00000020 // disable 'move in move' if axis is in deceleration already
76 #define DF_INOS_BASE_RAMP_FLAG_SET_CACHE_EPSILON 0x00000040 // set cache epsilon == ramp epsilon
77 #define DF_INOS_BASE_RAMP_FLAG_OPT_MIM 0x00000080 // enable optimized move in move handling
78 #define DF_INOS_BASE_RAMP_FLAG_CHK_LIMITS_IN_SEG 0x00000200 // check position limits within segments
79 #define DF_INOS_BASE_RAMP_FLAG_BACKLASH 0x00000400 // do backlash compensation
80 #define DF_INOS_BASE_RAMP_FLAG_FORCE_BACKLASH 0x00000800// do always a backlash move at target position
81 #define DF_INOS_BASE_RAMP_FLAG_IGNORE_LIMITS_AT_STOP 0x00001000// always ignore soft limits at stop
82 #define DF_INOS_BASE_RAMP_FLAG_LOOK_AHEAD 0x00002000 // enable look ahead (used e.g. for move in move on slow targets)
83 #define DF_INOS_BASE_RAMP_FLAG_CACHE_ONLY 0x00004000 // consume trajectory from ramp cache only. Reject move request with a failure in case of a cache miss
84 #define DF_INOS_BASE_RAMP_FLAG_IGNORE_VMAX 0x00008000 // ignore Vmax reached error (should only be used for testing purposes)
85 #define DF_INOS_BASE_RAMP_FLAG_IGNORE_JERK 0x00010000 // ignore cmdJ to speed up move calculation
86 #define DF_INOS_BASE_RAMP_FLAG_IGNORE_CORE 0x00020000 // ignore core mismatch failure (should only be used in desperate situations)
87 #define DF_INOS_BASE_RAMP_FLAG_OVRS_LAST 0x00800000 // restore last oversampled value
88 #define DF_INOS_BASE_RAMP_FLAG_SLOW_SPEED 0x01000000 // slowmotion is done with only speed reduction
89 #define DF_INOS_BASE_RAMP_FLAG_SHAPE_CALC 0x02000000 // internal flag used for shape calculation
90 #define DF_INOS_BASE_RAMP_FLAG_SETUPMODE 0x04000000 // setup mode active
91 #define DF_INOS_BASE_RAMP_FLAG_JOB_SLOW 0x08000000 // use job slowmotion in 'move in move'
92 #define DF_INOS_BASE_RAMP_FLAG_CACHE_FLUSH 0x10000000 // force a cache flush at next move
93 #define DF_INOS_BASE_RAMP_FLAG_CRS_PEACE 0x20000000 // geni requests peace during critical section
94 #define DF_INOS_BASE_RAMP_FLAG_CRS_ACTIVE 0x40000000 // critical section active
95 #define DF_INOS_BASE_RAMP_FLAG_ENABLED 0x80000000 // ramp geni is enabled
98 #define DF_INOS_BASE_RAMP_FLAG_NO_CACHE (DF_INOS_BASE_RAMP_FLAG_SETUPMODE|DF_INOS_BASE_RAMP_FLAG_BACKLASH)
102 #define DF_INOS_BASE_RAMP_FLAG_CACHE_CRITICAL \
103 (DF_INOS_BASE_RAMP_FLAG_ENB_BASE | DF_INOS_BASE_RAMP_FLAG_ENB_TRQLIMIT | DF_INOS_BASE_RAMP_FLAG_CACHE_FLUSH)
109 #define DF_INOS_BASE_RAMP_OPT_CHK_LIMITS 0x00000001
113 #define DF_INOS_BASE_RAMP_OPT_ENB_BASE 0x00000002
116 #define DF_INOS_BASE_RAMP_OPT_ENB_TRQLIMIT 0x00000004 // enable torque limitation
119 #define DF_INOS_BASE_RAMP_OPT_DIS_MIM 0x00000008
125 #define DF_INOS_BASE_RAMP_OPT_LIMIT_MOVE 0x00000010
128 #define DF_INOS_BASE_RAMP_OPT_DIS_MIM_DEC 0x00000020
132 #define DF_INOS_BASE_RAMP_OPT_OPT_MIM 0x00000080
135 #define DF_INOS_BASE_RAMP_OPT_TRQ_LIMIT 0x00000100
138 #define DF_INOS_BASE_RAMP_OPT_BACKLASH 0x00000400
141 #define DF_INOS_BASE_RAMP_OPT_FORCE_BACKLASH 0x00000800
144 #define DF_INOS_BASE_RAMP_OPT_IGNORE_LIMITS_AT_STOP 0x00001000
151 #define DF_INOS_BASE_RAMP_OPT_LOOK_AHEAD 0x00002000
154 #define DF_INOS_BASE_RAMP_OPT_IGNORE_VMAX 0x00008000
158 #define DF_INOS_BASE_RAMP_OPT_IGNORE_CORE 0x00020000
162 #define DF_INOS_BASE_RAMP_DATA_FLAG_DEL 0x00000001 // structure has to be deleted
163 #define DF_INOS_BASE_RAMP_DATA_FLAG_LST 0x00000002 // last block in chain
167 #define DF_INOS_RAMP_JERK_ALL 0xFFFFFFFF // jerk number for all jerks
168 #ifdef INOS_SLOWMOTION_ZERO_SUPPORT
169 #define DF_INOS_RAMP_MIN_SLOW REAL64(0.0000) // min. allowed slowmotion factor
171 #define DF_INOS_RAMP_MIN_SLOW REAL64(0.0001) // min. allowed slowmotion factor
173 #define DF_INOS_RAMP_MAX_SLOW REAL64(2.0000) // max. allowed slowmotion factor
174 #define DF_INOS_RAMP_EPS_V_STOP REAL64(1.0e-6) // epsilon value used to determine when a velocity reaches zero during a stop
179 eMaxVelocityNone = 0x00000000,
180 eMaxVelocityIgnoreSetup = 0x00000001,
181 eMaxVelocityIgnoreSLS = 0x00000002,
194 #ifdef INOS_SAFETY_SUPPORT
195 #include <cinossafetyconfig.h>
452 uint8 m_uInternal0[1];
460 #if defined(INOS_AXIS_EXTENSION_SUPPORT)
461 struct SINOSParamSetExtension
468 SINOSParamSetExtension* m_pNext;
471 SINOSParamSetExtension(uint32 auId,
const char* apName)
472 : m_uId(auId), m_cName{0}, m_pNext(0)
473 { inos_strncpy(m_cName, apName,
sizeof(m_cName));};
475 virtual ~SINOSParamSetExtension(){};
481 const char* GetName()
const
482 {
return &m_cName[0]; };
484 virtual SINOSParamSetExtension& operator=(
const SINOSParamSetExtension& src)
492 virtual SINOSParamSetExtension* Clone() = 0;
494 virtual CINCOObject* CreateInco() = 0;
506 eFlgFix = 0x00000001,
508 eFlgTim = 0x00000004,
510 eFlgWindow = 0x00000010,
511 eFlgWindowOpt = 0x00000020,
512 eFlgEco = 0x00000040,
513 eFlgAwayLight = 0x00000080,
515 eFlgIgnoreLimits = 0x00000100,
516 eFlgTriggerReduced = 0x00000200,
517 eFlgIgnoreCache = 0x00000400,
518 eFlgTemporary = 0x80000000,
544 {
return (
m_uFlags & eFlgTemporary)!=0; }
553 {
return (
m_uFlags & eFlgIgnoreCache)!=0; }
554 #if !defined(INOS_AXIS_EXTENSION_SUPPORT)
558 struct SINOSParamSetExtension* m_pExtension;
571 void DestroyExtensions();
575 void AddExtension(SINOSParamSetExtension* apExtension);
577 void RemoveExtension(
const char* apName);
579 SINOSParamSetExtension* GetExtension(uint32 auId)
582 SINOSParamSetExtension* ext = m_pExtension;
585 if (ext->m_uId == auId) {
628 real64 m_rAccelerationTime;
631 real64 m_rDecelerationTime;
683 if (
m_rV[i] != b.
m_rV[i])
return false;
684 if (
m_rA[i] != b.
m_rA[i])
return false;
695 #ifndef INOS_RAMP_DLL
703 #if defined(INOS_AXIS_EXTENSION_SUPPORT)
704 void AddExtension(SINOSParamSetExtension* apExtension);
707 void RemoveExtension(
const char* apName);
730 CINCOObject* m_pRegister;
743 class CINOSRampJobPart;
744 class CINOSRampCache;
746 class CINOSRampSegTra;
747 class CINOSRampSegCns;
748 class CINOSRampSegPos;
763 const char* GetName();
765 const char* GetType();
767 static uint32 GetVersion();
769 #ifndef INOS_RAMP_DLL
770 static CINOSBaseRamp* GetRamp(
const char* apAxisName,
const char* apRampType);
779 eFlgMoveNone= 0x00000000,
780 eFlgMoveWithoutDec1 = 0x00000001,
781 eFlgMoveWithoutDec2 = 0x00000002,
782 eFlgMoveWithoutDec3 = 0x00000004
787 virtual bool Move(real64 arPosition,
SINOSRampParam* apParam = 0);
792 virtual bool Move(real64 arPosition, real64 arSave1, real64 arSave2,
796 virtual bool MoveApp(real64 arPosition, real64 arPositionVel, real64 arVelocity,
800 virtual bool MoveDep(real64 arPosition, real64 arPositionVel, real64 arVelocity,
804 virtual bool Endless(
bool abPositive =
true,
SINOSRampParam* apParam = 0);
826 virtual real64 GetMoveTime(real64 arPosition, real64 arDelta = REAL64(0.0),
829 virtual real64 GetAccelerationTime(real64 arPosition, real64 arDelta = REAL64(0.0),
832 virtual real64 GetConstTime(real64 arPosition, real64 arDelta = REAL64(0.0),
835 virtual real64 GetDecelerationTime(real64 arPosition, real64 arDelta = REAL64(0.0),
839 virtual real64 GetMoveTime(real64 arStartPosition, real64 arEndPosition,
843 virtual real64 GetAccelerationTime(real64 arStartPosition, real64 arEndPosition,
846 virtual real64 GetConstTime(real64 arStartPosition, real64 arEndPosition,
849 virtual real64 GetDecelerationTime(real64 arStartPosition, real64 arEndPosition,
853 virtual real64 GetMoveTime(real64 arStartPosition, real64 arEndPosition,
854 real64 arDelta, real64& arDeltaTime,
SINOSRampParam* apParam = 0);
858 virtual real64 GetMoveAppTime(real64 arPosition, real64 arPositionVel,
859 real64 arVelocity, real64 arDelta = REAL64(0.0),
SINOSRampParam* apParam = 0);
861 virtual real64 GetMoveAppTime(real64 arStartPosition, real64 arEndPosition,
862 real64 arPositionVel, real64 arVelocity, real64 arDelta,
SINOSRampParam* apParam = 0);
864 virtual real64 GetMoveDepTime(real64 arPosition, real64 arPositionVel,
865 real64 arVelocity, real64 arDelta = REAL64(0.0),
SINOSRampParam* apParam = 0);
867 virtual real64 GetMoveDepTime(real64 arStartPosition, real64 arEndPosition,
868 real64 arPositionVel, real64 arVelocity, real64 arDelta,
SINOSRampParam* apParam = 0);
870 virtual real64 GetMoveDist(real64 arTime,
SINOSRampParam* apParam = 0);
872 virtual real64 GetMoveDist(real64 arPosition, real64 arTime,
875 virtual real64 GetMoveDist(real64 arStartPosition, real64 arEndPosition,
879 virtual uint64 GetStartTicks(real64 arDelta);
881 virtual uint64 GetTargetTicks()
883 {
return inos_atomic_gettickcount(&m_uTargetTicks);};
884 virtual uint64 GetTargetTicks(real64 arDelta);
889 virtual uint32 SegBegin(real64 arSlowMotion = REAL64(1.0), real64 arStartVelocity = REAL64(0.0));
891 virtual uint32 SegBegin(real64 arSlowMotion, real64 arStartPosition, real64 arStartVelocity);
893 virtual uint32 SegMove(real64 arPosition, real64 arVelocity = REAL64(0.0),
894 SINOSRampParam* apParam = 0, real64 arAcceleration = REAL64(0.0), real64 arDuration = REAL64(-1.0));
899 virtual uint32 SegMoveResult()
901 {
return m_eSegMoveResult;};
902 virtual uint32 SegConst(real64 arPosition);
904 virtual uint32 SegPos(real64 arTime);
906 virtual uint32 SegPosSetTime(real64 arTime);
908 virtual uint32 SegVelocity(real64 arVelocity,
SINOSRampParam* apParam = 0);
910 virtual real64 SegTime(
bool abRoundedtoCycleTime=
true);
912 virtual uint32 GetSegEnd (real64& arS);
914 virtual void SegJobMustFitInCycle (
bool abMustFitInCycle);
916 virtual uint32 SegRun();
918 virtual CINOSRampJob* GetSegJob()
919 {
return m_pSegJob;};
923 virtual void Pull(real64 arS, real64 arV, real64 arA, real64 arJ);
939 virtual void FlushPull();
946 { ClrFlag(DF_INOS_BASE_RAMP_FLAG_ENABLED);};
952 virtual bool StopLive(real64 arSlowMotion = 1.0,
SINOSRampParam* apParam = 0);
954 virtual bool StopLiveDelta(real64 arDelta, real64 arSlowMotion = 1.0,
SINOSRampParam* apParam = 0);
956 virtual bool Stop(real64 arPosition,
SINOSRampParam* apParam = 0);
962 virtual bool Break(real64 arPosition,
SINOSRampParam* apParam = 0);
965 virtual bool EmergencyStop();
967 virtual bool EmergencyStop(real64 arPosition,
SINOSRampParam* apParam,
bool abPosValid =
true);
969 virtual void EmergencyStopLive();
978 eFlgCmdNone = 0x00000000,
979 eFlgCmdPeak = 0x00000001
982 virtual void SetCmdFlags(uint32 auFlags);
984 ICACHE
virtual void SetCmdPosition(real64 arPosition);
986 ICACHE
virtual void GetCmdPosition(real64& arPosition);
988 virtual void SetCmdVelocity(real64 arVelocity);
990 virtual void GetCmdVelocity(real64& arVelocity, ECmdFlags aeFlags = eFlgCmdNone);
992 virtual void SetCmdAcceleration(real64 arAcceleration);
994 virtual void GetCmdAcceleration(real64& arAcceleration, ECmdFlags aeFlags = eFlgCmdNone);
996 virtual void SetCmdDeceleration(real64 arDeceleration);
998 virtual void GetCmdDeceleration(real64& arDeceleration, ECmdFlags aeFlags = eFlgCmdNone);
1000 virtual void SetCmdCruiseleration(real64 arCruiseleration);
1002 virtual void GetCmdCruiseleration(real64& arCruiseleration);
1004 virtual void SetCmdJerk(real64 arJerk, uint32 auNumber = DF_INOS_RAMP_JERK_ALL);
1006 virtual void GetCmdJerk(real64& arJerk, uint32 auNumber = 0);
1008 virtual void SetCmdCruiseJerk(real64 arCruiseJerk);
1010 virtual void GetCmdCruiseJerk(real64& arCruiseJerk);
1012 virtual void GetCmdRealJerk(real64& arJerk, uint32 auNumber = 0);
1014 virtual void SetCmdSlowMotion(real64 arSlowMotion,
bool abUpdate =
false);
1016 virtual void SetCmdSlowMotion(real64 arSlowMotion,
bool abUpdate,
bool abStopping);
1018 virtual void GetCmdSlowMotion(real64& arSlowMotion,
SINOSRampParam* apParam = 0);
1020 virtual void GetActSlowMotion(real64& arSlowMotion,
SINOSRampParam* apParam = 0);
1022 #ifdef INOS_SAFETY_SUPPORT
1023 virtual void GetSafetySlowMotion(real64& arSlowMotion,
SINOSRampParam* apParam = 0);
1026 virtual void SetCmdRelaxTime(real64 arRelaxTime);
1028 virtual void GetCmdRelaxTime(real64& arRelaxTime);
1030 virtual void SetEmgDeceleration(real64 arDeceleration);
1032 virtual void GetEmgDeceleration(real64& arDeceleration);
1034 virtual void SetEmgJerk(real64 arJerk);
1036 virtual void SetEmgJerk(real64 arJerk, real64 arJerkEnd);
1038 virtual void GetEmgJerk(real64& arJerk);
1040 virtual void GetEmgJerk(real64& arJerk, real64& arJerkEnd);
1043 { *m_pParam = *apParam; };
1046 {
return m_pParam; };
1048 ICACHE
virtual void SetActPosition(real64 arPosition);
1050 ICACHE
virtual void AdjActPosition(real64 arPosition);
1052 ICACHE
virtual void GetActPosition(real64& arPosition);
1054 ICACHE
virtual void GetActPosition(real64& arPosition, uint64 auTicks);
1056 virtual void GetStopPosition(real64& arPosition,
SINOSRampParam* apParam);
1058 virtual void GetBgnPosition(real64& arPosition)
1059 { arPosition = m_rSbgn;};
1061 virtual void SetActVelocity(real64 arVelocity);
1063 virtual void GetActVelocity(real64& arVelocity);
1065 virtual void SetActAcceleration(real64 arAcceleration);
1067 virtual void GetActAcceleration(real64& arAcceleration);
1069 virtual void SetActJerk(real64 arJerk);
1071 virtual void GetActJerk(real64& arJerk);
1075 virtual void GetActSVAJ(
SINOSRampData& arData,
bool abIrqSafe =
true);
1077 virtual void AdjActTime(real64 arDelta);
1079 virtual void SetMinPosition(real64 arPosition);
1081 virtual void GetMinPosition(real64& apPosition)
const;
1083 virtual void SetMaxPosition(real64 arPosition);
1085 virtual void GetMaxPosition(real64& arPosition)
const;
1087 virtual bool CheckPosition(real64& arPosition,
bool abIgnoreMapping =
false,
SINOSRampParam* apParam =
nullptr);
1089 virtual void SetMaxVelocity(real64 arVelocity);
1091 virtual void GetMaxVelocity(real64& arVelocity, uint32 auFlags = eMaxVelocityNone);
1093 virtual void SetMaxSetupVelocity(real64 arVelocity);
1095 virtual void GetMaxSetupVelocity(real64& arVelocity);
1097 virtual void SetMaxInitVelocity(real64 arVelocity);
1099 virtual void GetMaxInitVelocity(real64& arVelocity);
1101 virtual void SetMinVelocity(real64 arVelocity);
1103 virtual void GetMinVelocity(real64& arVelocity);
1105 virtual void SetTrqVelocity(real64 arVelocity);
1107 virtual void GetTrqVelocity(real64& arVelocity);
1109 virtual void AdjustMinMaxValues (real64 arFactor);
1111 virtual void SetMinAcceleration(real64 arAcceleration);
1113 virtual void GetMinAcceleration(real64& arAcceleration);
1115 virtual void SetMaxAcceleration(real64 arAcceleration);
1117 virtual void GetMaxAcceleration(real64& arAcceleration);
1119 virtual void SetMaxAccelerationPull(real64 arAcceleration);
1121 virtual void GetMaxAccelerationPull(real64& arAcceleration);
1123 virtual void SetTrqAcceleration(real64 arAcceleration);
1125 virtual void GetTrqAcceleration(real64& arAcceleration);
1127 virtual void SetMinDeceleration(real64 arDeceleration);
1129 virtual void GetMinDeceleration(real64& arDeceleration);
1131 virtual void SetMaxDeceleration(real64 arDeceleration);
1133 virtual void GetMaxDeceleration(real64& arDeceleration);
1135 virtual void SetTrqDeceleration(real64 arDeceleration);
1137 virtual void GetTrqDeceleration(real64& arDeceleration);
1139 virtual void SetMinCruiseleration(real64 arCruiseleration);
1141 virtual void GetMinCruiseleration(real64& arCruiseleration);
1143 virtual void SetMaxCruiseleration(real64 arCruiseleration);
1145 virtual void GetMaxCruiseleration(real64& arCruiseleration);
1147 virtual void SetMinJerk(real64 arJerk);
1149 virtual void GetMinJerk(real64& arJerk);
1151 virtual void SetMaxJerk(real64 arJerk);
1153 virtual void GetMaxJerk(real64& arJerk);
1156 virtual void GetCycleTime(real64& arCycleTime);
1158 virtual void SetCycleTime(real64 arCycleTime);
1160 virtual uint8 GetOversampling();
1162 virtual void SetOversampling(uint8 auOversampling);
1164 virtual void GetCycleTimeUs(uint32& auCycleTime)
1165 { auCycleTime = m_uCycleTimeUs;};
1167 virtual void GetCycleTimeNs(uint32& auCycleTime)
1168 { auCycleTime = m_uCycleTimeNs;};
1170 virtual const char* GetUnit();
1172 virtual void SetUnit(
const char* apUnit);
1174 #ifndef INOS_RAMP_DLL
1175 virtual uint32 GetCharacteristics();
1177 virtual void SetCharacteristics(uint32 auCharacteristics);
1179 virtual uint8 GetTypeChar() {
return m_uTypeChar;};
1181 virtual void SetTypeChar(uint8 auTypeChar) {m_uTypeChar = auTypeChar;};
1183 virtual uint32 GetParam(
const char* apName, real64& arResult);
1185 virtual volatile real64* GetParamAdr(
const char* apName);
1187 virtual uint32 SetParam(
const char* apName, real64 arValue);
1191 void SetFlag(uint32 auFlag)
1194 void ClrFlag(uint32 auFlag)
1198 {
return m_uFlag & m_uFlagEnb;};
1200 void EnbFlag(uint32 auFlag)
1201 {
INOS_OR(m_uFlagEnb, auFlag);};
1203 void DisFlag(uint32 auFlag)
1206 ICACHE
void SetState(uint32 auState)
1211 if (m_uState == DF_INOS_RAMP_STATE_PEACE) {
1215 m_pActParam =
nullptr;
1219 ICACHE uint32 GetState()
1220 {
return m_uState;};
1222 virtual uint32 GetError();
1224 virtual uint64 GetErrorEx();
1226 virtual uint32 GetWarning();
1228 virtual uint64 GetWarningEx();
1230 virtual void AcceptError(uint32 auError=0xffffffff);
1232 virtual void AcceptWarning(uint32 auWarning=0xffffffff);
1235 ICACHE
virtual void GetS(real64& arS);
1237 ICACHE
virtual void GetSV(real64& arS, real64& arV);
1239 ICACHE
virtual void GetSVA(real64& arS, real64& arV, real64& arA);
1241 ICACHE
virtual void GetSVAJ(real64& arS, real64& arV, real64& arA, real64& arJ);
1245 virtual void GetData (
SINOSRampDataEx* apData,
bool abSingleSample=
false);
1248 #ifndef INOS_RAMP_DLL
1260 void EnableCache(uint32 auSize = 32);
1262 CINOSRampCache* EnableCache(CINOSRampCache* apCache);
1264 CINOSRampCache* DisableCache();
1266 void ReEnableCache();
1274 void SetEpsilon(real64 arEpsilon);
1276 void GetEpsilon(real64& arEpsilon)
1277 {arEpsilon = m_rEpsilon;};
1279 void SetCacheEpsilon(real64 arEpsilon);
1286 #ifndef INOS_RAMP_DLL
1290 virtual CINCOObject* GetRegister(
const char* apName =
"Ramp");
1292 void RegisterFlags(CINCOObject* apParent, uint32* auBase);
1302 virtual void SetMoveSafeMin(real64 arMin, real64 arFact1=REAL64(0.0),
1303 real64 arFact2=REAL64(0.0));
1306 virtual void ResetMoveSafeMin();
1311 void SetMapping(CINOSMapping* apMapping, uint32 auIndex)
1312 { m_pMapping = apMapping; m_uMappingIndex = auIndex;};
1315 { m_pMapping = 0; m_uMappingIndex = 0;};
1320 void EnableSetupMode();
1322 void DisableSetupMode();
1324 bool CheckSetupMode();
1333 if (m_rAmaxPull != REAL64(0.0))
1334 rAmax = m_rAmaxPull;
1338 real64 rVzero = rAmax * m_rCycleTime;
1340 return (m_pFstData == 0) && ((m_Act->
m_rV > rVzero) || (m_Act->
m_rV < -rVzero));
1365 {
return m_uCoreId; };
1369 friend class CINOSMapping;
1370 friend class CINOSShape;
1373 friend class CINOSBaseRampTest;
1374 friend class CINOSMcRobotCmdLinear;
1375 friend class CINOSRemoteControlWorker;
1376 friend void _INI_0400_CINOSBaseRamp();
1380 virtual const char* GetStateText();
1382 virtual CINOSRampJob* iMove(real64 arSbgn, real64 arSend,
bool abReturnError,
1385 virtual CINOSRampJob* iMove(real64 arPosition, real64 arSave1, real64 arSave2,
1388 virtual CINOSRampJob* iMoveApp(real64 arSbgn, real64 arSend, real64 arSvel,
1389 real64 arVelocity,
bool abReturnError,
SINOSRampParam* apParam, EMoveFlags aeFlags);
1391 virtual CINOSRampJob* iMoveDep(real64 arSbgn, real64 arSend, real64 arSvel,
1401 enum ECalcMoveResult {
1403 eClcMoveResAdjusted = 1,
1404 eClcMoveResShrinked = 2,
1405 eClcMoveResFailed = 3,
1408 virtual ECalcMoveResult CalcMove(real64 arSlen,
SINOSRampParam* apParam, CINOSRampSegTra*& apSegAcc,
1409 CINOSRampSegCns*& apSegCns, CINOSRampSegTra*& apSegDec, real64 arVbgn = REAL64(0.0),
1410 real64 arVend = REAL64(0.0), real64 arAbgn = REAL64(0.0),
1411 real64 arAend = REAL64(0.0), real64 arDuration = REAL64(-1.0));
1414 virtual void CalcMoveApp(real64 arS, real64 arSred, real64 arVred,
1415 SINOSRampParam* apParam, CINOSRampSegTra*& apAcc, CINOSRampSegCns*& apCns,
1416 CINOSRampSegTra*& apDec1, CINOSRampSegCns*& apDec2, CINOSRampSegTra*& apDec3);
1418 virtual void CalcMoveDep(real64 arS, real64 arSred, real64 arVred,
1419 SINOSRampParam* apParam, CINOSRampSegTra*& apAcc1, CINOSRampSegCns*& apAcc2,
1420 CINOSRampSegTra*& apAcc3, CINOSRampSegCns*& apCns, CINOSRampSegTra*& apDec);
1422 virtual bool CalcStop(uint32 auNxtState,
SINOSRampParam* apParam,
bool abEmergency=
false);
1424 virtual bool CalcStopLive(uint32 auNxtState,
SINOSRampParam* apParam,
bool abEmergency=
false);
1426 virtual bool CalcStop(real64 arS, uint32 auNxtState,
SINOSRampParam* apParam,
bool abEmergency=
false);
1429 virtual real64 CalcEscape(real64 arSlen,
SINOSRampParam* apParam);
1431 virtual bool iCalcApp(real64 arS, real64 arSred, real64 arVred,
SINOSRampParam* apParam);
1434 virtual void iStopping();
1437 enum ECalcSegTraType {
1438 eClcSegTraCompatible = 0,
1439 eClcSegTraAccelerate = 1,
1440 eClcSegTraDecelerate = 2,
1441 eClcSegTraMiddle = 3
1444 virtual CINOSRampSegTra* CalcSegTra(
1449 CINOSRampSegTra* apResult=0,
1450 real64 arJb=REAL64(-1.0),
1451 real64 arJe=REAL64(-1.0),
1452 ECalcSegTraType aeType = eClcSegTraCompatible
1455 virtual void CalcSegApp(
1460 CINOSRampSegTra*& apResult1,
1461 CINOSRampSegCns*& apResult2,
1462 CINOSRampSegTra*& apResult3,
1463 uint32 auMoveInMove = 0
1465 virtual void CalcSegDep(
1470 CINOSRampSegTra*& apResult1,
1471 CINOSRampSegCns*& apResult2,
1472 CINOSRampSegTra*& apResult3
1475 CINOSRampSegCns* CalcSegCns(
1478 CINOSRampSegCns* aResult=0
1481 CINOSRampSegPos* CalcSegPos(
1484 CINOSRampSegPos* aResult=0
1487 bool StartJob(CINOSRampJob* apJob);
1489 bool ReleaseJob(CINOSRampJob* apJob);
1493 CINOSRampJob* SwitchJob(CINOSRampJob* apJob, uint32 auNxtState,
1494 uint32 auBusTicks,
bool bLookAhead =
false);
1496 CINOSRampJob* GetActJob(
bool abIncRefCounter =
true);
1498 real64 RoundUpToCycleTime(real64 arTime);
1500 real64 RoundToCycleTime(real64 arTime);
1502 uint64 RoundUpToBusTicks(real64 arTime);
1504 void SetBusTicksPerAxisTick(uint32 auBusTicksPerAxisTick)
1506 { m_uBusTicksPerAxisTick = auBusTicksPerAxisTick; };
1517 bool IsGreater(real64 arA, real64 arB,
bool bPos);
1520 bool Enter(uint32 auState,
bool abEqual=
true);
1522 bool Exit(
bool abExitCode);
1528 bool Sign(real64& arValue)
1530 {
return (*((uint64*)&arValue)&0x8000000000000000LL) ? true :
false;};
1533 void SetupTrqLimit(real64 arAmax, real64 arVmax, real64 arAtrq,
1548 bool PrepareBacklash(
bool abPositiveMoveDirection, real64& arBacklash);
1552 #ifdef INOS_SAFETY_SUPPORT
1553 virtual void SetSafetyFunction(ESafetyFunction auFunction, real64 arLimit, uint32 auDelay,
1557 virtual void SetSafetyFunction(ESafetyFunction auFunction);
1559 virtual real64 CalcSlsLimit(real64 arSlsLimit);
1561 void SetSLSVmax(real64 arSLSVmax)
1562 { m_rSLSVmax = arSLSVmax; m_rSLSValue = arSLSVmax; m_eSLSType = eSLSReduceFixed; };
1565 #if defined(INOS_AXIS_EXTENSION_SUPPORT)
1566 void AddExtension(SINOSParamSetExtension* apExtension);
1569 void RemoveExtension(
const char* apName);
1572 SINOSParamSetExtension* GetParamSetExtension(uint32 auExtensionId)
1582 SINOSParamSetExtension* ext = act->m_pExtension;
1586 if (ext->m_uId == auExtensionId) {
1601 void iCoreMismatchError();
1603 void iCoreMismatchWarning();
1622 volatile uint32 m_uAlive;
1624 CINOSRampJob* m_pActJob;
1626 CINOSRampJob* m_pNxtJob;
1628 CINOSRampJob* m_pBrkJob;
1630 CINOSRampJob* m_pSegJob;
1632 CINOSRampSegPos* m_pSegPosLast;
1634 CINOSRampCache* m_pCache;
1638 bool m_bSetupModeOk;
1648 #ifndef INOS_RAMP_DLL
1649 CINCOObject* m_pRegister;
1651 CINCOObject* m_pCmd;
1653 CINCOObject* m_pAct;
1655 CINCOObject* m_pMax;
1657 CINCOObject* m_pProp;
1659 CINCOObject* m_pError;
1661 CINCOObject* m_pWarning;
1663 CINCOObject* m_pFlag;
1665 CINCOObject* m_pFlagEnb;
1667 uint32 m_uCharacteristics;
1672 const char* m_pType;
1681 real64 m_rCycleTime;
1683 real64 m_rCycleTimeOversampled;
1685 real64 m_rCycleTime_1;
1687 uint32 m_uCycleTimeUs;
1689 uint32 m_uCycleTimeNs;
1691 uint8 m_uOversampling;
1708 real64 m_rPausedEnd;
1736 ECalcMoveResult m_eSegMoveResult;
1758 real64 m_rVmaxSetup;
1762 real64 m_rVmaxLimit;
1800 uint64 m_uTickCount;
1803 uint64 m_uTargetTicks;
1805 uint64 m_uStartTicks;
1807 uint64 m_uStartTicks_;
1809 uint32 m_uBusTicksPerAxisTick;
1813 uint16 m_uIterCount;
1815 uint16 m_uIterCountMax;
1817 uint16 m_uStopAliveDelta;
1819 uint16 m_uStopAliveDeltaMax;
1821 int16 m_iStoppingState;
1823 real64 m_rStoppingJerk;
1847 bool m_bMoveSafeMin;
1849 real64 m_rMoveSafeMin;
1851 real64 m_rMoveSafeFact1;
1853 real64 m_rMoveSafeFact2;
1860 eFlgBacklashCompensationRequired = 0x00000001,
1871 #ifdef INOS_SAFETY_SUPPORT
1874 eSLSReduceAbsolute = 0,
1875 eSLSReducePercent = 1,
1876 eSLSReduceFixed = 2,
1878 ESLSType m_eSLSType;
1887 ESafetyFunction m_eSafetyFunction;
1889 uint8 m_uSafetyType;
1891 real64 m_rSafetyLimit;
1893 uint32 m_uSafetyDelay;
1897 CINOSMapping* m_pMapping;
1899 uint32 m_uMappingIndex;
1901 static char m_cStateCombo[494];
1932 typedef CINOSBaseRamp *(*TCreateRamp)(
const char* apAxisName);
1937 friend void _INI_0000_CINOSBaseRamp();
1948 TCreateRamp m_pCreate;
1950 const char* m_pType;
1961 static CINOSBaseRamp* GetRamp(
const char* apAxisName,
const char* apType);
1968 #if defined(INOS_MULTICORE)
1969 #define INOS_RAMP_CORE_MISMATCH_IS_ERROR(ret) \
1970 if ((m_uCoreId != DF_INOS_CORE_DEFAULT) && (::GetCoreId() != m_uCoreId)) { \
1971 if (!(GetFlag() & DF_INOS_BASE_RAMP_FLAG_IGNORE_CORE)) { \
1972 iCoreMismatchError(); \
1976 #define INOS_RAMP_CORE_MISMATCH_IS_WARNING(ret) \
1977 if ((m_uCoreId != DF_INOS_CORE_DEFAULT) && (::GetCoreId() != m_uCoreId)) { \
1978 if (!(GetFlag() & DF_INOS_BASE_RAMP_FLAG_IGNORE_CORE)) { \
1979 iCoreMismatchWarning(); \
1984 #define INOS_RAMP_CORE_MISMATCH_IS_ERROR(ret)
1985 #define INOS_RAMP_CORE_MISMATCH_IS_WARNING(ret)
1992 extern double inos_sqrt(
double adValue);
1998 #endif // INC_CINOSBASERAMP_H