A very fast, but also very accurate model of non-deformable tracks without grousers. More...
#include <SimpleTrackedVehiclePlugin.hh>
Inherits TrackedVehiclePlugin.
Public Types | |
typedef boost::shared_ptr< ModelPlugin > | TPtr |
plugin pointer type definition More... | |
Public Member Functions | |
SimpleTrackedVehiclePlugin ()=default | |
virtual | ~SimpleTrackedVehiclePlugin () |
std::string | GetFilename () const |
Get the name of the handler. More... | |
std::string | GetHandle () const |
Get the short name of the handler. More... | |
size_t | GetNumTracks (Tracks side) const |
Return the number of tracks on the given side. 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 Member Functions | |
ignition::math::Vector3d | ComputeFrictionDirection (double _linearSpeed, double _angularSpeed, bool _drivingStraight, const ignition::math::Pose3d &_bodyPose, const ignition::math::Vector3d &_bodyYAxisGlobal, const ignition::math::Vector3d &_centerOfRotation, const ignition::math::Vector3d &_contactWorldPosition, const ignition::math::Vector3d &_contactNormal, const ignition::math::Vector3d &_beltDirection) const |
Compute the direction of friction force in given contact point. More... | |
double | ComputeSurfaceMotion (double _beltSpeed, const ignition::math::Vector3d &_beltDirection, const ignition::math::Vector3d &_frictionDirection) const |
Compute the velocity of the surface motion in all contact points. More... | |
void | DriveTracks (const common::UpdateInfo &) |
Compute and apply the forces that make the tracks move. More... | |
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... | |
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 | SetGeomCategories () |
Set collide categories and bits of all geometries to the required values. 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 | |
physics::LinkPtr | body |
Body of the robot. More... | |
unsigned int | collideWithoutContactBitmask |
This bitmask will be set to the whole vehicle body. 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, physics::LinkPtr > | tracks |
The tracks controlled by this plugin. More... | |
std::unordered_map< Tracks, double > | trackVelocity |
Desired velocities of the tracks. More... | |
PluginType | type |
Type of plugin. More... | |
Static Protected Attributes | |
static const unsigned int | BELT_CATEGORY = 0x20000000 |
Category for tracks. More... | |
static const unsigned int | LEFT_CATEGORY = 0x40000000 |
Category for all items on the left side. More... | |
static const unsigned int | ROBOT_CATEGORY = 0x10000000 |
Category for the non-track parts of the robot. More... | |
A very fast, but also very accurate model of non-deformable tracks without grousers.
The motion model is based on adjusting motion1 in ODE contact properties and on computing Instantaneous Center of Rotation for a tracked vehicle. A detailed description of the model is given in https://arxiv.org/abs/1703.04316 .
The plugin processes the following parameters, plus the common parameters defined in TrackedVehiclePlugin.
<body> Body of the vehicle to which the two tracks are connected. <left_track> The left track link's name. <right_track> The right track link's name. <left_flipper> The name of a left flipper link. Can appear multiple times. <right_flipper> The name of a right flipper link. Can appear multiple times. <collide_without_contact_bitmask> Collision bitmask that will be set to the whole vehicle (default is 1u).
|
inherited |
plugin pointer type definition
|
default |
|
virtual |
|
protected |
Compute the direction of friction force in given contact point.
[in] | _linearSpeed | Linear speed of the vehicle. |
[in] | _angularSpeed | Angular speed of the vehicle. |
[in] | _drivingStraight | Whether the vehicle should steer. |
[in] | _bodyPose | Pose of the vehicle body. |
[in] | _bodyYAxisGlobal | Direction of the y-axis of the body in world frame. |
[in] | _centerOfRotation | Center of the circle the vehicle follows (Inf/-Inf if driving straight). |
[in] | _contactWorldPosition | World position of the contact point. |
[in] | _contactNormal | Corrected contact normal (pointing inside the track). |
[in] | _beltDirection | World-frame forward direction of the belt. |
|
protected |
Compute the velocity of the surface motion in all contact points.
[in] | _beltSpeed | The desired belt speed. |
[in] | _beltDirection | Forward direction of the belt. |
[in] | _frictionDirection | First friction direction. |
|
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().
|
protected |
Compute and apply the forces that make the tracks move.
|
inlineinherited |
Get the name of the handler.
References PluginT< T >::filename.
|
inlineinherited |
Get the short name of the handler.
References PluginT< T >::handleName.
size_t GetNumTracks | ( | Tracks | side | ) | const |
Return the number of tracks on the given side.
Should always be at least 1 for the main track. If flippers are present, the number is higher.
|
protectedvirtualinherited |
Namespace used as a prefix for gazebo topic names.
|
protectedvirtualinherited |
Steering efficiency coefficient (between 0.0 and 1.0).
|
protectedvirtualinherited |
Friction coefficient in the first friction direction.
|
protectedvirtualinherited |
Friction coefficient in the second friction direction.
|
protectedvirtualinherited |
Distance between the centers of the tracks.
|
inlineinherited |
|
overridevirtual |
Initialize the plugin.
Reimplemented from ModelPlugin.
|
overridevirtual |
Called when the plugin is loaded.
[in] | model | Pointer to the model for which the plugin is loaded |
[in] | _sdf | Pointer to the SDF for _model |
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. |
|
protectedvirtualinherited |
Callback for setting desired body velocity.
Normally, this callback converts the x/yaw message to track velocities and calls SetTrackVelocity().
[in] | _msg | Pose message from external publisher |
|
protectedinherited |
Callback for setting desired body velocity.
Normally, this callback converts the x/yaw message to track velocities and calls SetTrackVelocity().
[in] | _msg | Twist message from external publisher |
|
overridevirtual |
Reset the plugin.
Reimplemented from ModelPlugin.
|
protectedinherited |
Set new target velocity for the tracks based on the desired.
[in] | _linear | Desired linear velocity of the vehicle. |
[in] | _angular | Desired angular velocity of the vehicle. |
|
protected |
Set collide categories and bits of all geometries to the required values.
This is a workaround for https://bitbucket.org/osrf/gazebo/issues/1855 .
|
protectedinherited |
Set mu and mu2 of all collisions of the given link to values given by GetTrackMu() and GetTrackMu2().
[in] | _link | The link whose "mu"s are to be set. |
|
protectedvirtualinherited |
Set steering efficiency coefficient (between 0.0 and 1.0).
[in] | _steeringEfficiency | The new steering efficiency. |
|
protectedvirtualinherited |
Friction coefficient in the first friction direction.
[in] | _mu | The new coefficient. |
|
protectedvirtualinherited |
Friction coefficient in the second friction direction.
[in] | _mu2 | The new coefficient. |
|
protectedvirtualinherited |
Set new target velocity for the tracks.
Descendant classes need to implement this function.
[in] | _left | Velocity of left track. |
[in] | _right | Velocity of right track. |
|
overrideprotectedvirtual |
Set new target velocity for the tracks.
[in] | _left | Velocity of left track. |
[in] | _right | Velocity of right track. |
Implements TrackedVehiclePlugin.
|
overrideprotectedvirtual |
Update surface parameters of the tracks to correspond to the values set in this plugin.
Implements TrackedVehiclePlugin.
|
staticprotected |
Category for tracks.
|
protected |
Body of the robot.
|
protected |
This bitmask will be set to the whole vehicle body.
|
protectedinherited |
Path to the shared library file.
|
protectedinherited |
Short name.
|
staticprotected |
Category for all items on the left side.
|
protectedinherited |
Mutex to protect updates.
|
staticprotected |
Category for the non-track parts of the robot.
|
protectedinherited |
Textual lowercase names of the tracks.
|
protected |
The tracks controlled by this plugin.
|
protected |
Desired velocities of the tracks.
|
protectedinherited |
Type of plugin.