| ApossC SDK V01.15

SDK_Amplifier_MotorCommissioning.mc
Go to the documentation of this file.
1
9 #pragma once
10
11 #include <SysDef.mh>
12 #include "SDK_Amplifier_MotorCommissioning.mh"
13
33 long sdkMotorCommCurrentStep(long axis, long current, long time, long recordEnable)
34 {
35 if (recordEnable==1) // Settings for the recording
36 {
37 RecordIndex( HWAMP_PROCESS_INDEX(axis,PO_HWAMP_CURRENT),
38 AXE_PROCESS_INDEX(axis,REG_USERREFCUR));
39 RecordTimeBase(RECORD_LOOP_CUR);
40 RecordDest(DYNMEM);
41 RecordStart(0);
42 }
43
44 // Set the controller loop
45 HWAMP_PARAM(axis, HWAMP_MODE) = HWAMP_MODE_POS_CUR;
46
47 // Parameters for position controller -> Make sure that the position controller is not running
48 AXE_PARAM(axis, KPROP) = 0; // position-controller proportional factor
49 AXE_PARAM(axis, KINT) = 0; // position-controller integral factor
50 AXE_PARAM(axis, KDER) = 0; // position-controller differencial factor
51 AXE_PARAM(axis, FFVEL) = 0; // position-controller Velocity Feed forward
52 AXE_PARAM(axis, KFFACC) = 0; // position-controller Acceleration Feed Forward
53 AXE_PARAM(axis, KFFDEC) = 0; // position-controller Deceleration Feed Forward
54 AXE_PARAM(axis, POSERR) = 0x7FFFFFFF; // very high to avoid errors
55
56 AxisControl(axis, USERREFCUR); // Turn motor control on with a user defined reference current
57 print("Start current step");
58 Delay(50);
59
60 AXE_PROCESS(axis,REG_USERREFCUR)=current; //Current Step to "current" mA
61 Delay(time); //Wait for "time" ms
62 AXE_PROCESS(axis,REG_USERREFCUR)=0; //Set current to 0 mA
63
64 Delay(50);
65 print("Stop current step");
66 RecordStop(0,0);
67
68 return(1);
69 }
70
91 long sdkMotorCommVelStep(long axis, long velocity, long time, long recordEnable)
92 {
93 // Settings for the recording
94 if (recordEnable==1)
95 {
96 RecordIndex( HWAMP_PROCESS_INDEX(axis,PO_HWAMP_VELPI_ACTUAL),
97 HWAMP_PROCESS_INDEX(axis,PO_HWAMP_VELPI_REF));
98 RecordTimeBase(RECORD_LOOP_VEL);
99 RecordDest(DYNMEM);
100 RecordStart(0);
101 }
102
103 // Set the controller loop
104 HWAMP_PARAM(axis, HWAMP_MODE) = HWAMP_MODE_POS_VEL_CUR;
105
106 // Parameters for position controller -> Make sure that the position controller is not running
107 AXE_PARAM(axis, KPROP) = 0; // position-controller proportional factor
108 AXE_PARAM(axis, KINT) = 0; // position-controller integral factor
109 AXE_PARAM(axis, KDER) = 0; // position-controller differencial factor
110 AXE_PARAM(axis, FFVEL) = 0; // position-controller Velocity Feed forward
111 AXE_PARAM(axis, KFFACC) = 0; // position-controller Acceleration Feed Forward
112 AXE_PARAM(axis, KFFDEC) = 0; // position-controller Deceleration Feed Forward
113 AXE_PARAM(axis, POSERR) = 0x7FFFFFFF; // very high to avoid errors
114
115
116 AxisControl(axis, USERREFVEL); // Turn motor control on with a user defined reference current
117 print("Start velocity step");
118 Delay(50);
119
120 AXE_PROCESS(axis,REG_USERREFVEL)=velocity; // Velcity step to "velocity"
121 Delay(time); // Wait for "time" ms
122 AXE_PROCESS(axis,REG_USERREFVEL)=0; // Set velocity to 0
123
124 Delay(50);
125 print("Stop velocity step");
126 RecordStop(0,0);
127
128 return(1);
129 }
130
154 long sdkMotorCommPositionRamp(long axis, long distance, long controlMode, long recordEnable)
155 {
156 if (recordEnable==1) // Settings for the recording
157 {
158 RecordIndex( AXE_PROCESS_INDEX(axis,REG_COMPOS),
159 AXE_PROCESS_INDEX(axis,REG_ACTPOS),
160 AXE_PROCESS_INDEX(axis,REG_TRACKERR));
161 RecordDest(DYNMEM);
162 RecordStart(0);
163 }
164
165 // Set controller loop
166 HWAMP_PARAM(axis, HWAMP_MODE) = controlMode;
167 AXE_PARAM(axis, POSERR) = 0x7FFFFFFF; // very high to avoid errors
168
169 AxisControl(axis, ON); // Turn the motor on
170 print("Start position ramp");
171 Delay(50);
172
173 AxisPosRelStart(axis, distance); // Start relative movement
174 AxisWaitReached(axis); // Wait until target ist reached
175
176 Delay(50);
177 print("Stop position ramp");
178 RecordStop(0,0);
179
180 return(1);
181 }
182
195 long sdkMotorCommHallSignalCheck(long axis)
196 {
197 // Turn off the motor and set a hall commtype
198 AxisControl(axis, OFF);
199 HWAMP_PARAM(axis,HWAMP_COMMTYPE)=HWAMP_COMMTYPE_BLDC;
200
201 print("HALL Bit 0: ", HWHALL_PROCESS(axis,PO_HWHALL_STATUS).i[0]);
202 print("HALL Bit 1: ", HWHALL_PROCESS(axis,PO_HWHALL_STATUS).i[1]);
203 print("HALL Bit 2: ", HWHALL_PROCESS(axis,PO_HWHALL_STATUS).i[2]);
204 print("HALL Position: ", HWHALL_PROCESS(axis,PO_HWHALL_POS));
205
206 return(1);
207 }
218 long sdkMotorCommEncoderUserUnitCheck(long axis)
219 {
220 // Turn off the motor
221 AxisControl(axis, OFF);
222 print("Counts per turn [cpt]: ",AXE_PROCESS(axis,REG_ACTPOS)/4);
223 print("Quadcounts [qc] : ",AXE_PROCESS(axis,REG_ACTPOS));
224 print("User units [uu] : ", Apos(axis));
225 print("");
226 return(1);
227 }
HWAMP_MODE
#define HWAMP_MODE
Mode of operation.
Definition: SdoDictionary.mh:7639
sdkMotorCommVelStep
long sdkMotorCommVelStep(long axis, long velocity, long time, long recordEnable)
Velocity step for setting the velocity controller.
Definition: SDK_Amplifier_MotorCommissioning.mc:91
HWAMP_COMMTYPE
#define HWAMP_COMMTYPE
Commutation type in use.
Definition: SdoDictionary.mh:7749
PO_HWAMP_VELPI_REF
#define PO_HWAMP_VELPI_REF
Reference of velocity controller.
Definition: SdoDictionary.mh:11637
PO_HWHALL_POS
#define PO_HWHALL_POS
Position value (incrementing/decrementing)
Definition: SdoDictionary.mh:11982
AXE_PROCESS
#define AXE_PROCESS(modno, parno)
Axis Process Data: Setter.
Definition: SdoDictionary.mh:3187
HWHALL_PROCESS
#define HWHALL_PROCESS(modno, parno)
HW Hall Sensor Process Data: Setter.
Definition: SdoDictionary.mh:11968
KFFDEC
#define KFFDEC
Deceleration Feed Forward.
Definition: SdoDictionary.mh:3111
PO_HWHALL_STATUS
#define PO_HWHALL_STATUS
Digital input status of HALL sensor (3 bits, 0...7)
Definition: SdoDictionary.mh:11977
KDER
#define KDER
Derivative Factor for PID position control loop.
Definition: SdoDictionary.mh:2413
PO_HWAMP_CURRENT
#define PO_HWAMP_CURRENT
Actual current.
Definition: SdoDictionary.mh:11357
POSERR
#define POSERR
Maximum tolerated position error.
Definition: SdoDictionary.mh:2444
sdkMotorCommEncoderUserUnitCheck
long sdkMotorCommEncoderUserUnitCheck(long axis)
Checking the configured encoders and the user units.
Definition: SDK_Amplifier_MotorCommissioning.mc:218
REG_ACTPOS
#define REG_ACTPOS
Actual position value.
Definition: SdoDictionary.mh:3199
REG_USERREFCUR
#define REG_USERREFCUR
Motor current reference value in AxisControl(USERREFCUR) mode.
Definition: SdoDictionary.mh:3414
HWAMP_MODE_POS_CUR
#define HWAMP_MODE_POS_CUR
Definition: SdoDictionary.mh:8273
PO_HWAMP_VELPI_ACTUAL
#define PO_HWAMP_VELPI_ACTUAL
Same as PO_HWAMP_VEL_VEL.
Definition: SdoDictionary.mh:11631
AXE_PROCESS_INDEX
#define AXE_PROCESS_INDEX(modno, parno)
Axis Process Data: Getter.
Definition: SdoDictionary.mh:3175
REG_USERREFVEL
#define REG_USERREFVEL
User velocity reference value for AxisControl(AxisNo, USERREFVEL) mode.
Definition: SdoDictionary.mh:3339
AXE_PARAM
#define AXE_PARAM(modno, parno)
Axis Parameters: Setter.
Definition: SdoDictionary.mh:2293
sdkMotorCommHallSignalCheck
long sdkMotorCommHallSignalCheck(long axis)
Checking the hall signals.
Definition: SDK_Amplifier_MotorCommissioning.mc:195
REG_COMPOS
#define REG_COMPOS
Set-point position value.
Definition: SdoDictionary.mh:3207
KFFACC
#define KFFACC
Acceleration Feed Forward.
Definition: SdoDictionary.mh:3102
sdkMotorCommCurrentStep
long sdkMotorCommCurrentStep(long axis, long current, long time, long recordEnable)
Current step for setting the current controller.
Definition: SDK_Amplifier_MotorCommissioning.mc:33
HWAMP_MODE_POS_VEL_CUR
#define HWAMP_MODE_POS_VEL_CUR
Definition: SdoDictionary.mh:8271
HWAMP_PARAM
#define HWAMP_PARAM(modno, parno)
HW Amplifier Parameters: Setter.
Definition: SdoDictionary.mh:7627
SDK_Amplifier_MotorCommissioning.mh
Declaration of the motor commissioning functions.
FFVEL
#define FFVEL
Velocity Feed forward.
Definition: SdoDictionary.mh:2644
sdkMotorCommPositionRamp
long sdkMotorCommPositionRamp(long axis, long distance, long controlMode, long recordEnable)
Position ramp for setting the position controller.
Definition: SDK_Amplifier_MotorCommissioning.mc:154
KPROP
#define KPROP
Proportional value for PID position control loop.
Definition: SdoDictionary.mh:2404
KINT
#define KINT
Integral value for PID position control loop.
Definition: SdoDictionary.mh:2422
HWAMP_PROCESS_INDEX
#define HWAMP_PROCESS_INDEX(modno, parno)
HW Amplifier Process Data: Getter.
Definition: SdoDictionary.mh:11329
REG_TRACKERR
#define REG_TRACKERR
Actual position tracking error.
Definition: SdoDictionary.mh:3239
HWAMP_COMMTYPE_BLDC
#define HWAMP_COMMTYPE_BLDC
Definition: SdoDictionary.mh:8283

Data Sheets | Released Software | Software Manuals | Hardware Manuals | Maxon Shop

Maxon Support Center