VariableGearboxPlugin: use splines to support arbitrary smooth input-output gearbox profiles

#3073 Merged at 3bd1cee
Repository
Branch
gearbox_reference_angles7
Repository
Branch
gazebo7
Author
  1. Steve Peters
Reviewers
Description

This pull request adds the VariableGearboxPlugin, which uses piecewise cubic Hermite splines to support arbitrary smooth input-output relationships between the input and output angles of a gearbox. This includes the plugin, an example world, a test, and some added API's to ODE to support this feature.

The ODE gearbox joint currently supports joint constraints of the form angle1 = -ratio * angle2. In order to support arbitrary constraint profiles, reference angles are added to the linear constraint: angle1 - refAngle1 = -ratio * (angle2 - refAngle2). Then at each time step, the smooth input-output curve is linearized at the current joint state to compute refAngle1, refAngle2, and ratio and solved. API's for setting the refAngle's are added to ODE, which can be accessed via SetParam / GetParam in the physics Joint interface. Tests are added for these new API's to the joint_spawn test.

The VariableGearboxPlugin is a ModelPlugin that takes a gearbox_joint_name parameter and multiple x_y_dydx parameters. The x_y_dydx parameters specify points and slopes on the input-output curve. The snippet below is copied from variable_gearbox_plugin.world. Documentation of the spline math is provided in the code.

  • x: angle of input joint
  • y: angle of output joint
  • dy/dx: instantaneous gear ratio of change in output / change in input.
<plugin name="variable_gearbox" filename="libVariableGearboxPlugin.so">
  <gearbox_joint_name>demo_joint_types::gearbox_demo</gearbox_joint_name>
  <x_y_dydx>1.2  -1.2  -1.0</x_y_dydx>
  <x_y_dydx>1.8  -7.5 -20.0</x_y_dydx>
</plugin>

The example world uses the demo_joint_types model, which has a pendulum connected via a gearbox to a flywheel. This plugin shifts the gear ratio from a low speed of the flywheel to a high speed as the pendulum swings.

Comments (2)