Comments on CHRONO example PID_control.r3d
Test PID javascript object.
  What to do: load the file and press the play button on the animation timeline (watch at least 3 seconds of simulation).
Also, you may want to see and edit chrono/javascript/PID_controlled/forStep.js and chrono/javascript/PID_controlled/forStep.js scripts.

This pretty simple example shows an upper cube which is moving with an 'exact' motion law (imposed by the linear actuator), and a lower cube which tries to 'chase' the upper cube thank to a controlled force, acting along the linear guide.

This is an interesting application of Javascript. In fact the strength of the controlling force is based on the simulation of feedback digital controllers (digital PIDs, Proportional Integrative Derivative controllers). Here, a PID object is created as a Javascript object (internal PID theory is already managed by this custom Chrono object), then for each simulation step, this PID is feed with the error (the distance between upper and lower cubes) and it outputs the correcting value to be used as force strength.

See the script chrono/javascript/PID_controlled/forStep.js to understand what is done each step. Also, note that PID constants (stiffness of control, etc.) are set in the script file chrono/javascript/PID_controlled/forStep.js

These two scripts are executed automatically, because in the hierarchy of the system there is a 'controls' object which reference their filename.


© DeltaKnowledge 2007