I am trying to figure out how to use a UR15 fully controlled by ROS with an injection molding machine. To do this without ROS there is the IMMI URcap that manages the necessary Euromp67 signals, the standard for picker/press communication.
So far I haven’t figured out how to read or write to the IMMI I/O from a ROS topic/node/service so I tried using the /urscript_interface/script_command to send urscript sections of code.
def _urscript(self, script: str):
msg = String()
msg.data = script
self._urscript_pub.publish(msg)
def _set_output(self, bit: int, value: bool):
"""Set a single EM67 output via direct URScript call."""
if not self.press_connected:
return
v = "True" if value else "False"
self._urscript(f"set_euromap_output({bit}, {v})\n")
# LATER IN PROGRAM
# Assert all permission outputs so press can complete its cycle
self._set_output(EM67Out.MOLD_AREA_FREE, True)
self._set_output(EM67Out.ENABLE_MOLD_CLOSURE, True)
self._set_output(EM67Out.ENABLE_FULL_MOLD_OPEN, True)
self._set_output(EM67Out.ENABLE_EJECTOR_FORWARD, True)
self._set_output(EM67Out.ENABLE_EJECTOR_BACK, True)
self._set_output(EM67Out.ROBOT_OPERATION_MODE, False)
time.sleep(0.1) # let outputs settle before press reads them
Also tried:
self.get_logger().info("EM67: Startup Check — asserting all outputs")
self._urscript(
"set_euromap_output(8,True)\n"
"set_euromap_output(15,True)\n"
"set_euromap_output(1,True)\n"
"set_euromap_output(2,True)\n"
"set_euromap_output(9,True)\n"
"set_euromap_output(10,True)\n"
"set_euromap_output(11,True)\n"
"set_euromap_output(12,True)\n"
"set_euromap_output(13,True)\n"
"set_euromap_output(14,True)\n"
)
input(
"\n EM67 Startup Check — all outputs asserted.\n"
" Verify outputs on pendant I/O → External → IMMI,\n"
" then press Enter to activate robot operation… "
)
self._urscript("set_euromap_output(8, False)\n")
self.get_logger().info("✓ Startup Check complete — Robot Operation Mode LOW")
However that doesn’t seem to be working. I want to run the robot in headless mode which is the main reason I am trying to move this fully into ROS. Previously I was controlling robot movements with ROS and then nesting the External Control URCap inside the IMMI URCap template. Having to start the mold, the teach pendant and a ROS2 python program is not a user friendly set up.
For some additional context here is what the .script file shows for the first IMMI check:
$ 3 "Startup Check"
set_euromap_output(8,True)
set_euromap_output(15,True)
set_euromap_output(1,True)
set_euromap_output(2,True)
set_euromap_output(9,True)
set_euromap_output(10,True)
set_euromap_output(11,True)
set_euromap_output(12,True)
set_euromap_output(13,True)
set_euromap_output(14,True)
And I have tried sending one line at a time
$ ros2 topic pub -t 3 /urscript_interface/script_command std_msgs/msg/String 'data: "get_euromap_input(2)"'
Waiting for at least 1 matching subscription(s)...
Waiting for at least 1 matching subscription(s)...
publisher: beginning loop
publishing #1: std_msgs.msg.String(data='get_euromap_input(2)')
publishing #2: std_msgs.msg.String(data='get_euromap_input(2)')
publishing #3: std_msgs.msg.String(data='get_euromap_input(2)')
$ ros2 topic pub -t 3 /urscript_interface/script_command std_msgs/msg/String 'data: "set_euromap_output(15, True)"'
Waiting for at least 1 matching subscription(s)...
Waiting for at least 1 matching subscription(s)...
Waiting for at least 1 matching subscription(s)...
publisher: beginning loop
publishing #1: std_msgs.msg.String(data='set_euromap_output(15, True)')
publishing #2: std_msgs.msg.String(data='set_euromap_output(15, True)')
publishing #3: std_msgs.msg.String(data='set_euromap_output(15, True)')
Any help on Euromap67/IMMI from ROS would be appreciated.