A plugin that updates ODE wheel slip parameters based on linear wheel spin velocity (radius * spin rate). More...
#include <WheelSlipPlugin.hh>
Inherits ModelPlugin.
Public Types | |
typedef boost::shared_ptr< ModelPlugin > | TPtr |
plugin pointer type definition More... | |
Public Member Functions | |
WheelSlipPlugin () | |
Constructor. More... | |
virtual | ~WheelSlipPlugin () |
Destructor. More... | |
virtual void | Fini () |
std::string | GetFilename () const |
Get the name of the handler. More... | |
std::string | GetHandle () const |
Get the short name of the handler. More... | |
physics::ModelPtr | GetParentModel () const |
Get parent model. More... | |
void | GetSlips (std::map< std::string, ignition::math::Vector3d > &_out) const |
Get wheel slip measurements. More... | |
PluginType | GetType () const |
Returns the type of the plugin. More... | |
virtual void | Init () |
Override this method for custom plugin initialization behavior. More... | |
virtual void | Load (physics::ModelPtr _model, sdf::ElementPtr _sdf) |
Load function. More... | |
virtual void | Reset () |
Override this method for custom plugin reset behavior. More... | |
void | SetSlipComplianceLateral (const double _compliance) |
Set unitless lateral slip compliance for all wheels. More... | |
void | SetSlipComplianceLongitudinal (const double _compliance) |
Set unitless longitudinal slip compliance for all wheels. More... | |
Static Public Member Functions | |
static TPtr | Create (const std::string &_filename, const std::string &_name) |
a class method that creates a plugin from a file name. More... | |
Protected Member Functions | |
void | LoadParam (const sdf::ElementPtr &_sdf, const std::string &_name, V &_target, V _defaultValue=V()) const |
Load parameter value from _sdf and store it to the given reference, using the supplied default value if the element in _sdf is not found. More... | |
void | LoadParam (sdf::ElementPtr &_sdf, const std::string &_name, std::string &_target, const char *_defaultValue) const |
Load parameter value from _sdf and store it to the given reference, using the supplied default value if the element in _sdf is not found. More... | |
Protected Attributes | |
std::string | filename |
Path to the shared library file. More... | |
std::string | handleName |
Short name. More... | |
PluginType | type |
Type of plugin. More... | |
A plugin that updates ODE wheel slip parameters based on linear wheel spin velocity (radius * spin rate).
It currently assumes that the fdir1 friction parameter is set parallel to the joint axis (often [0 0 1]) and that the link origin is on the joint axis. The ODE slip parameter is documented as Force-Dependent Slip (slip1, slip2) in the ODE user guide: http://ode.org/ode-latest-userguide.html#sec_7_3_7 and it has units of velocity / force (m / s / N), similar to the inverse of a viscous damping coefficient. The slip_compliance parameters specified in this plugin are unitless, representing the lateral or longitudinal slip ratio (see https://en.wikipedia.org/wiki/Slip_(vehicle_dynamics) ) to tangential force ratio (tangential / normal force). Note that the maximum force ratio is the friction coefficient. At each time step, these compliance are multipled by the linear wheel spin velocity and divided by the wheel_normal_force parameter specified below in order to match the units of the ODE slip parameters.
A graphical interpretation of these parameters is provided below for a positive value of slip compliance. The horizontal axis corresponds to the slip ratio at the wheel, and the vertical axis corresponds to the tangential force ratio (tangential / normal force). As wheel slip increases, the tangential force increases until it reaches the maximum set by the friction coefficient. The slip compliance corresponds to the inverse of the slope of the force before it reaches the maximum value. A slip compliance of 0 corresponds to a completely vertical portion of the plot below. As slip compliance increases, the slope decreases.
| . | _________ friction coefficient . | / . | /| . | /-┘ slope is inverse of . | / slip compliance . | / . |/ . --+-------------------------- slipRatio | <plugin filename="libWheelSlipPlugin.so" name="wheel_slip"> <wheel link_name="wheel_front_left"> <slip_compliance_lateral>0</slip_compliance_lateral> <slip_compliance_longitudinal>0.1</slip_compliance_longitudinal> <wheel_normal_force>100</wheel_normal_force> </wheel> <wheel link_name="wheel_front_right"> <slip_compliance_lateral>0</slip_compliance_lateral> <slip_compliance_longitudinal>0.1</slip_compliance_longitudinal> <wheel_normal_force>100</wheel_normal_force> </wheel> <wheel link_name="wheel_rear_left"> <slip_compliance_lateral>0</slip_compliance_lateral> <slip_compliance_longitudinal>0.1</slip_compliance_longitudinal> <wheel_normal_force>80</wheel_normal_force> </wheel> <wheel link_name="wheel_rear_right"> <slip_compliance_lateral>0</slip_compliance_lateral> <slip_compliance_longitudinal>0.1</slip_compliance_longitudinal> <wheel_normal_force>80</wheel_normal_force> </wheel> </plugin>
|
inherited |
plugin pointer type definition
WheelSlipPlugin | ( | ) |
Constructor.
|
virtual |
Destructor.
|
inlinestaticinherited |
a class method that creates a plugin from a file name.
It locates the shared library and loads it dynamically.
[in] | _filename | the path to the shared library. |
[in] | _name | short name of the plugin |
References PluginT< T >::filename, gzerr, and SingletonT< SystemPaths >::Instance().
|
virtual |
|
inlineinherited |
Get the name of the handler.
References PluginT< T >::filename.
|
inlineinherited |
Get the short name of the handler.
References PluginT< T >::handleName.
physics::ModelPtr GetParentModel | ( | ) | const |
Get parent model.
void GetSlips | ( | std::map< std::string, ignition::math::Vector3d > & | _out | ) | const |
Get wheel slip measurements.
[out] | _out | Map of wheel name to a Vector3 of slip velocities. The Vector3.X value is the longitudinal slip in m/s, the Vector3.Y value is the lateral slip in m/s, and the Vector3.Z value is the product of radius and spin rate in m/s. |
|
inlineinherited |
|
inlinevirtualinherited |
Override this method for custom plugin initialization behavior.
Reimplemented in KeysToCmdVelPlugin, BuoyancyPlugin, HarnessPlugin, FollowerPlugin, PlaneDemoPlugin, MudPlugin, CartDemoPlugin, VehiclePlugin, GimbalSmall2dPlugin, LinearBatteryPlugin, DiffDrivePlugin, and SphereAtlasDemoPlugin.
|
virtual |
Load function.
Called when a Plugin is first created, and after the World has been loaded. This function should not be blocking.
[in] | _model | Pointer to the Model |
[in] | _sdf | Pointer to the SDF element of the plugin. |
Implements ModelPlugin.
|
inlineprotectedinherited |
Load parameter value from _sdf and store it to the given reference, using the supplied default value if the element in _sdf is not found.
A message is written using gzmsg reporting whether the default value was used or not.
[in] | _sdf | The SDF element of the plugin. |
[in] | _name | Name of a tag inside the SDF. |
[out] | _target | The reference to store the param value to. |
[in] | _defaultValue | The default value. |
References gzmsg, and PluginT< T >::handleName.
|
inlineprotectedinherited |
Load parameter value from _sdf and store it to the given reference, using the supplied default value if the element in _sdf is not found.
A message is written using gzmsg reporting whether the default value was used or not. String specialization to allow accepting const char* values for std::string parameters.
[in] | _sdf | The SDF element of the plugin. |
[in] | _name | Name of a tag inside the SDF. |
[out] | _target | The reference to store the param value to. |
[in] | _defaultValue | The default value. |
|
inlinevirtualinherited |
Override this method for custom plugin reset behavior.
Reimplemented in KeysToCmdVelPlugin, RandomVelocityPlugin, ElevatorPlugin, FollowerPlugin, LinearBatteryPlugin, ActorPlugin, InitialVelocityPlugin, and SphereAtlasDemoPlugin.
void SetSlipComplianceLateral | ( | const double | _compliance | ) |
Set unitless lateral slip compliance for all wheels.
[in] | _compliance | unitless slip compliance to set. |
void SetSlipComplianceLongitudinal | ( | const double | _compliance | ) |
Set unitless longitudinal slip compliance for all wheels.
[in] | _compliance | unitless slip compliance to set. |
|
protectedinherited |
Path to the shared library file.
|
protectedinherited |
Short name.
|
protectedinherited |
Type of plugin.