How is real time control normally handled? Do you run a separate motor control unit which has its own RTOS or is there some other way?
$\begingroup$ Welcome to Robotics, but I'm afraid that it is not clear what you are asking. We prefer practical, answerable questions based on actual problems that you face, so it's a good idea to include details of what you want to understand, what you've researched so far, what you found & what you expected to find. Please take a look at How to Ask & tour for more information on how stack exchange works and work through the Robotics question checklist to edit your question to make it clearer. $\endgroup$– Ben ♦Jul 22, 2020 at 17:37
The key elements to real-time motor control is the motor controller and the motion controller (which can be a CNC, a robot controller or other type of controller). The following description fits most modern industrial control systems in use today where precise motions down to the 10-50 micrometer range can be archived.
The motor controller usually is not x86/x64 based. It is usually some kind of DSP (or microcontroller or FPGA). It might use some very simple OS (with hard real-time constraints), but it can also just be bare metal. This device has a cascaded closed loop controls for controlling torque (current), velocity and position. It has an "amplifier" stage (e.g. H-bridge or a "triple H-bridge" for 3 phase motors) for supplying the motors and usually it also has encoder inputs. The control loop cycle time on this device is a key feature. the Torque controller has the highest frequency and the position controller (the outermost loop) has cycle time close o a millisecond (up to 4 ms is still practised).
The motor controller receives setpoints (or reference values) from the motion controller. Furthermore it can also receive feed forward offsets for the velocity and torque control loops. The motion controller has a RTOS (e.g. VxWorks) and its main role is to plan the trajectories based on some application program (e.g. G-Code for CNC machines) and cyclically send setpoints to the motor controller with a cycletime in the milliseconds range. The motion controller communicates with the drive amplifier via a real-time bus system (e.g. CanOpen, ProfiNet).