##

WheelTrackedVehiclePlugin Class Reference

An approximate model of non-deformable tracks emulated by wheels. More...

`#include <WheelTrackedVehiclePlugin.hh>`

Inherits TrackedVehiclePlugin.

## Classes

struct | WheelInfo
| Holds information about each wheel. More...

## Public Types

typedef boost::shared_ptr< ModelPlugin > | TPtr
| plugin pointer type definition More...

## Public Member Functions

| WheelTrackedVehiclePlugin ()=default
virtual | ~WheelTrackedVehiclePlugin ()=default
std::string | GetFilename () const
| Get the name of the handler. More...
std::string | GetHandle () const
| Get the short name of the handler. More...
PluginType | GetType () const
| Returns the type of the plugin. More...
void | Init () override
| Initialize the plugin. More...
void | Load (physics::ModelPtr _model, sdf::ElementPtr _sdf) override
| Called when the plugin is loaded. More...
void | Reset () override
| Reset the plugin. 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 Types

typedef std::vector< WheelInfoPtr > | WheelInfo_V
typedef std::shared_ptr< WheelInfo > | WheelInfoPtr

## Protected Member Functions

virtual std::string | GetRobotNamespace ()
| Namespace used as a prefix for gazebo topic names. More...
virtual double | GetSteeringEfficiency ()
| Steering efficiency coefficient (between 0.0 and 1.0). More...
virtual boost::optional< double > | GetTrackMu ()
| Friction coefficient in the first friction direction. More...
virtual boost::optional< double > | GetTrackMu2 ()
| Friction coefficient in the second friction direction. More...
virtual double | GetTracksSeparation ()
| Distance between the centers of the tracks. More...
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...
void | LoadWheel (physics::ModelPtr &_model, Tracks &_track, const std::string &_jointName)
| Load a wheel connected to joint named jointName and append it to this->wheels[track]. More...
virtual void | OnVelMsg (ConstPosePtr &_msg) GAZEBO_DEPRECATED(9.0)
| Callback for setting desired body velocity. More...
void | OnVelMsg (ConstTwistPtr &_msg)
| Callback for setting desired body velocity. More...
void | SetBodyVelocity (double _linear, double _angular)
| Set new target velocity for the tracks based on the desired. More...
void | SetLinkMu (const physics::LinkPtr &_link)
| Set mu and mu2 of all collisions of the given link to values given by GetTrackMu() and GetTrackMu2(). More...
virtual void | SetSteeringEfficiency (double _steeringEfficiency)
| Set steering efficiency coefficient (between 0.0 and 1.0). More...
virtual void | SetTrackMu (double _mu)
| Friction coefficient in the first friction direction. More...
virtual void | SetTrackMu2 (double _mu2)
| Friction coefficient in the second friction direction. More...
virtual void | SetTrackVelocity (double _left, double _right)
| Set new target velocity for the tracks. More...
void | SetTrackVelocityImpl (double _left, double _right) override
| Set new target velocity for the tracks. More...
void | UpdateTrackSurface () override
| Update surface parameters of the tracks to correspond to the values set in this plugin. More...

## Protected Attributes

double | defaultWheelRadius
| The radius (in meters) used for wheels where autodetection fails. More...
std::string | filename
| Path to the shared library file. More...
std::string | handleName
| Short name. More...
std::mutex | mutex
| Mutex to protect updates. More...
std::unordered_map< Tracks, std::string > | trackNames
| Textual lowercase names of the tracks. More...
std::unordered_map< Tracks, double > | trackVelocity
| Desired velocities of the tracks. More...
PluginType | type
| Type of plugin. More...
std::unordered_map< Tracks, WheelInfo_V > | wheels
| The wheels on the LEFT/RIGHT track. More...
physics::WorldPtr | world
| Pointer to the world the model lives in. More...

## Detailed Description

An approximate model of non-deformable tracks emulated by wheels.

Since
  8.1

Inserting this model in simulation automatically sets the friction model to "cone_model", which is required for the model to correctly steer.

The plugin processes the following parameters, plus the common parameters defined in TrackedVehiclePlugin.

<left_joint> Name of the revolute joint connecting a left wheel (should appear multiple times, once for each left wheel). <right_joint> Name of the revolute joint connecting a right wheel (should appear multiple times, once for each right wheel). <default_wheel_radius> The radius used for wheels where radius autodetection fails (default is 0.5 meters).

## Member Typedef Documentation

## TPtr

typedef boost::shared_ptr<ModelPlugin > TPtr

inherited

plugin pointer type definition

## WheelInfo_V

typedef std::vector<WheelInfoPtr> WheelInfo_V

protected

## WheelInfoPtr

typedef std::shared_ptr<WheelInfo> WheelInfoPtr

protected

## Constructor & Destructor Documentation

## WheelTrackedVehiclePlugin()

WheelTrackedVehiclePlugin | ( |  | ) |

default

## ~WheelTrackedVehiclePlugin()

virtual ~WheelTrackedVehiclePlugin | ( |  | ) |

virtual default

## Member Function Documentation

## Create()

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

inline static inherited

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

It locates the shared library and loads it dynamically.

Parameters

  [in] | _filename | the path to the shared library.
  [in] | _name | short name of the plugin

Returns
  Shared Pointer to this class type

## GetFilename()

std::string GetFilename | ( |  | ) | const

inline inherited

Get the name of the handler.

## GetHandle()

std::string GetHandle | ( |  | ) | const

inline inherited

Get the short name of the handler.

## GetRobotNamespace()

virtual std::string GetRobotNamespace | ( |  | ) |

protected virtual inherited

Namespace used as a prefix for gazebo topic names.

## GetSteeringEfficiency()

virtual double GetSteeringEfficiency | ( |  | ) |

protected virtual inherited

Steering efficiency coefficient (between 0.0 and 1.0).

## GetTrackMu()

virtual boost::optional<double> GetTrackMu | ( |  | ) |

protected virtual inherited

Friction coefficient in the first friction direction.

## GetTrackMu2()

virtual boost::optional<double> GetTrackMu2 | ( |  | ) |

protected virtual inherited

Friction coefficient in the second friction direction.

## GetTracksSeparation()

virtual double GetTracksSeparation | ( |  | ) |

protected virtual inherited

Distance between the centers of the tracks.

## GetType()

PluginType GetType | ( |  | ) | const

inline inherited

Returns the type of the plugin.

Returns
  type of the plugin

## Init()

void Init | ( |  | ) |

override virtual

Initialize the plugin.

Reimplemented from TrackedVehiclePlugin.

## Load()

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

override virtual

Called when the plugin is loaded.

Parameters

  [in] | model | Pointer to the model for which the plugin is loaded
  [in] | _sdf | Pointer to the SDF for _model

Reimplemented from TrackedVehiclePlugin.

## LoadParam() [1/2]

void LoadParam | ( | const sdf::ElementPtr & | _sdf,
|  | const std::string & | _name,
|  | V & | _target,
|  | V | _defaultValue = `V()`
| ) |  | const

inline protected inherited

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] | _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.

## LoadParam() [2/2]

void LoadParam | ( | sdf::ElementPtr & | _sdf,
|  | const std::string & | _name,
|  | std::string & | _target,
|  | const char * | _defaultValue
| ) |  | const

inline protected inherited

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] | _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.

## LoadWheel()

void LoadWheel | ( | physics::ModelPtr & | _model,
|  | Tracks & | _track,
|  | const std::string & | _jointName
| ) |  |

protected

Load a wheel connected to joint named jointName and append it to this->wheels[track].

Parameters

  [in] | _model | The model to work with.
  [in] | _track | The track this wheel belongs to.
  [in] | _jointName | Name of the wheel joint.

## OnVelMsg() [1/2]

virtual void OnVelMsg | ( | ConstPosePtr & | _msg | ) |

protected virtual inherited

Callback for setting desired body velocity.

Normally, this callback converts the x/yaw message to track velocities and calls SetTrackVelocity().

Parameters

  [in] | _msg | Pose message from external publisher

## OnVelMsg() [2/2]

void OnVelMsg | ( | ConstTwistPtr & | _msg | ) |

protected inherited

Callback for setting desired body velocity.

Normally, this callback converts the x/yaw message to track velocities and calls SetTrackVelocity().

Parameters

  [in] | _msg | Twist message from external publisher

## Reset()

void Reset | ( |  | ) |

override virtual

Reset the plugin.

Reimplemented from TrackedVehiclePlugin.

## SetBodyVelocity()

void SetBodyVelocity | ( | double | _linear,
|  | double | _angular
| ) |  |

protected inherited

Set new target velocity for the tracks based on the desired.

Parameters

  [in] | _linear | Desired linear velocity of the vehicle.
  [in] | _angular | Desired angular velocity of the vehicle.

## SetLinkMu()

void SetLinkMu | ( | const physics::LinkPtr & | _link | ) |

protected inherited

Set mu and mu2 of all collisions of the given link to values given by GetTrackMu() and GetTrackMu2().

Parameters

  [in] | _link | The link whose "mu"s are to be set.

## SetSteeringEfficiency()

virtual void SetSteeringEfficiency | ( | double | _steeringEfficiency | ) |

protected virtual inherited

Set steering efficiency coefficient (between 0.0 and 1.0).

Parameters

  [in] | _steeringEfficiency | The new steering efficiency.

## SetTrackMu()

virtual void SetTrackMu | ( | double | _mu | ) |

protected virtual inherited

Friction coefficient in the first friction direction.

Parameters

  [in] | _mu | The new coefficient.

## SetTrackMu2()

virtual void SetTrackMu2 | ( | double | _mu2 | ) |

protected virtual inherited

Friction coefficient in the second friction direction.

Parameters

  [in] | _mu2 | The new coefficient.

## SetTrackVelocity()

virtual void SetTrackVelocity | ( | double | _left,
|  | double | _right
| ) |  |

protected virtual inherited

Set new target velocity for the tracks.

Descendant classes need to implement this function.

Parameters

  [in] | _left | Velocity of left track.
  [in] | _right | Velocity of right track.

## SetTrackVelocityImpl()

void SetTrackVelocityImpl | ( | double | _left,
|  | double | _right
| ) |  |

override protected virtual

Set new target velocity for the tracks.

Parameters

  [in] | _left | Velocity of left track.
  [in] | _right | Velocity of right track.

Implements TrackedVehiclePlugin.

## UpdateTrackSurface()

void UpdateTrackSurface | ( |  | ) |

override protected virtual

Update surface parameters of the tracks to correspond to the values set in this plugin.

Implements TrackedVehiclePlugin.

## Member Data Documentation

## defaultWheelRadius

double defaultWheelRadius

protected

The radius (in meters) used for wheels where autodetection fails.

## filename

std::string filename

protected inherited

Path to the shared library file.

## handleName

std::string handleName

protected inherited

Short name.

## mutex

std::mutex mutex

protected

Mutex to protect updates.

## trackNames

std::unordered_map<Tracks, std::string> trackNames

protected inherited

Textual lowercase names of the tracks.

## trackVelocity

std::unordered_map<Tracks, double> trackVelocity

protected

Desired velocities of the tracks.

## type

PluginType type

protected inherited

Type of plugin.

## wheels

std::unordered_map<Tracks, WheelInfo_V> wheels

protected

The wheels on the LEFT/RIGHT track.

## world

physics::WorldPtr world

protected

Pointer to the world the model lives in.

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

- WheelTrackedVehiclePlugin.hh