Clear Filters
Clear Filters

Drift in simMechanics forward dynamics solver(with link to example model)

2 views (last 30 days)
I didn't know how to bump the old question and add this link...so I re-asked, sorry.
Link to a model with this problem:
I have boiled this down to the following simple example:
Say you were trying to model a plank not attached to the ground in SimMechanics (for a simple 2-D case). You would need a body with two joints attached to ground, one at -Rarm from the center of gravity, one at +Rarm from the center of gravity. These joints would need 1 prismatic DOF(allowing the up and down motion) and 1 rotational DOF (allowing their relative angles to change.
If you apply the same upward force to each side, (essentially pushing up on both sides of the plank with the same force) you would expect the entire body to move upward without rotation. However, when I attempt this, not only do I get the expected upward motion, I also get a very slight rotation.
If I put a body sensor on it, the angular accel looks like numerical noise around 0... the angular rate looks like a ramp and the angle looks parabolic. I assume someone is going to say something like--once you double integrate the error in angular acceleration your angle drift is pretty bad. But why is there any error at all if the forces are exactly the same at exactly the same distances away?

Accepted Answer

Arnaud Miege
Arnaud Miege on 24 May 2011
Looking at the model, it seems to be doing exactly what's expected. Change the stop time to 10s, max step size to 0.01s (you might want to turn off the visualization), and demux each of the 3 outputs coming out of your body sensor block to plot them on 3 scopes with 3 axes each.
You'll see that the z displacement (third signal of the first output) increases to about 8e5 m, while the y stays at 0 and the x as well (approximately, around -8e-18m max, that's just numerical error).
Similarly, the angular velocity only shows a non zero in the rotation around the y axis, with a max of -1e-6 rad/s. Again, just numerical error. The angular acceleration also shows a non zero component only in the y direction with a max of approx. -4e-7 rad/s^2, again numerical error.
BTW, your AbsTol and RelTol are very small. Setting them to 1e-4 and 1e-3 respectively should be more than enough.
HTH,
Arnaud
  7 Comments
Arnaud Miege
Arnaud Miege on 26 May 2011
Not sure what else to suggest. Adding some control over the revolute joint will definitely help (I think) or in the short term, adding a stiff joint spring & damper to restrict the rotation. With regards to your problem, did you have a look at the Stewart platform demo models that ship with SimMechanics? It's not exactly what you're doing, but is fairly similar. See for example mech_stewart_trajectory.mdl.
Matt Anderson
Matt Anderson on 1 Jun 2011
yes, the Stewart platform is very close to my system...thanks for your help.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!