02-22-2023, 01:16 AM
(This post was last modified: 02-22-2023, 01:23 AM bydunderMethods.Edit Reason: Added images
)
Hi, I'm programming a UR10 to repeatedly move back and forth between targets A and B with a hexagon-shaped "tool" that has a picture on each of it's 6 sides. At target B there is a camera which will look at the picture. Every N cycles I want to rotate the tool to a different picture while it is at target A (out of the camera's view). After rotating the tool the robot repeats the cycle with the new picture.
The problem I am having is the tool always rotates to the desired image WHILE it moves to target B and rotates back to the first image WHILE it returns to target A.
Instead, I need it to:
Hopefully someone can help me understand what I am doing wrong here!
The problem I am having is the tool always rotates to the desired image WHILE it moves to target B and rotates back to the first image WHILE it returns to target A.
Instead, I need it to:
- Start at target A
- Rotate tool to the desired image
- 移动到目标B同时保持方向
- Return to target A while maintaining orientation
- 代表eat steps 3 and 4 N times
- Rotate tool to the next desired image (while at target A)
- 代表eat steps 3-6 until all images have been shown.
Code:
def set_picture(self, new_pic_idx):
""" Rotate the tool so that the given new_pic_idx is the picture that will be shown to the camera """
new_pic_angle = (new_pic_idx - 1) * -self.deg_per_idx # Calculate the new picture angle
new_pose= robomath.rotz(new_pic_angle * self.d2r) # Calculate the new pose (d2r converts deg to radians)
result = self.robot.setPoseTool(new_pose) # Move the robot to the new pose
self.current_pic_idx = new_pic_idx # Update the current picture index
self.robot.WaitMove(timeout=5000)
Hopefully someone can help me understand what I am doing wrong here!