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

How do I calculate new targets as offset from one original target?

#1
Hello! I have a RoboDK simulation with a Kuka robot where I taught one target in a frame. I want to generate a list of new targets that are calculated offsets from that single target inside that same frame.

Basically, I have a stack of items in a box and I want to calculate pick points and approach points for all those items. I'd like to create targets that are all calculated offset from the one taught target that I made.

What would be the best way to do this? I've been trying to access the data from the target I created in the simulator so I can just apply offsets in the X,Y, and Z directions, but the Item data type doesn't allow me to do that.

Any advice would be greatly appreciated!
#2
You can retrieve the XYZ values of your target from the pose position (Pos function).

Example in Python code:
Code:
pose = target.Pose()
x, y, z = pose.Pos()
new_xyz = [x, y, z+10]
pose.setPose(new_xyz)
target.setPose(pose)

Or even better, you can offset your target by pre-multiplying the target pose by your translation pose if you want to apply the offset with respect to your coordinate system.

Example in Python code:
Code:
target.setPose( transl(0,0,10) * target.Pose() )

Also, if you post-multiply the target pose you'll be applying an offset with respect to the tool (TCP):
Code:
target.setPose( target.Pose() *  transl(0,0,10) )
  




Users browsing this thread:
1 Guest(s)