The RMP Motion Controller APIs
Hello Axis Motion

Basics for getting up and running with Axis motion in RapidCode for Python.


📜 Hello Axis Motion

import os
import sys
import time
import RapidCodeHelpers as helpers # The check_errors() and check_errors() helpers provided on our API SampleApp documentation pages
rapidcode_dir = helpers.find_rapid_code_directory()
#Import the ntx.dll from INtime
os.add_dll_directory("c:\\Program Files (x86)\\INtime\\bin")#ntx.dll
#Import the RapidCode.py file (Path to your rapidcode install directory)
sys.path.append(rapidcode_dir)
import RapidCode # The RapidCode.py wrapper located in your RMP install directory
def main():
print("Hello, RapidCode.")
motionController:RapidCode.MotionController = RapidCode.MotionController.CreateFromSoftware(rapidcode_dir)
print("This object is a "+str(type(motionController)))#When creating your RapidCode objects (Axis, MultiAxis, MotionController,ect) we recommend specifying the type with my_object_name:RapidCode.*** (MotionController,Axis, Ect.) so that your IDE can autocomplete class member names.
#motionController=RapidCode.RapidCodeObject(motionController)
print("MotionController creation error count: ", motionController.ErrorLogCountGet())
helpers.check_errors(motionController)
motionController.AxisCountSet(1)
axis:RapidCode.Axis = motionController.AxisGet(0)
helpers.check_errors(axis)
print("Axis ",axis.NumberGet()," creation error count: ", axis.ErrorLogCountGet())
axis.MoveRelative(2, 10, 1, 1, 50)
while not axis.MotionDoneGet():
print("Position: ", axis.CommandPositionGet(), " Velocity: ", axis.CommandVelocityGet())
time.sleep(1)

Learn more in topic page.