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

Python example to update robot targets

#1
Hello everyone , I m facing a problem ... I want to make a programm which asks the User the places where he wants the ROBOT to visit via a message box. So far I've made the message box and all the things that i want the robot to do , but I don't know the command which sets the Target manually  .Does anyone have a clue ?
#2
What do you mean by setting the Target manually?

You can move the target by using setPose.
#3
I want the User to control the robot without using the set target method that we normally use to set targets. For example while running the python script a message box will ask you how many targets you want to have and where are it should go next? So you will insert the the next target (X,Y,Z Values).Can thiss "setPose" command do that?
#4
Yes, you can create targets by using AddTarget. Then, you can use setPos on a pose to update the XYZ position of the target pose. Finally, you should use setPose to update the pose on the target in your project.

I recommend you to take a look at this example:
https://robodk.com/doc/en/PythonAPI/exam...to-program

And more precisely this section:
Code:
# Retrieve the reference target:
pose_ref = home_target.Pose()

# Iterate through all the points
for i in range(len(POINTS)):
    # add a new target and keep the reference to it
    ti = RDK.AddTarget('Target %i' % (i + 1))

    # use the reference pose and update the XYZ position
    pose_i = pose_ref
    pose_i.setPos(POINTS[i])
    ti.setPose(pose_i)

    # force to use the target as a Cartesian target
    ti.setAsCartesianTarget()

    # Optionally, add the target as a Linear/Joint move in the new program
    prog.MoveL(ti)
  




Users browsing this thread:
2 Guest(s)