Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Moving a conveyor stepwise using python

#1
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()
#2
You should use target.setJoints() and conveyor_belt.MoveJ() instead.
You can skip creating a target altogether, by calling conveyor_belt.MoveJ(conveyor_belt.Joints().tolist() + STEP_SIZE)

You can find existing examples of conveyors in our online library:
https://robodk.com/stations#filter?appli...eature=api
Please read the Forum Guidelines before posting!
Find useful information about RoboDK by visiting our Online Documentation.
  




Users browsing this thread:
1 Guest(s)