Simulation Construction Set

Simulation Construction Set

  • IHMC Home
  • All IHMC Docs
  • About IHMC

›Creating a New Simulation

Getting Started

  • Quick Start
  • Requirements
  • Using IHMC Open Robotics Software .jar releases with Maven/Gradle
  • Building .jars
  • Depending Directly on the Source

Using the SCS GUI

  • Running a simulation
  • Changing the Camera Settings
  • SCS Variables
  • Graphing Variables
  • Simulation Replay
  • Data Buffer
  • Exporting Data
  • Export Snapshots and Video of the 3D View

Creating a New Simulation

  • Summary
  • Create a New Project
  • SimplePendulumSimulation.java
  • SimplePendulumRobot.java
  • Run the simulation

Adding Control to a Simulation

  • Summary
  • Adding control to a simulation
  • Run the simulation

Creating Links

  • Summary
  • Creating Links
  • Run the Simulation

Creating Robot with Multiple Joints

  • Summary
  • Create a New Package
  • Mobile Simulation
  • Initial Variables in MobileRobot Class
  • MobileRobot Class Description

Ground Contact Modeling

  • Summary
  • Create a New Package
  • Create a New Class FallingBrickSimulation
  • Create a New Class FallingBrickRobot
  • Create a New Class WavyGroundProfile
  • Description and Analysis

Implementing Closed-Chain Mechanisms Using External Force Points

  • Summary
  • Implementing Closed-Chain Mechanisms
  • FlyballGovernorSimulation Class
  • FlyballGovernorRobot Class
  • FlyballGovernorSimpleClosedLoopConstraintController Class
  • FlyballGovernorCommonControlParameters Class
  • Description and Analysis

Run the simulation

Make sure that your editor does not complain about any compilation issues and run SimplePendulumSimulation.

1. Select a variable to graph

In the Variable Search field press the space bar. This will show all ten variables in the SCS system. Look for the "q_FulcrumPin" variable in the search tab of the Variable Viewer, create a new graph and drag the "q_FulcrumPin" into it.
This variable represents the value of the pivot angle in radians and should oscillate between -π/2 and π/2.

2. Simulate

Click on the Simulate button: simulate The pendulum should start swinging very rapidly and finally stop after converging to its equilibrium position.
The simulation should stop shortly after the pendulum position has converged. That's perfectly normal. If you remember we had set the simulation time parameter to 60 seconds and in simulate mode, SCS will run as fast as possible, in this case, faster than real-time.

pendulum initial state
Initial state of the pendulum - Starting from an angle of 90 degrees (q_Pinjoint value of 1.57 or π/2), converges to 0 degrees after few seconds:

Zoom in a little while sliding the graph to the left, notice that the graph accurately shows the oscillations of the pendulum at each time step.

3. Replay

Click and drag your mouse cursor on the graph to position the current time stamp to the beginning of the simulation (a black vertical bar should follow your movement as you drag the mouse on the graph and the pendulum should also move).
or Press the Goto In Point button gotoIn to rewind to the start of the simulation.

If you press the Play button play the simulation will playback in real-time. Click on the play button, now the pendulum will swing back and forth and stop after 60 seconds. Interestingly you will notice that if you run the same simulation code twice in a row, it will produce the exact same trajectories due to starting from exactly the same initial conditions.
If you were to start from slightly different conditions, it should produce different behavior.

pendulum initial state

4. Experiment

You can now experiment with different initial parameters and damping. For example first reset the sim to time 0, change a value such as "b_damp_FulcrumPinJoint" and press the Simulate button again to see how it affects the convergence time of the pendulum.

Additionally in the robot class experiment with different lengths, damping values, masses, and center of mass locations until you are comfortable with this simulation.

In the next tutorial we are going to add some simple control to this pendulum.

← SimplePendulumRobot.javaSummary →
Simulation Construction Set
Docs
Quick StartSoftware Documentation
Community
GitHubFacebookTwitterYouTube
Copyright © 2018 IHMC Robotics