WheelSlipPlugin Class Reference

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< ModelPluginTPtr
 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...
 

Detailed Description

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>

Member Typedef Documentation

◆ TPtr

typedef boost::shared_ptr<ModelPlugin > TPtr
inherited

plugin pointer type definition

Constructor & Destructor Documentation

◆ WheelSlipPlugin()

Constructor.

◆ ~WheelSlipPlugin()

virtual ~WheelSlipPlugin ( )
virtual

Destructor.

Member Function Documentation

◆ Create()

static TPtr Create ( const std::string &  _filename,
const std::string &  _name 
)
inlinestaticinherited

a class method that creates a plugin from a file name.

It locates the shared library and loads it dynamically.

Parameters
[in]_filenamethe path to the shared library.
[in]_nameshort name of the plugin
Returns
Shared Pointer to this class type

References PluginT< T >::filename, gzerr, and SingletonT< SystemPaths >::Instance().

◆ Fini()

virtual void Fini ( )
virtual

◆ GetFilename()

std::string GetFilename ( ) const
inlineinherited

Get the name of the handler.

References PluginT< T >::filename.

◆ GetHandle()

std::string GetHandle ( ) const
inlineinherited

Get the short name of the handler.

References PluginT< T >::handleName.

◆ GetParentModel()

physics::ModelPtr GetParentModel ( ) const

Get parent model.

Returns
pointer to parent model.

◆ GetSlips()

void GetSlips ( std::map< std::string, ignition::math::Vector3d > &  _out) const

Get wheel slip measurements.

Parameters
[out]_outMap 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.

◆ GetType()

PluginType GetType ( ) const
inlineinherited

Returns the type of the plugin.

Returns
type of the plugin

References PluginT< T >::type.

◆ Init()

◆ Load()

virtual void Load ( physics::ModelPtr  _model,
sdf::ElementPtr  _sdf 
)
virtual

Load function.

Called when a Plugin is first created, and after the World has been loaded. This function should not be blocking.

Parameters
[in]_modelPointer to the Model
[in]_sdfPointer to the SDF element of the plugin.

Implements ModelPlugin.

◆ LoadParam() [1/2]

void LoadParam ( const sdf::ElementPtr &  _sdf,
const std::string &  _name,
V &  _target,
_defaultValue = V() 
) const
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.

Parameters
[in]_sdfThe SDF element of the plugin.
[in]_nameName of a tag inside the SDF.
[out]_targetThe reference to store the param value to.
[in]_defaultValueThe default value.

References gzmsg, and PluginT< T >::handleName.

◆ LoadParam() [2/2]

void LoadParam ( sdf::ElementPtr &  _sdf,
const std::string &  _name,
std::string &  _target,
const char *  _defaultValue 
) const
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.

Parameters
[in]_sdfThe SDF element of the plugin.
[in]_nameName of a tag inside the SDF.
[out]_targetThe reference to store the param value to.
[in]_defaultValueThe default value.

◆ Reset()

virtual void Reset ( )
inlinevirtualinherited

◆ SetSlipComplianceLateral()

void SetSlipComplianceLateral ( const double  _compliance)

Set unitless lateral slip compliance for all wheels.

Parameters
[in]_complianceunitless slip compliance to set.

◆ SetSlipComplianceLongitudinal()

void SetSlipComplianceLongitudinal ( const double  _compliance)

Set unitless longitudinal slip compliance for all wheels.

Parameters
[in]_complianceunitless slip compliance to set.

Member Data Documentation

◆ filename

std::string filename
protectedinherited

Path to the shared library file.

◆ handleName

std::string handleName
protectedinherited

Short name.

◆ type

PluginType type
protectedinherited

Type of plugin.


The documentation for this class was generated from the following file: