Move between two targets and maintain tool orientation- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: Move between two targets and maintain tool orientation (/Thread-Move-between-two-targets-and-maintain-tool-orientation) |
Move between two targets and maintain tool orientation-dunderMethods-02-22-2023 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:
Code:
def set_picture(self, new_pic_idx):
Hopefully someone can help me understand what I am doing wrong here! RE: Move between two targets and maintain tool orientation-Albert-02-22-2023 setPoseTool is not a command that will provoke a robot movement. This function only updates the Tool (TCP) in RoboDK and the real robot if you are connected with the driver. You should move the robot using a MoveJ or a MoveL command. Example:
Code:
...
RE: Move between two targets and maintain tool orientation-dunderMethods-02-22-2023 Thanks for the reply! I've updated my code and here's where I am at now: The tool instantly rotates to the selected image when I call set_picture(pic_idx) from python (jupyter), great! Any time I use set_picture to rotate the tool 180deg in one move (moving from picture 1 -> 4 for example) the robot goes crazy and tries to twist itself into a pretzel. I can make incremental moves (1 -> 3 -> 5) that when summed exceed 180 just fine; or if I go 1 -> 6 it turns the opposite direction with no issues. I even tried adding some logic to add or subtract 1deg if the new angles is abs(180) resulting in -179deg or 179deg and this still causes the robot to go crazy. What am I doing wrong here? Here is the updated code:
Code:
self.deg_per_idx = 360/6 # Divide 360deg by the 6 sides of the hexagon
RE: Move between two targets and maintain tool orientation-dunderMethods-02-24-2023 I decided to break the single 180deg rotation into two 90deg rotations which does work without the robot going off the rails. It's not ideal because it pauses half way through the rotation but that won't interfere with my testing so I'll just use it this way. RE: Move between two targets and maintain tool orientation-dunderMethods-02-24-2023 Here is my new code. It gives me the results I want! But it seems overly complicated. I'm rotating the tool then modifying the TCP so that it aligns with the picture I want to show and the camera target. I'm open to suggestions for a more elegant way to do this - or let me know if this is actually the right way.
Code:
def set_picture(self, new_pic_idx):
|