Inverse dynamics from URDF files.
Generate real-time optimized MPC controllers for precise end-effector trajectory tracking from URDF files.
Disclaimer
This is part of a larger project, the code of which I maintain in a monorepo which also includes modified versions of non-freely distributable URDF files and other resources. This currently prevents me from making the code public. I will eventually split up the project so that all parts described here are available as FOSS. If you're interested in this project, please contact me.Preliminaries
This is a continuation of a previous article in which I described how I am able to obtain state-feeback linearization from URDF files.A neat fact about the resulting system, that I failed to mention in that article, is that the setup enables us to exactly follow certain joint-space trajectories. This is cool, but there are some caveats:
- The trajectory must be in (no jumps in position, velocity, acceleration)
- We need to exactly know the first two derivatives — numerical differentiation may lead to instability!
- It's in joint space, so not that useful for practical tasks
(1)
Goal
My short term goal is to make the robotic arm shown in move the tip of the pencil along a desired trajectory, while keeping the pencil normal to the drawing surface.A quick and easy solution would be to employ some sort of inverse kinematics solver to compute joint-space positions for the desired positions of the pencil tip. This works and is used in the industry. I know for a fact that this has been done for sorting robots at Amazon facilities. When throughput needed to be increased, the arm started flinging packages around because it could no longer follow the trajectories sufficiently well. We can do better.In the beginning, I mentioned that we can guarantee precise following for certain joint-space trajectories. All we need is a way to obtain one of these trajectories. Take a look at the following system with :
(2)
Generating the solver
As before, I wrote a script which generates a solver for this type of system. It is relatively flexible, allowing for the user to tackle all sorts of end-effector tracking problems.python -m nlc_code_gen.models.id_nmpc \ --root-link="base" \ --actuated-joints="arm_sh0 arm_sh1 arm_el0 arm_el1 arm_wr0" \ --end-effectors="pen_tip" \ --reference-type="position+heading" \ --heading-axis="0 0 1" \ --control-type="jerk" \ --horizon-seconds="1.0" \ --shooting-intervals="25" \ --urdf="$(xacro ./urdf/standalone_arm.urdf.xacro)" \ --output="./lib/drawing_bot_id.so"
(3)