Drake
bowling_ball.cc File Reference

A simple example showing a bowling ball knocking over pins. More...

#include <cmath>
#include <iomanip>
#include <limits>
#include <memory>
#include <gflags/gflags.h>
#include "drake/common/eigen_types.h"
#include "drake/common/find_resource.h"
#include "drake/lcm/drake_lcm.h"
#include "drake/multibody/parsers/urdf_parser.h"
#include "drake/multibody/rigid_body_plant/drake_visualizer.h"
#include "drake/multibody/rigid_body_plant/rigid_body_plant.h"
#include "drake/multibody/rigid_body_tree_construction.h"
#include "drake/systems/analysis/runge_kutta2_integrator.h"
#include "drake/systems/analysis/simulator.h"
#include "drake/systems/framework/diagram_builder.h"
Include dependency graph for bowling_ball.cc:

drake

drake::systems

Functions

DEFINE_double (v, 12,"The ball's initial linear speed down the lane")

DEFINE_double (timestep, 2e-4,"The simulator time step")

DEFINE_double (w, 25,"The ball's initial angular speed (around [-1, 0 ,0].")

DEFINE_double (stiffness, 100000,"The contact model's stiffness")

DEFINE_double (us, 0.4,"The static coefficient of friction")

DEFINE_double (ud, 0.2,"The dynamic coefficient of friction")

DEFINE_double (v_tol, 0.01,"The maximum slipping speed allowed during stiction")

DEFINE_double (dissipation, 2,"The contact model's dissipation")

DEFINE_double (sim_duration, 3,"The simulation duration")

DEFINE_int32 (pin_count, 10,"The number of pins -- in the range [0, 10]")

DEFINE_bool (playback, true,"If true, loops playback of simulation")

int main ()

int main (int argc, char *argv[])

Detailed Description

A simple example showing a bowling ball knocking over pins.

The ball has an initial linear velocity parallel with the axis of the lane, and an angular velocity around that same vector (i.e., spinning perpendicular to its direction of motion).

In this case, it illustrates the change from dynamic to static friction as the ball slides along the lane. The slide becomes a roll as the relative velocity at the point of contact between ball and lane slows to zero.

This scenario (the definitions in the URDF and default values here) are inspired by this discussion of bowling physics: http://www.real-world-physics-problems.com/physics-of-bowling.html

There are physical artifacts that are not captured in this simulation. This doesn't model the change in the coefficient of friction due to position; a real bowling lane is oiled in for the first 2/3 of its length. As such, the parameters have to be tweaked to get the desired outcome. Rotational velocity has been modified (pointing straight back with a lower magnitude) and higher initial linear velocity. The lane is oriented along the x-axis (on the x-y plane).

Function Documentation

 int main ( int argc, char * argv[] )

Here is the call graph for this function: