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_ */
gazebo::GazeboRosSkidSteerDrive::cmd_vel_subscriber_
ros::Subscriber cmd_vel_subscriber_
Definition: gazebo_ros_skid_steer_drive.h:102
gazebo::GazeboRosSkidSteerDrive::update_connection_
event::ConnectionPtr update_connection_
Definition: gazebo_ros_skid_steer_drive.h:85
gazebo::GazeboRosSkidSteerDrive::right_front_joint_name_
std::string right_front_joint_name_
Definition: gazebo_ros_skid_steer_drive.h:88
ros::Publisher
gazebo::GazeboRosSkidSteerDrive::update_period_
double update_period_
Definition: gazebo_ros_skid_steer_drive.h:130
gazebo::GazeboRosSkidSteerDrive::covariance_x_
double covariance_x_
Definition: gazebo_ros_skid_steer_drive.h:133
gazebo::GazeboRosSkidSteerDrive::left_front_joint_name_
std::string left_front_joint_name_
Definition: gazebo_ros_skid_steer_drive.h:87
gazebo
ros.h
gazebo::GazeboRosSkidSteerDrive::GazeboRosSkidSteerDrive
GazeboRosSkidSteerDrive()
Definition: gazebo_ros_skid_steer_drive.cpp:70
gazebo::GazeboRosSkidSteerDrive::alive_
bool alive_
Definition: gazebo_ros_skid_steer_drive.h:126
gazebo::GazeboRosSkidSteerDrive::broadcast_tf_
bool broadcast_tf_
Definition: gazebo_ros_skid_steer_drive.h:106
gazebo::GazeboRosSkidSteerDrive::Load
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Definition: gazebo_ros_skid_steer_drive.cpp:79
gazebo::GazeboRosSkidSteerDrive::UpdateChild
virtual void UpdateChild()
Definition: gazebo_ros_skid_steer_drive.cpp:340
gazebo::GazeboRosSkidSteerDrive::covariance_yaw_
double covariance_yaw_
Definition: gazebo_ros_skid_steer_drive.h:135
gazebo::GazeboRosSkidSteerDrive::parent
physics::ModelPtr parent
Definition: gazebo_ros_skid_steer_drive.h:84
gazebo::GazeboRosSkidSteerDrive::queue_
ros::CallbackQueue queue_
Definition: gazebo_ros_skid_steer_drive.h:117
gazebo::GazeboRosSkidSteerDrive::lock
boost::mutex lock
Definition: gazebo_ros_skid_steer_drive.h:108
gazebo::GazeboRosSkidSteerDrive::odometry_frame_
std::string odometry_frame_
Definition: gazebo_ros_skid_steer_drive.h:113
gazebo::GazeboRosSkidSteerDrive::publishOdometry
void publishOdometry(double step_time)
Definition: gazebo_ros_skid_steer_drive.cpp:425
gazebo::GazeboRosSkidSteerDrive::~GazeboRosSkidSteerDrive
~GazeboRosSkidSteerDrive()
Definition: gazebo_ros_skid_steer_drive.cpp:73
transform_broadcaster.h
gazebo::GazeboRosSkidSteerDrive::covariance_y_
double covariance_y_
Definition: gazebo_ros_skid_steer_drive.h:134
gazebo::GazeboRosSkidSteerDrive::right_rear_joint_name_
std::string right_rear_joint_name_
Definition: gazebo_ros_skid_steer_drive.h:90
gazebo::GazeboRosSkidSteerDrive::odom_
nav_msgs::Odometry odom_
Definition: gazebo_ros_skid_steer_drive.h:104
gazebo::GazeboRosSkidSteerDrive::cmdVelCallback
void cmdVelCallback(const geometry_msgs::Twist::ConstPtr &cmd_msg)
Definition: gazebo_ros_skid_steer_drive.cpp:409
gazebo::GazeboRosSkidSteerDrive::wheel_speed_
double wheel_speed_[4]
Definition: gazebo_ros_skid_steer_drive.h:95
ros::CallbackQueue
gazebo::GazeboRosSkidSteerDrive::update_rate_
double update_rate_
Definition: gazebo_ros_skid_steer_drive.h:129
tf::TransformBroadcaster
gazebo::GazeboRosSkidSteerDrive::command_topic_
std::string command_topic_
Definition: gazebo_ros_skid_steer_drive.h:111
gazebo::GazeboRosSkidSteerDrive::odometry_publisher_
ros::Publisher odometry_publisher_
Definition: gazebo_ros_skid_steer_drive.h:101
gazebo::GazeboRosSkidSteerDrive::wheel_diameter_
double wheel_diameter_
Definition: gazebo_ros_skid_steer_drive.h:93
gazebo::GazeboRosSkidSteerDrive::last_update_time_
common::Time last_update_time_
Definition: gazebo_ros_skid_steer_drive.h:131
gazebo::GazeboRosSkidSteerDrive::getWheelVelocities
void getWheelVelocities()
Definition: gazebo_ros_skid_steer_drive.cpp:395
gazebo::GazeboRosSkidSteerDrive::rosnode_
ros::NodeHandle * rosnode_
Definition: gazebo_ros_skid_steer_drive.h:100
gazebo::GazeboRosSkidSteerDrive::wheel_separation_
double wheel_separation_
Definition: gazebo_ros_skid_steer_drive.h:92
gazebo::GazeboRosSkidSteerDrive::left_rear_joint_name_
std::string left_rear_joint_name_
Definition: gazebo_ros_skid_steer_drive.h:89
callback_queue.h
gazebo::GazeboRosSkidSteerDrive::rot_
double rot_
Definition: gazebo_ros_skid_steer_drive.h:125
gazebo::GazeboRosSkidSteerDrive::world
physics::WorldPtr world
Definition: gazebo_ros_skid_steer_drive.h:83
transform_listener.h
gazebo::GazeboRosSkidSteerDrive::callback_queue_thread_
boost::thread callback_queue_thread_
Definition: gazebo_ros_skid_steer_drive.h:118
advertise_options.h
gazebo::GazeboRosSkidSteerDrive::odometry_topic_
std::string odometry_topic_
Definition: gazebo_ros_skid_steer_drive.h:112
gazebo::GazeboRosSkidSteerDrive::FiniChild
virtual void FiniChild()
Definition: gazebo_ros_skid_steer_drive.cpp:387
gazebo::GazeboRosSkidSteerDrive::torque
double torque
Definition: gazebo_ros_skid_steer_drive.h:94
gazebo::GazeboRosSkidSteerDrive::robot_base_frame_
std::string robot_base_frame_
Definition: gazebo_ros_skid_steer_drive.h:114
gazebo::GazeboRosSkidSteerDrive::robot_namespace_
std::string robot_namespace_
Definition: gazebo_ros_skid_steer_drive.h:110
gazebo::GazeboRosSkidSteerDrive::tf_prefix_
std::string tf_prefix_
Definition: gazebo_ros_skid_steer_drive.h:105
gazebo::GazeboRosSkidSteerDrive::transform_broadcaster_
tf::TransformBroadcaster * transform_broadcaster_
Definition: gazebo_ros_skid_steer_drive.h:103
gazebo::GazeboRosSkidSteerDrive
Definition: gazebo_ros_skid_steer_drive.h:68
gazebo::GazeboRosSkidSteerDrive::x_
double x_
Definition: gazebo_ros_skid_steer_drive.h:124
gazebo::GazeboRosSkidSteerDrive::joints
physics::JointPtr joints[4]
Definition: gazebo_ros_skid_steer_drive.h:97
gazebo::GazeboRosSkidSteerDrive::QueueThread
void QueueThread()
Definition: gazebo_ros_skid_steer_drive.cpp:417
ros::NodeHandle
ros::Subscriber


gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Sep 5 2024 02:49:55