20from pathlib
import Path
27import RapidCodeHelpers
as helpers
29rapidcode_dir = helpers.find_rapid_code_directory()
32os.add_dll_directory(
"c:\\Program Files (x86)\\INtime\\bin")
35sys.path.append(str(rapidcode_dir))
42class Testing(unittest.TestCase):
43 motioncontroller:RapidCode.Axis =RapidCode.MotionController.CreateFromSoftware(str(rapidcode_dir))
44 helpers.check_errors(motioncontroller)
46 axis0:RapidCode.Axis = motioncontroller.AxisGet(0)
47 axis1:RapidCode.Axis = motioncontroller.AxisGet(1)
48 axis2:RapidCode.Axis = motioncontroller.AxisGet(2)
49 axis3:RapidCode.Axis = motioncontroller.AxisGet(3)
50 axis4:RapidCode.Axis = motioncontroller.AxisGet(4)
51 axis5:RapidCode.Axis = motioncontroller.AxisGet(5)
52 joints:RapidCode.MultiAxis=motioncontroller.MultiAxisGet(6)
57 def tearDownClass(self):
58 print(
"TEAR DOWN THE WHOLE THING")
59 print(
"motioncontroller.Delete()")
60 self.motioncontroller.Delete()
61 print(
"motioncontroller.Delete() DONE")
114 def test_iopoint(self):
118 user_buffer_address = self.motioncontroller.AddressGet(RapidCode.RSIControllerAddressType_RSIControllerAddressTypeUSER_BUFFER, 0)
120 input0 = RapidCode.IOPoint.CreateDigitalInput( self.motioncontroller, user_buffer_address, INPUT_INDEX)
121 output0 = RapidCode.IOPoint.CreateDigitalOutput( self.motioncontroller, user_buffer_address, OUTPUT_INDEX)
124 assert not output0.Get(),
"The getter function should return a value equal to false"
126 assert output0.Get(),
"The getter function should return a value equal to true"
127 self.motioncontroller.MemorySet(input0.AddressGet(), 0)
128 assert not input0.Get(),
"The getter function should return a value equal to false"
129 self.motioncontroller.MemorySet(input0.AddressGet(), 1)
130 assert input0.Get(),
"The getter function should return a value equal to true"
170if __name__ ==
'__main__':