| ApossC SDK V01.15

SDK_Amplifier_MotorAlignment.mc
Go to the documentation of this file.
1
11 #pragma once
12
13 #include <SysDef.mh>
14 #include "SDK_Amplifier_MotorAlignment.mh"
15
34 long sdkMotorAlignment(long axis, long mode, long maxCurrent, long alignCurrent)
35 {
36 long retVal;
37
38 HWAMP_PARAM((axis), HWAMP_MAXCUR) = alignCurrent; // Set the maximum current for aligning the motor
39
40 print("AxisNo ", axis, " Start position detection");
41 MotorAlignStart(axis, mode); // Start motor aliginment
42
43 while((retVal = MotorAlignStatus(axis)) == 0) // Wait until the alignment is successful or failed
44 {
45 print("Aligning... ", retVal);
46 Delay(500);
47 }
48 if(retVal < 0)
49 {
50 print("!!!! Rotor position detection FAILED !!!! retVal: ", retVal);
51 }
52 else if (retVal > 0)
53 {
54 print("Alignment completed with ", retVal);
55 }
56 HWAMP_PARAM((axis), HWAMP_MAXCUR) = maxCurrent; // Set the maximum current for the motor
57
58 return(retVal);
59 }
60
61
79 long sdkMotorMultiAlignment(long axis, long axisNumber, long mode, long maxCurrent, long alignCurrent)
80 {
81 long retVal[6]={0,0,0,0,0,0},retValCheck[6]={0,0,0,0,0,0}, retValSum=0, i;
82
83 axisNumber=axis+axisNumber;
84
85 for (i=axis;i<axisNumber;i++)
86 {
87 AxisControl(i,OFF);
88 HWAMP_PARAM((i), HWAMP_MAXCUR) = alignCurrent; // Set the maximum current for aligning the motor
89 print("AxisNo ", i, " Start position detection");
90 MotorAlignStart(i, mode);
91 Delay(250);
92 }
93 print("AxisNumber ", axisNumber - axis);
94
95 while(!(retValSum==(axisNumber-axis)))
96 {
97 retValSum=0;
98 for (i=axis;i<axisNumber;i++)
99 {
100 retVal[i] = MotorAlignStatus(i);
101 printf("Aligning Axis: %ld, Status: %ld", i, retVal[i]);
102 print("");
103
104 if(retVal[i] < 0)
105 {
106 print("!!!! Rotor position detection FAILED !!!! retVal: ", retVal[i]);
107 print("");
108 return(-1);
109 }
110 else if (retVal[i] > 0)
111 {
112 printf("Aligning Axis: %ld completed with: %ld", i, retVal[i]);
113 print("");
114 retValCheck[i]=1;
115 }
116 retValSum=retValCheck[i]+retValSum;
117 }
118 Delay(1000);
119 }
120 for (i=axis;i<=axisNumber;i++)
121 {
122 HWAMP_PARAM((i), HWAMP_MAXCUR) = maxCurrent; // Set the maximum current for the motor
123 }
124
125 return(1);
126 }
127
143 long sdkSetMotorAlignmentOffset(long axis, long elPol, long poselOffset)
144 {
145 HWAMP_PARAM(axis,HWAMP_ELPOL) = elPol;
146 HWAMP_PARAM(axis, HWAMP_POSEL_OFFSET) = poselOffset;
147
148 return(1);
149 }
SDK_Amplifier_MotorAlignment.mh
Declaration of the motor aligning function.
HWAMP_ELPOL
#define HWAMP_ELPOL
encoder polarity vs.
Definition: SdoDictionary.mh:7917
HWAMP_MAXCUR
#define HWAMP_MAXCUR
Maximal current allowed.
Definition: SdoDictionary.mh:7815
sdkSetMotorAlignmentOffset
long sdkSetMotorAlignmentOffset(long axis, long elPol, long poselOffset)
This function sets the offset of the electric field in relation to an absolute encoder.
Definition: SDK_Amplifier_MotorAlignment.mc:143
sdkMotorMultiAlignment
long sdkMotorMultiAlignment(long axis, long axisNumber, long mode, long maxCurrent, long alignCurrent)
The purpose of this function is to find the rotor position of a brushless motor in relation to the en...
Definition: SDK_Amplifier_MotorAlignment.mc:79
sdkMotorAlignment
long sdkMotorAlignment(long axis, long mode, long maxCurrent, long alignCurrent)
The purpose of this function is to find the rotor position of a brushless motor in relation to the en...
Definition: SDK_Amplifier_MotorAlignment.mc:34
HWAMP_POSEL_OFFSET
#define HWAMP_POSEL_OFFSET
Sets the offset of the electric field in relation to an absolute encoder.
Definition: SdoDictionary.mh:8238
HWAMP_PARAM
#define HWAMP_PARAM(modno, parno)
HW Amplifier Parameters: Setter.
Definition: SdoDictionary.mh:7627

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

Maxon Support Center