Drake · robotics

On this page 7

Drake is an open-source toolbox for model-based design in robotics that combines a multibody dynamics engine, a systems modeling framework and a mathematical optimization layer in one C++ library with Python bindings. In simulation, it stands out because it treats a robot model as a set of equations that can be simulated, differentiated and optimized, rather than only as a scene that is stepped forward in time.

The project began in the robot locomotion group at MIT and has been developed for years with major support from the Toyota Research Institute. It is released under the BSD 3-Clause license and is used mainly for manipulation research, trajectory optimization and controller verification, where physical accuracy and analytical structure matter more than rendering speed.

How Drake structures a robot model

Drake builds every model as a diagram of connected systems. Each LeafSystem declares its state, parameters, input ports and output ports, and a DiagramBuilder wires these blocks together into a hierarchical Diagram, much like a block diagram in control engineering.

The physical robot lives inside a MultibodyPlant, which holds rigid bodies, joints, actuators and force elements and computes mass matrices, Jacobians and contact forces. Geometry is managed by a separate SceneGraph that answers collision, distance and rendering queries. A Simulator object then advances the whole diagram with a chosen integrator or discrete time step. The table below summarizes the core building blocks.

ComponentRoleTypical use
MultibodyPlantRigid-body dynamics and contact forcesArms, grippers, legged robots
SceneGraphGeometry, collision and rendering queriesContact detection, camera images
Systems frameworkPorts, state and diagram compositionControllers, sensors, estimators
MathematicalProgramUnified interface to numerical solversInverse kinematics, planning
Meshcat visualizerBrowser-based 3D displayDebugging and presentations
Main components of the Drake toolbox

Robot descriptions are loaded from URDF and SDFormat files, with partial support for MJCF. Drake also defines a few custom tags, for example for hydroelastic properties, which other simulators ignore.

Contact models and time stepping in Drake

Contact dynamics is where Drake invests most of its engineering effort. It offers a classical point contact model with compliant penalty forces and a hydroelastic contact model, which computes a pressure field over the contact patch instead of a single point, giving smoother and more realistic forces for grasped objects and feet on the ground.

The MultibodyPlant can run in continuous mode, where error-controlled integrators such as Runge-Kutta 3 or implicit Euler choose the step size, or in discrete mode with a fixed period, often 1 ms. The discrete solvers are the most widely used for manipulation because they remain stable with stiff contact. The following table compares the main options.

OptionStrengthLimitation
Point contactFast and simple to configureForce jumps on flat surfaces
Hydroelastic contactContinuous pressure over patchesNeeds tuned modulus and meshes
TAMSI solverRobust with regularized frictionOlder; small stiction drift
SAP solverConvex formulation, stable with stiff contactHigher cost per step
Continuous integrationAccuracy control by error toleranceSlow with many contacts
Contact and stepping options compared

The Semi-Analytic Primal (SAP) solver formulates each contact step as a convex optimization problem, which guarantees a unique solution and avoids the jitter seen in many game-style engines. The price is that Drake usually runs slower than real time for complex scenes, so its real-time factor is rarely its selling point.

Optimization and analysis tools beyond simulation

Drake is equally a planning and control toolbox. Its MathematicalProgram class lets users declare decision variables, costs and constraints once and send them to solvers such as SNOPT, IPOPT, Gurobi, MOSEK, OSQP or Clp, depending on whether the problem is nonlinear, quadratic, mixed-integer or conic.

Because every system can be evaluated with automatic differentiation (the AutoDiffXd scalar type) or symbolic expressions, the same robot model used in simulation can feed gradients to an optimizer. This shared model removes the mismatch between planning and simulation models that troubles many robotics pipelines.

CapabilityProblem typeExample application
Inverse kinematicsNonlinear programReaching a grasp pose
Direct collocationTrajectory optimizationSwing-up of an underactuated arm
Graphs of convex setsMixed-integer convex planningCollision-free motion in clutter
Sum-of-squares programmingSemidefinite programLyapunov stability certificates
Linearization and LQRLinear control designBalancing a stabilized pose
Optimization capabilities and their applications

The graphs of convex sets (GCS) framework, developed largely within the Drake community, decomposes free space into convex regions and finds globally informed, collision-free paths with a convex relaxation, an approach that has become influential in motion planning research.

Drake compared with other robot simulators

Drake occupies a distinct niche among robot simulators. Gazebo and Webots focus on full-system simulation with sensors and middleware, MuJoCo emphasizes fast, smooth contact for learning, and Isaac Sim offers GPU-parallel physics with photorealistic rendering. Drake prioritizes physical rigor and mathematical access to the model.

SimulatorPrimary focusBest suited for
DrakeAccurate contact and optimizationManipulation, planning, verification
MuJoCoFast smooth dynamicsReinforcement learning, control
GazeboSystem integration with ROSFull robot software testing
Isaac SimGPU physics and renderingLarge-scale synthetic data
PyBulletSimple scripting interfaceQuick prototypes and teaching
Positioning of Drake among common simulators

The practical consequence is that Drake is rarely chosen for massive parallel training, but it is a strong choice when a team needs to trust contact forces, differentiate through dynamics or prove properties of a controller.

Practical use, limitations and common mistakes

Drake is installed through pip as the pydrake package, through binary releases or by building from source with Bazel or CMake. Most new users work in Python notebooks, while production code and performance-critical systems are written in C++. The learning curve is steep for users without control theory, because the systems framework expects explicit ports, contexts and state declarations.

  • Forgetting to call Finalize on the MultibodyPlant before connecting ports leads to immediate runtime errors.
  • Mixing up the Context and the System: parameters and state live in the Context, not in the System object.
  • Using coarse collision meshes with hydroelastic contact produces unrealistic pressure fields; compliant hulls need suitable resolution.
  • Expecting real-time performance in cluttered scenes; dense contact problems often run at a fraction of real time.
  • Relying on unsupported URDF extensions from other ecosystems, such as Gazebo plugins, which Drake does not execute.

Its documentation is thorough at the API level but assumes familiarity with dynamics. Many practitioners learn it through the openly available MIT courses on underactuated robotics and robotic manipulation, which use Drake for every exercise.

Put simply

Drake is a free software toolkit that lets engineers build a virtual copy of a robot and test it on a computer before touching real hardware. It calculates how the robot moves, how it touches objects and how much force each contact produces.

What makes Drake special is that it does not only play the simulation like a video. It also lets engineers ask mathematical questions about the robot, such as which arm motion is the shortest safe path or whether a controller will keep the robot stable. Think of it as a physics laboratory and a calculator in one.

In practice

A research team developing a robot that loads dishes into a dishwasher uses Drake to model a seven-axis arm with a parallel gripper, a sink and several plates. The plates use hydroelastic contact, so the simulated gripper feels a realistic pressure distribution when it pinches a thin rim, and the plant runs in discrete mode with a 1 ms step and the SAP solver.

The team plans each reach with kinematic trajectory optimization and routes the arm around the sink edge with graphs of convex sets. Before any hardware trial, they run several thousand simulated grasps with randomized plate positions. Grasps that slip in simulation are traced to an overly narrow finger opening, which the team widens. The result is a noticeably higher grasp success rate on the first hardware tests and fewer broken plates during development.