Based on my interpretation of your scenario, my first approach would be the following:
Move to some set waypoint, let’s call it waypoint_1, near the box where your sensor is capable of determining the box orientation.
Assign a variable, let’s call it var_1, equal to a mathematic equation that will use your sensor input to determine the relationship between waypoint_1 and the box.
Define a pose, let’s call it box_pose, using info from var_1. So if you’re sensor and var_1 were helping determine a rotation, you would have box_pose := [0,0,0,0,0,var_1].
Assign another variable, we’ll call it box_point, using pose_trans() to transform waypoint_1 with box_pose. That would look like box_point := pose_trans(waypoint_1, box_pose).
Add a variable waypoint, and select box_point as the variable.
The resulting waypoint would be the original waypoint 1, with a rotation around the tool z axis equal to var_1.
You can also consolidate steps 2 and 3, and do the math right inside the pose list.
Hopefully this is helpful. Let me know if you were looking for something else.
I have tried it and I got the orientation but the x_offset and y_offset keep on changing every time the orientation of the box gets change.
How I can maintain the same offset with respect to the different orientations of the box?
I’m detecting the edges of the box with the sensor and based on that I’m calculating the offset.
When the box is not oriented, the x_offset and y_offset works fine but whenever the box orientation gets change then these offsets don’t work even though the tool is oriented correctly.
I’m using a photoelectric sensor (laser type) to detect the edges of the box.
I will tell you my application which I’m working on so the UR robot will be mounted on an AMR(autonomous mobile robot). The AMR will not come to the exact position every time because of it’s positional repeatability and orientation repeatability.
So I’m using this sensor to detect the box edges and based on that I’m getting the actual TCP value and based on the mathematical calculation I’m getting the orientation.
I’m only making the offset in the X-axis, Y-axis and I’m also doing some rotational changes based on the box orientation because if the box is at different orientation and if I don’t align the gripper properly then it will unable to pick up the box.
Can you please help me with this or can you suggest some other solution?