Detect orientation of workpiece during movement of end effector