diagramis, we could look at how Matlab Simulink works. Matlab Simulink is a simulation tool. Simulink's main graph is composed of connected systems. A complex system can host multiple subsystems. All these subsystems connect in some way to form the entire system.
diagramis the main graph of Drake.
diagramis composed of systems like
MultibodyPlant, controllers and other useful blocks. Like Simulink, the
diagramdetermines how the system is constructed, what each block is, and how they are connected. Drake has a
DiagramBuilderclass to help glue the system blocks together. It adds system blocks into the
diagramand connects input and output ports of blocks together.
diagram. This system is called
MultibodyPlantis a huge class containing all the parameters and data related to the robots.
SceneGraphis the visualization and collision checking tool.
SceneGraphis initiated and connected to
SceneGraphwould give the information of whether two objects collide and what is the distance between two objects, given the state input from
MultibodyPlant. Then the
MultibodyPlantdecides whether the collision is a soft contact or a fierce crash, how much force is generated in between objects given the collision information.
MultibodyPlantshould be registered to the
SceneGraphwould then send rendering message to another process called
drake_visualizerwould handle the rendering job. It would draw the robot, frames, arrows per request.
Simulatortakes the whole system
diagramand runs the simulation. Using the robot dynamics equation of motion and environment forces, the
Simulatorcomputes the state change. It then runs numerical integration for continuous system or state update for discrete system, to calculate the next system state, and write the states back to the diagram's corresponding
context. It keeps updating the states until the simulation finishes.
MultibodyPlantinput with torque input block, which could be controller block or signal source block.
SceneGraphfor visualization, use
builderto connect the
MultibodyPlantfor collision checking.
Simulatorto simulate the
drake_visualizerto see the result.