The RMP Motion Controller APIs
Configuration.sq
1// This file contains example methods for configuring a system before running an application using hard coded values.
2
4void ConfigurePhantomAxis(uint32 axisIndex)
5{
6 // The number of encoder counts per unit.
7 // This value is just the value used for testing and on phantom axes.
8 // Remember to change this value to one that makes sense for the application.
9 double userUnits = 1000.0;
10 AxisUserUnitsSet(axisIndex, userUnits);
11
12 // This gets rid of any abnormal configurations the axis previously had.
13 AxisInterruptEnableSet(axisIndex, false);
14
15 // Set the axis to do nothing when the axis gets an amp fault, hits hardware limits, or gets a position error limit.
16 enum RSIActionNONE = 0;
17 AxisAmpFaultActionSet(axisIndex, RSIActionNONE);
18 AxisHardwareNegLimitActionSet(axisIndex, RSIActionNONE);
19 AxisHardwareNegLimitTriggerStateSet(axisIndex, true);
20 AxisHardwarePosLimitActionSet(axisIndex, RSIActionNONE);
21 AxisHardwarePosLimitTriggerStateSet(axisIndex, true);
22 AxisErrorLimitActionSet(axisIndex, RSIActionNONE);
23
24 // Set the Fine Position Tolerance to a very large value to get the phantom axis to detect that it's done
25 // moving when it reaches the final position
26 double finePositionTolerance = 1000000.0;
27 AxisPositionToleranceFineSet(axisIndex, finePositionTolerance);
28
29 // Set the Coarse Position Tolerance to a very large value to get the phantom axis to detect that it's done
30 // moving when it reaches the final position
31 double coarsePositionTolerance = 1000000.0;
32 AxisPositionToleranceCoarseSet(axisIndex, coarsePositionTolerance);
33
34 // Set default velocity to a very high number because this is a phantom axis.
35 double velocity = 100000.0;
36 AxisDefaultVelocitySet(axisIndex, velocity); // Set the default velocity
37
38 // This value is just the value used for testing and on phantom axes.
39 // Remember to change this value to one that makes sense for the application.
40 // Set default acceleration to a very high value because this is a phantom axis.
41 double acceleration = 1000000.0;
42 AxisDefaultAccelerationSet(axisIndex, acceleration);
43 AxisDefaultDecelerationSet(axisIndex, acceleration);
44
45 double jerkPercent = 50.0;
46 AxisDefaultJerkPercentSet(axisIndex, jerkPercent);
47}
49
51void PrepareAxisForMotion(uint32 axisIndex)
52{
53 // Prepare the axis for motion
54 AxisAbort(axisIndex); // Stop whatever the axis was doing.
55 AxisClearFaults(axisIndex); // Clear any faults the axis had.
56 AxisPositionSet(axisIndex, 0); // Set the current position to 0.
57 AxisCommandPositionSet(axisIndex, 0); // Set command position to 0.
58 AxisCommandPositionDirectSet(axisIndex, 0);
59 AxisMotionCamRepeatStop(axisIndex);
60 AxisGearingDisable(axisIndex); // Reset gearing.
61 AxisAmpEnableSet(axisIndex, true); // Enable the axis.
62}
64
65void main()
66{
67 int32 axisCount = ControllerAxisCountGet();
68 for (uint32 index = 0; index < axisCount; index++)
69 {
70 ConfigurePhantomAxis(index);
71 PrepareAxisForMotion(index);
72 }
73}
74
75// More example functions in the future!
@ RSIActionNONE
None - do not perform any action.