gazebo_ros_skid_steer_drive.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, Daniel Hewlett, Antons Rebguns
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the <organization> nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY Antons Rebguns <email> ''AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL Antons Rebguns <email> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  **/
28 
29 /*
30  * \file gazebo_ros_skid_steer_drive.h
31  *
32  * \brief A skid steering drive plugin. Inspired by gazebo_ros_diff_drive and SkidSteerDrivePlugin
33  *
34  * \author Zdenek Materna (imaterna@fit.vutbr.cz)
35  *
36  * $ Id: 06/25/2013 11:23:40 AM materna $
37  */
38 
39 #ifndef GAZEBO_ROS_SKID_STEER_DRIVE_H_
40 #define GAZEBO_ROS_SKID_STEER_DRIVE_H_
41 
42 #include <map>
43 
44 #include <gazebo/common/common.hh>
45 #include <gazebo/physics/physics.hh>
46 
47 // ROS
48 #include <ros/ros.h>
50 #include <tf/transform_listener.h>
51 #include <geometry_msgs/Twist.h>
52 #include <nav_msgs/Odometry.h>
53 #include <nav_msgs/OccupancyGrid.h>
54 
55 // Custom Callback Queue
56 #include <ros/callback_queue.h>
57 #include <ros/advertise_options.h>
58 
59 // Boost
60 #include <boost/thread.hpp>
61 #include <boost/bind.hpp>
62 
63 namespace gazebo {
64 
65  class Joint;
66  class Entity;
67 
68  class GazeboRosSkidSteerDrive : public ModelPlugin {
69 
70  public:
73  void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
74 
75  protected:
76  virtual void UpdateChild();
77  virtual void FiniChild();
78 
79  private:
80  void publishOdometry(double step_time);
81  void getWheelVelocities();
82 
83  physics::WorldPtr world;
84  physics::ModelPtr parent;
85  event::ConnectionPtr update_connection_;
86 
89  std::string left_rear_joint_name_;
91 
94  double torque;
95  double wheel_speed_[4];
96 
97  physics::JointPtr joints[4];
98 
99  // ROS STUFF
104  nav_msgs::Odometry odom_;
105  std::string tf_prefix_;
107 
108  boost::mutex lock;
109 
110  std::string robot_namespace_;
111  std::string command_topic_;
112  std::string odometry_topic_;
113  std::string odometry_frame_;
114  std::string robot_base_frame_;
115 
116  // Custom Callback Queue
118  boost::thread callback_queue_thread_;
119  void QueueThread();
120 
121  // DiffDrive stuff
122  void cmdVelCallback(const geometry_msgs::Twist::ConstPtr& cmd_msg);
123 
124  double x_;
125  double rot_;
126  bool alive_;
127 
128  // Update Rate
129  double update_rate_;
131  common::Time last_update_time_;
132 
136 
137  };
138 
139 }
140 
141 
142 #endif /* GAZEBO_ROS_SKID_STEER_DRIVE_H_ */
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
void cmdVelCallback(const geometry_msgs::Twist::ConstPtr &cmd_msg)
tf::TransformBroadcaster * transform_broadcaster_


gazebo_plugins
Author(s): John Hsu
autogenerated on Tue Mar 26 2019 02:31:27