RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.19k stars 1.24k forks source link

Exceptions with improved error messages in SapSolver #21470

Closed amcastro-tri closed 1 month ago

amcastro-tri commented 1 month ago

We replace DRAKE_DEMANDs with exceptions, with a more informative error messasge to users.


This change is Reviewable

jwnimmer-tri commented 1 month ago

BTW I just noticed a related typo during unrelated profiling, in case you want to toss it in here:

This code in sap_driver.cc:

  if (status != SapSolverStatus::kSuccess) {
    const std::string msg = fmt::format(
        "The SAP solver failed to converge at simulation time = {}. "

Some numbered list elements in the error text have newline (\n) but some are missing, so the error will be smooshed.