Skip to content

Building simulations from code

edrumwri edited this page Nov 3, 2014 · 9 revisions
  • Create the simulation (Simulator if no contacts or joint limits, EventDrivenSimulator otherwise)
  • Create one or more model(s) and add them to the simulation, see Constructing models
  • Set contact parameters for any bodies that may come into contact (unnecessary for Simulator), see EventDrivenSimulator.h
  • Set unchecked pairs, denoting bodies not checked for contact (unnecessary for Simulator), see EventDrivenSimulator.h
  • Create controllers for any models that you want to control programmatically. Attempting to control models between simulation steps is not recommended, because the simulator can take multiple intermediate steps between a single nominal step.
  • Run the simulation in a loop:
    1. Select a step size (typically from 0.0001 to 0.1)
    2. Step the simulation
    3. Update any graphics (you can call the the update_visualization() method if you're using OpenSceneGraph)

Wiki home

Clone this wiki locally