How-to
Grasped object conveyor alignment: choose the signed quarter-turn
Short answer
Resolve the grasped object's alignment direction and the conveyor travel direction into one frame and compute the signed correction atan2(n·(u×v), u·v). Command -90 or +90 degrees only when the incoming orientations truly span those two cases; otherwise command the computed angle or reject the pose. Rotate the tool through the grasp relationship, never the object's model alone.

On this page
A fixed quarter-turn written into the placement point cannot serve parts that arrive in random orientations. The correction must be computed at the pick: resolve the grasped part's alignment direction and the conveyor travel direction into one frame, then take the signed planar angle between them as atan2(n·(u×v), u·v). Snap that result to a quarter-turn only when the infeed truly presents just those two cases; at any other arrival angle the same formula returns the true correction, which is what lets you place the part right or reject the pose instead of guessing.
This article walks the frame setup, the arithmetic and the binding of the result to the placement move. The decision sits at the pick, one of the items a conveyor tracking retrofit needs beyond an encoder.
Decide what must point along the belt #
Choose one direction on the part that must end up parallel to the belt — for a rod or a profile, the long axis. Call it u, defined in the part's own coordinate frame, so it stays a property of the part rather than of the pick. Then settle two things before any math:
- Interchangeable ends. Either longitudinal direction is acceptable once it lies along the belt, reversed included; both signs of quarter-turn qualify.
- Required leading end. One particular end must face downstream. Define u from the leading end and v as the downstream travel direction, and the formula has exactly one right answer instead of two.
Set the acceptance band at the same time — for example 5 degrees of residual skew, if that is what your downstream process tolerates. That figure is an example: take the band from your own placement requirement, not from this article. And do not read the requirement off the part's outline; a symmetric-looking part can still carry a process-side leading end, and an outline-based rule will pass a part the process cannot use.
Put both directions in one frame #
You need three vectors in one frame, read after the grasp relationship exists:
- u, the part's alignment direction in the shared frame. Take the alignment axis defined in the part frame and rotate it with the rotational part of the grasped instance's pose. Read the actual attached instance — a template part or the previous pick tells you nothing about this grasp.
- v, the unit conveyor travel direction. Take it from the taught conveyor frame rather than a layout drawing: teaching conveyor tracking targets at the conveyor base frame is where the tracking system captures that direction, and the same frame serves this calculation.
- n, the unit normal of the placement plane in that same frame. For a horizontal belt the normal is vertical, pointing up out of the placed part. Positive rotation follows the right-hand rule about n, the convention ISO 9787 uses for robot coordinate systems and motion nomenclature.
Normalize u and v to unit length so the dot product below is a true cosine.
Compute the signed correction #
With u and v unit vectors in the placement plane and n the unit normal, the signed correction that carries u onto v is:
θ = atan2(n · (u × v), u · v)
The two-argument arctangent is defined as the angle from the positive x-axis to the point (x, y), and it spans the full circle from -180° to +180°. Here that means θ is always the shortest signed rotation about n, positive counterclockwise seen from the tip of n. Reverse the direction of n and only the sign of θ reverses. Most math libraries and controllers return radians; convert if your motion interface takes degrees.
When is a two-choice command legal? When the infeed genuinely presents parts only crosswise — the long axis standing at +90° or -90° to the belt — θ comes out on exactly those two values, and snapping is correct. Any other allowed arrival angle, and the snapped command is wrong by the gap between the true correction and the quarter-turn; command θ itself instead.
Worked example — calculated for these inputs, not a measured result. Base frame: x downstream along the belt, y across it, z up, so n = (0, 0, 1) and v = (1, 0, 0).
Grasp A — part lying across the belt, alignment axis toward +y, u = (0, 1, 0):
- u × v = (1·0 − 0·0, 0·1 − 0·0, 0·0 − 1·1) = (0, 0, -1)
- n · (u × v) = -1, u · v = 0
- θ = atan2(-1, 0) = -90°, a clockwise quarter-turn seen from above
Grasp B — the mirrored arrival, u = (0, -1, 0):
- u × v = (0·0 − 0·0, 0·1 − 0·0, 0·0 − (-1)·1) = (0, 0, 1)
- n · (u × v) = +1, u · v = 0
- θ = atan2(+1, 0) = +90°
The same formula on a part that arrived 30 degrees crosswise, u = (0.866, 0.5, 0): u × v = (0, 0, -0.5), so the cross term is -0.5 and the dot term 0.866, giving θ = atan2(-0.5, 0.866) = -30°. Snap that arrival to a quarter-turn and the part lands 60 degrees off the belt — the failure the acceptance band exists to catch.
Bind the rotation to the placement move #
Rotate the part by moving the tool through the grasp. Rotating the part's own model or graphic independently makes the scene look right while the commanded pose never moves. The sequence that works:
- At the grasp instant, store the grasp transform g: the attached part's pose expressed relative to the tool. Attachment changes how a pose is reported, so read it from the attached instance itself.
- Express u in the shared frame by rotating the part-frame axis with the rotational part of g.
- Compute θ = atan2(n·(u×v), u·v). Snap to the nearer quarter-turn only when θ lies inside the acceptance band around the two crosswise values; command θ as computed otherwise; reject the pose when the arrival is outside the permitted set.
- Build the desired placed pose for the part: the placement point unchanged, the orientation carrying u onto v.
- Compose the commanded tool pose as the placed pose multiplied by the inverse of g. With an off-center grip this is what keeps the placement point fixed — rotating the tool about its own TCP instead would swing the part around the grip.
- Run the placement move to the composed pose with the part attached, and release only at the completed pose.
If θ flips between two picks but the commanded tool orientation does not, the fault sits in the binding between the calculation and the motion target, not in the orientation measurement — chase the value from the formula into the target before suspecting the vision or the gripper.
Prove it on two picks before cycling #
Pick one part lying each of the two allowed ways: θ must flip sign between them while v stays fixed, and the placed part's measured skew against the belt must sit inside the acceptance band. In simulation, feed a third part at a deliberately different yaw and confirm θ returns that yaw's correction rather than a snapped value.
One safety note: a quarter-turn with a gripped part sweeps the gripper through a wide envelope, so verify the composed placement pose clear of fixtures, cable chains and people against the cell's risk assessment before running it under power. Once the orientation decision is proven, whether the tracking follows the belt's changing speed afterwards is the separate encoder-side question of what limits counts per meter in robot conveyor tracking.
The decision, case by case #
- Crosswise arrivals, interchangeable ends: snap θ to the nearer quarter-turn; either sign qualifies when both land inside the band.
- Crosswise arrivals, required leading end: define u from the leading end and v downstream, then command the single angle the formula returns — there is no snapping choice left to make.
- Arbitrary yaw arrivals: command θ itself; the snapped command is wrong by the gap between the true correction and the quarter-turn, as the 30-degree example shows.
- Part lying backwards along the belt: with u = (-1, 0, 0), the cross term is 0 and u · v = -1, so θ = atan2(0, -1) = 180°. Interchangeable ends: place it as it lies, no rotation commanded. Required leading end: outside the permitted set — reject the pose or re-orient the part upstream of the pick.
- Part tilted out of the placement plane: the planar correction does not level it; solve the full three-dimensional orientation or reject the pose.
Questions asked
Does the atan2 result come back in degrees or radians?
In radians almost everywhere: math libraries and most robot controllers. If your motion interface takes degrees, multiply by 180 and divide by pi, which is about 57.2958 degrees per radian. Check which unit the orientation inputs of your controller expect before writing the value into a target, because a radian value dropped into a degree field misses by a factor of about 57.
Why does my correction come out with the opposite sign?
The sign follows n, the normal you chose. If n points the other way, for example the downward tool axis where the plane normal points up, positive and negative rotation swap. Express u, v and n in one right-handed frame and take positive rotation by the right-hand rule about n; the sign is then fixed by the geometry, and no setting can quietly flip it.
Which frame should the vectors live in?
Whichever single frame both poses are already available in; the robot base frame is the usual choice. The taught conveyor frame also works and has an advantage: if the conveyor is later rotated in the layout, a calculation expressed in that frame is unchanged. What never works is mixing frames, such as a part direction from the part's own frame against a belt direction from the world frame.
Does the quarter-turn also level a part that arrives tilted?
No. The formula corrects rotation about the placement-plane normal only. A part tilted about a horizontal axis keeps that tilt through the quarter-turn and reaches the belt still leaned over. If the process needs the part level before placement, treat the task as a full three-dimensional orientation problem: compute the complete rotation from the grasped pose to the required placed pose instead of one signed planar angle.

