dair_pll.drake_system
Interface with Drake MultibodyPlant simulation.
Interfacing with Drake is done by massaging a drake system into the
System interface defined in system.py with a new inheriting type,
DrakeSystem.
A large portion of the internal implementation of DrakeSystem is contained
in MultibodyPlantDiagram in drake_utils.py.
- class dair_pll.drake_system.DrakeSystem(urdfs, dt, visualization_file=None)[source]
Bases:
SystemSystemwrapper of a Drake simulation environment for aMultibodyPlant.Drake simulation is constructed as a
Simulatorof aDiagramin a memberMultibodyPlantDiagramvariable. States are converted betweenStateSpaceand Drake formats viaDrakeStateConverter.Inits
DrakeSystemwith provided model URDFs.- Parameters:
-
plant_diagram:
dair_pll.drake_utils.MultibodyPlantDiagram
-
urdfs:
typing.Dict[str,str]
- preprocess_initial_condition(x_0, carry_0)[source]
Preprocesses initial condition state sequence into single state initial condition for integration.
- get_quantized_start_time(start_time)[source]
Get phase-aligned start time for Drake
Simulator.As Drake models time stepping as events in a continuous time domain, some special care must be taken to ensure each call to
DrakeSystem.step()triggers one update. This is done by offsetting the simulation duration to advance toN * dt + dt/4to prevent accidentally taking 2 or 0 steps with a call tostep().