How can I avoid extreme slowdowns in Simscape Multibody when a robot with spatial contact forces comes to a stop?

14 Ansichten (letzte 30 Tage)
Hello everyone,
I am currently working on a mobile robot in Simscape Multibody that moves on a static floor using four wheels. The interaction between wheels and ground is done via the block “Spatial Contact Force”.
As long as the robot is moving, the simulation runs with high performance (e.g. 20 s simulation time in under a minute).
However, as soon as the robot comes to a standstill (i.e. the speed approaches zero), the simulation becomes extremely slow.
The solver step size drops massively - in some cases to less than 1e-16 - and the calculation of just 2-3 seconds of physical time can take over an hour.
Previous attempts:
I have already adjusted the parameters of the Spatial Contact Force in several variants:
  • Stiffness reduced (e.g. from 1e6 to 1e5)
  • Damping reduced (e.g. from 1e4 to 1e3)
However, a further reduction in stiffness causes the wheels to sink into the ground, which is physically unacceptable.
Alternatively, I wanted to lock the wheels when stationary by activating the “Mode: Provided by Input” option in the Revolute Joint and switching to “Locked” (value = 1) via a signal as soon as the angular velocity is almost zero. At least that was the plan. Unfortunately, this doesn't work as intended in practice: As soon as I set the mode to “Provided by Input”, my robot is no longer transformed to its intended starting position when the simulation starts, but remains at the origin.
I'm slowly running out of ideas...
Here are a few pictures of the model:
revolute joint:
spatial contact forces:
Solver:
Solver Profiler:

Antworten (1)

Yifeng Tang
Yifeng Tang am 31 Jul. 2025
Some suggestions:
In solver profiler, look at tab showing which blocks are causing the solver exceptions, and check if it's indeed the contact block that are causing the small time-steps. It's very likely to be the case, but still worth confirming.
My not-so-scientific-but-pragmatic method tuning the contact parameters:
  1. start with the stiffness: make it large enough to stop the motion within a reasonable distance or time. This is what you are doing now by avoiding the wheels sinking into the ground. At the same time, I won't make it too large either, as a high stiffness also tends to incur high natural frequency, which likely leads to smaller time-steps to resolve it. Depending on the application and dimensions of the mechanism, I target for 0.1-1 mm range (pretty arbitrary though). If it's something more compliant like tires, I will allow more deformation. Note I'm talking about the deformation amount observed from the simulation results, not the “Transition Region Width" parameter in the block.
  2. Next, the damping. The goal is to make the mechanism not oscillate like crazy. Make it large enough so it's near or a bit more than critical damping. I usually first look for a value that gives me a typical underdamped behavior, get it to oscilate only a couple of time before settling, and then make the damping a few time greater than that. This way I ends up with something that will stop the motion fast enough but also not super bouncy.
Give a try. Hope this helps.

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by