Secondly, I also assume that you will use pick-and-place equipment to take a workpiece from a conveyor, put it in a changeable position, and make sure that the workpiece is at a certain angle (it must be upright and the up-and-down direction is correct, which is the business of the upstream conveyor), and then send a signal to the manipulator to move it to the downstream equipment for further assembly.
With the above premise, I can suggest a way. This is a transparent and rotatable platform, which can accommodate your workpiece. After the manipulator puts down the workpiece, it sends a signal to this equipment. There is a detection lamp at the bottom to project the outline of the workpiece onto it, which can also refract 90 degrees. Two photoelectric sensors are used to detect flat edges. If the angle is wrong, both sensors will light up. If you reach the edge, whether it is clockwise or counterclockwise, you will block one first, and then turn a few times to get the desired angle. Stepper motor is most suitable for platform.
I hope to provide some inspiration, welcome questions and learn together.