I want my robot manipulator to follow a user-defined path. Based on the waypoints given as input and the velocity and acceleration limits of the joint motors, I generate a trajectory. At every time step (say 2ms), I send the joint motor controller the reference position, velocity and acceleration. But my robot's joint motors are not able to keep up with the reference command. How can I update my generated trajectory, so as to ensure the robot moves along the user-defined path? Thanks!
In practice, you don't specify a dense trajectory for the arm necessarily
Instead, you should move the arm between "safe" positions before it moves to the point where it interacts with parts. Most robotic arms are designed to be controlled in this way. If you are trying to control the exact path of the end effector, then you are trying to do essentially velocity control, which requires force-torque control of the arm (usually). That's a harder optimization problem and still requires a good model as described below.
But trajectory control is more fun
We can add a lot of similar situations to this: What if I'm slightly wrong about the model of how the manipulator moves between waypoints, and the trajectory is not follow-able? Or what if the world changes slightly and my trajectory is now invalid? etc, etc.
At a very low technical level, you should change the time step in your trajectory planning to accommodate motions the arm can actually follow. This means allowing sufficient dwell time at each waypoint to ensure the arm can arrive at the points. For "dense" trajectories with lots of waypoints, this is hard. Without a near-perfect model of how the arm converges to a point, how can you predict how long it will take to reach a point when planning a trajectory?
Usually, at the highest level, you can just replan the trajectory based on the current state of the world. Then, you issue the "next" waypoint as the carrot for the arm to follow. This is called receding horizon control, which is a common way to implement model-predictive control