I recently updated my software to the most recent version of RoboDK (5.7.4) from an older version and have experienced an issue that may be due to this software update and an update to the post processor scripts.
I primarily use my Universal Robots UR5e cobot for 3D printing operations, and implement an extruder driver function that allows the digital and analog pins on my robot controller to be addressed based on the "Extruder(value)" commands. Depending on the "value" in the parenthesis. The following function has been pasted below.
It can be seen that non-zero values correspond to extruder motor direction, as well as analog output. This function worked for interpreting extrusion values without any issues, until the software was updated.
Inserting this function into the first line of my program before sending it to the robot enables the "Extruder(value)" lines to be properly interpreted by the robot.
The problem that is arising is due to the generation of the program by the post processor, as it appears to change the value in the extruder lines to a string. This is evident, as the decimal has been converted from a float value to a string (ex: Extruder(5.00000) becomes Extruder(500000), which cannot be correctly interpreted by the system when running a program.
The online help forums recommend implementing the following function into the post processor:
I attempted to implement this into the post processor, and it does not appear to fix my issue. Is there any resource I can look into for guidance?
I primarily use my Universal Robots UR5e cobot for 3D printing operations, and implement an extruder driver function that allows the digital and analog pins on my robot controller to be addressed based on the "Extruder(value)" commands. Depending on the "value" in the parenthesis. The following function has been pasted below.
Code:
def Extruder(value):
# use the value as an output:
if value == 0:
set_digital_out(1,False)
set_digital_out(2,False)
set_analog_out(0,0.0) # Stop extruder
elif value < 0:
set_digital_out(0,False)
set_digital_out(1,True)
set_digital_out(2,True)
set_analog_out(0,0.1 * value) # Retract extruder
else:
set_digital_out(0,True)
set_digital_out(1,True)
set_digital_out(2,True)
set_analog_out(0,(0.1 * value)) # Start extruder
end
end
It can be seen that non-zero values correspond to extruder motor direction, as well as analog output. This function worked for interpreting extrusion values without any issues, until the software was updated.
Inserting this function into the first line of my program before sending it to the robot enables the "Extruder(value)" lines to be properly interpreted by the robot.
The problem that is arising is due to the generation of the program by the post processor, as it appears to change the value in the extruder lines to a string. This is evident, as the decimal has been converted from a float value to a string (ex: Extruder(5.00000) becomes Extruder(500000), which cannot be correctly interpreted by the system when running a program.
The online help forums recommend implementing the following function into the post processor:
Code:
def RunCode(self, code, is_function_call = False):
if is_function_call:
if code.startswith("Extruder("):
# Intercept the extruder command.
# if the program call is Extruder(123.56)
# we extract the number as a string
# and convert it to a number
self.PRINT_E_NEW = float(code[9:-1])
# Skip the program call generation
return
else:
self.addline(code + "()")
else:
# Output program code
self.addline(code)