18#ifndef GAZEBO_SIMPLETRACKEDVEHICLEPLUGIN_HH
19#define GAZEBO_SIMPLETRACKEDVEHICLEPLUGIN_HH
22#include <unordered_map>
24#include <boost/algorithm/string.hpp>
29#include <gazebo/ode/contact.h>
32#include "gazebo/physics/physics.hh"
76 public:
void Init()
override;
95 protected: std::unordered_map<Tracks, physics::LinkPtr>
tracks;
129 double _linearSpeed,
double _angularSpeed,
130 bool _drivingStraight,
const ignition::math::Pose3d &_bodyPose,
131 const ignition::math::Vector3d &_bodyYAxisGlobal,
132 const ignition::math::Vector3d &_centerOfRotation,
133 const ignition::math::Vector3d &_contactWorldPosition,
134 const ignition::math::Vector3d &_contactNormal,
135 const ignition::math::Vector3d &_beltDirection)
const;
142 const ignition::math::Vector3d &_beltDirection,
143 const ignition::math::Vector3d &_frictionDirection)
const;
162 class ContactIterator : std::iterator<std::input_iterator_tag, dContact>
165 private: pointer currentContact;
167 private:
size_t jointIndex;
169 private: dBodyID body;
171 private: dGeomID geom1, geom2;
173 private:
bool initialized;
176 public: ContactIterator();
177 public:
explicit ContactIterator(
bool _initialized);
178 public: ContactIterator(
const ContactIterator &_rhs);
179 public: ContactIterator(dBodyID _body, dGeomID _geom1, dGeomID _geom2);
182 public:
static ContactIterator begin(dBodyID _body, dGeomID _geom1,
184 public:
static ContactIterator end();
187 public: ContactIterator operator++();
190 public:
bool operator==(
const ContactIterator &_rhs);
191 public: ContactIterator &operator=(
const ContactIterator &_rhs);
192 public: ContactIterator operator++(
int _unused);
193 public: reference operator*();
194 public: pointer operator->();
195 public: pointer getPointer();
196 public:
bool operator!=(
const ContactIterator &_rhs);
Forward declarations for transport.
A very fast, but also very accurate model of non-deformable tracks without grousers.
Definition SimpleTrackedVehiclePlugin.hh:65
std::unordered_map< Tracks, physics::LinkPtr > tracks
The tracks controlled by this plugin.
Definition SimpleTrackedVehiclePlugin.hh:95
SimpleTrackedVehiclePlugin()=default
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.
void Init() override
Initialize the plugin.
void SetGeomCategories()
Set collide categories and bits of all geometries to the required values.
unsigned int collideWithoutContactBitmask
This bitmask will be set to the whole vehicle body.
Definition SimpleTrackedVehiclePlugin.hh:150
size_t GetNumTracks(Tracks side) const
Return the number of tracks on the given side.
physics::LinkPtr body
Body of the robot.
Definition SimpleTrackedVehiclePlugin.hh:92
void SetTrackVelocityImpl(double _left, double _right) override
Set new target velocity for the tracks.
void DriveTracks(const common::UpdateInfo &)
Compute and apply the forces that make the tracks move.
static const unsigned int ROBOT_CATEGORY
Category for the non-track parts of the robot.
Definition SimpleTrackedVehiclePlugin.hh:152
static const unsigned int LEFT_CATEGORY
Category for all items on the left side.
Definition SimpleTrackedVehiclePlugin.hh:156
std::unordered_map< Tracks, double > trackVelocity
Desired velocities of the tracks.
Definition SimpleTrackedVehiclePlugin.hh:98
virtual ~SimpleTrackedVehiclePlugin()
void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf) override
Called when the plugin is loaded.
static const unsigned int BELT_CATEGORY
Category for tracks.
Definition SimpleTrackedVehiclePlugin.hh:154
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.
void UpdateTrackSurface() override
Update surface parameters of the tracks to correspond to the values set in this plugin.
void Reset() override
Reset the plugin.
An abstract gazebo model plugin for tracked vehicles.
Definition TrackedVehiclePlugin.hh:80
Information for use in an update event.
Definition UpdateInfo.hh:31
boost::shared_ptr< Connection > ConnectionPtr
Definition CommonTypes.hh:134
boost::shared_ptr< Link > LinkPtr
Definition PhysicsTypes.hh:109
boost::shared_ptr< Model > ModelPtr
Definition PhysicsTypes.hh:93
boost::shared_ptr< Node > NodePtr
Definition TransportTypes.hh:57
Forward declarations for the common classes.
Definition Animation.hh:27
Tracks
Enum for distinguishing between left and right tracks.
Definition TrackedVehiclePlugin.hh:40