The RMP Motion Controller APIs
Hello Sequencer

A brief demonstration of how to interact with various RapidCode objects in RapidScript.

Warning
This is a sample program to assist in the integration of the RMP motion controller with your application. It may not contain all of the logic and safety features that your application requires. We recommend that you wire an external hardware emergency stop (e-stop) button for safety when using our code sample apps. Doing so will help ensure the safety of you and those around you and will prevent potential injury or damage.

The sample apps assume that the system (network, axes, I/O) are configured prior to running the code featured in the sample app. See the Configuration page for more information.
Precondition
This sample application requires:
  1. At least one network node (drive or I/O) if using HelloNetworkNode()
  2. At least one I/O node if using HelloIO()
  3. At least one axis (phantom or real) if using HelloAxis()
  4. At least one multiaxis if using HelloMultiAxis()


📜 Hello Sequencer Sample App
A sample application that calls one of the following functions from the main() function:
  1. HelloMotionController()
  2. HelloAxis()
  3. HelloIO()
  4. HelloNetworkNode()
  5. HelloMultiAxis()
  6. HelloEnum()
  7. HelloArray()
‌ To change what function(s) is/are called, edit the contents of the main() function and add the desired functions from the list above.

1global int32 globalSerialNumber; // global variables can be viewed in RapidSetup
2
3void main()
4{
5 HelloMotionController();
6}
7
8void HelloMotionController()
9{
10 int32 serialNumber = ControllerSerialNumberGet();
11 print("MotionController serial number is " + serialNumber);
12 globalSerialNumber = serialNumber; // write it to the global so we can view it int16 RapidSetup
13}
14
15void HelloAxis()
16{
17 uint32 axisNumber = 0;
18 double commandPosition = AxisCommandPositionGet(axisNumber);
19 print("Axis " + axisNumber + " CommandPosition is " + commandPosition);
20}
21
22void HelloIO()
23{
24 uint32 ioNumber = 0;
25 int32 digitalInNumber = 0;
26 bool inputState = IODigitalInGet(ioNumber, digitalInNumber);
27 print("IO node " + ioNumber + " Digital Input bit number " + digitalInNumber + " state is " + inputState);
28}
29
30void HelloNetworkNode()
31{
32 uint32 networkNodeNumber = 1;
33 string nodeName = NetworkNodeNameGet(networkNodeNumber);
34 print("Node " + networkNodeNumber + " is a " + nodeName );
35}
36
37void HelloMultiAxis()
38{
39 uint32 multiAxisNumber = 2;
40 int32 axisCount = MultiAxisAxisCountGet(multiAxisNumber);
41 print("MultiAxis " + multiAxisNumber + " Axis Count is " + axisCount);
42 MultiAxisAbort(multiAxisNumber);
43 MultiAxisClearFaults(multiAxisNumber);
44}
45
46void HelloEnum()
47{
48 enum operational = 260; // RSINetworkStateOPERATIONAL from rsiEnums.h
49 enum currentState = ControllerNetworkStateGet();
50
51 if(currentState == operational)
52 {
53 print("Network is OPERATIONAL");
54 }
55 else
56 {
57 print("Network is not operational");
58 }
59}
60
61void HelloArray()
62{
63 string arrayId = "anyUniqueStringHere";
64 uint64 arraySize = 3;
65 array_create(arrayId, arraySize);
66
67 array_set(arrayId, 0, 111.111);
68 array_set(arrayId, 1, 222.222);
69 array_set(arrayId, 2, 333.333);
70
71 for(uint64 i = 0; i < arraySize; ++i)
72 {
73 print(i + " = " + array_get(arrayId, i));
74 }
75 array_destroy(arrayId);
76}

Learn more in topic page.