12-06-2023, 01:06 PM
I'm currently attempting to make a python script that moves a conveyor a certain step size. I'm sure it can be done in a multitude of ways, however my idea is to create a target, and simply move the conveyor to it.
I'm running into a problem where I can add the target, and move it to the appropriate position, however when moving to it, the conveyor does not move. Through testing, I've found that manually moving the generated target an arbitrary distance, fixes the entire error.
Am I doing something wrong, or is this simply a limitation of the API?
The code in question:
#------------------
# Initial variables
STEP_SIZE = 300 #mm
#------------------
# Connect to the conveyor
conveyor_frame = RDK.Item('Conveyor_Frame')
conveyor_belt = RDK.Item('Conveyor Belt')
#------------------
# Create a target for the conveyor
target = RDK.AddTarget('Conv_Target', conveyor_belt.Parent(), conveyor_belt)
target.setAsJointTarget()
# Alternative: Reuse target, and move
curr_pos = conveyor_belt.Pose() # Get the current position of the conveyor
target.setPose(Pose(STEP_SIZE,0,0,0,0,0) * curr_pos)
#------------------
# Move the conveyor to the target
conveyor_belt.MoveL(target)
#------------------
# Delete the target
target.Delete()
I'm running into a problem where I can add the target, and move it to the appropriate position, however when moving to it, the conveyor does not move. Through testing, I've found that manually moving the generated target an arbitrary distance, fixes the entire error.
Am I doing something wrong, or is this simply a limitation of the API?
The code in question:
#------------------
# Initial variables
STEP_SIZE = 300 #mm
#------------------
# Connect to the conveyor
conveyor_frame = RDK.Item('Conveyor_Frame')
conveyor_belt = RDK.Item('Conveyor Belt')
#------------------
# Create a target for the conveyor
target = RDK.AddTarget('Conv_Target', conveyor_belt.Parent(), conveyor_belt)
target.setAsJointTarget()
# Alternative: Reuse target, and move
curr_pos = conveyor_belt.Pose() # Get the current position of the conveyor
target.setPose(Pose(STEP_SIZE,0,0,0,0,0) * curr_pos)
#------------------
# Move the conveyor to the target
conveyor_belt.MoveL(target)
#------------------
# Delete the target
target.Delete()