gazebo_ros_planar_move.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 /*
19  * Desc: Simple model controller that uses a twist message to move a robot on
20  * the xy plane.
21  * Author: Piyush Khandelwal
22  * Date: 29 July 2013
23  */
24 
25 #ifndef GAZEBO_ROS_PLANAR_MOVE_HH
26 #define GAZEBO_ROS_PLANAR_MOVE_HH
27 
28 #include <boost/bind.hpp>
29 #include <boost/thread.hpp>
30 #include <map>
31 
32 #include <gazebo/common/common.hh>
33 #include <gazebo/physics/physics.hh>
34 #include <sdf/sdf.hh>
35 
36 #include <geometry_msgs/Twist.h>
37 #include <nav_msgs/OccupancyGrid.h>
38 #include <nav_msgs/Odometry.h>
39 #include <ros/advertise_options.h>
40 #include <ros/callback_queue.h>
41 #include <ros/ros.h>
43 #include <tf/transform_listener.h>
44 
45 namespace gazebo {
46 
47  class GazeboRosPlanarMove : public ModelPlugin {
48 
49  public:
52  void Load(physics::ModelPtr parent, sdf::ElementPtr sdf);
53 
54  protected:
55  virtual void UpdateChild();
56  virtual void FiniChild();
57 
58  private:
59  void publishOdometry(double step_time);
60 
61  physics::ModelPtr parent_;
62  event::ConnectionPtr update_connection_;
63 
68  nav_msgs::Odometry odom_;
69  std::string tf_prefix_;
70 
71  boost::mutex lock;
72 
73  std::string robot_namespace_;
74  std::string command_topic_;
75  std::string odometry_topic_;
76  std::string odometry_frame_;
77  std::string robot_base_frame_;
79  double cmd_timeout_;
81 
82  // Custom Callback Queue
84  boost::thread callback_queue_thread_;
85  void QueueThread();
86 
87  // command velocity callback
88  void cmdVelCallback(const geometry_msgs::Twist::ConstPtr& cmd_msg);
89 
90  double x_;
91  double y_;
92  double rot_;
93  bool alive_;
95  ignition::math::Pose3d last_odom_pose_;
96 
97  };
98 
99 }
100 
101 #endif /* end of include guard: GAZEBO_ROS_PLANAR_MOVE_HH */
gazebo::GazeboRosPlanarMove::rosnode_
boost::shared_ptr< ros::NodeHandle > rosnode_
Definition: gazebo_ros_planar_move.h:64
ros::Publisher
gazebo::GazeboRosPlanarMove::odom_
nav_msgs::Odometry odom_
Definition: gazebo_ros_planar_move.h:68
boost::shared_ptr< ros::NodeHandle >
gazebo
gazebo::GazeboRosPlanarMove::cmd_timeout_
double cmd_timeout_
Definition: gazebo_ros_planar_move.h:79
gazebo::GazeboRosPlanarMove::rot_
double rot_
Definition: gazebo_ros_planar_move.h:92
ros.h
gazebo::GazeboRosPlanarMove
Definition: gazebo_ros_planar_move.h:47
gazebo::GazeboRosPlanarMove::publishOdometry
void publishOdometry(double step_time)
Definition: gazebo_ros_planar_move.cpp:261
gazebo::GazeboRosPlanarMove::vel_sub_
ros::Subscriber vel_sub_
Definition: gazebo_ros_planar_move.h:66
gazebo::GazeboRosPlanarMove::queue_
ros::CallbackQueue queue_
Definition: gazebo_ros_planar_move.h:83
gazebo::GazeboRosPlanarMove::callback_queue_thread_
boost::thread callback_queue_thread_
Definition: gazebo_ros_planar_move.h:84
transform_broadcaster.h
gazebo::GazeboRosPlanarMove::FiniChild
virtual void FiniChild()
Definition: gazebo_ros_planar_move.cpp:234
gazebo::GazeboRosPlanarMove::parent_
physics::ModelPtr parent_
Definition: gazebo_ros_planar_move.h:61
gazebo::GazeboRosPlanarMove::UpdateChild
virtual void UpdateChild()
Definition: gazebo_ros_planar_move.cpp:182
gazebo::GazeboRosPlanarMove::Load
void Load(physics::ModelPtr parent, sdf::ElementPtr sdf)
Definition: gazebo_ros_planar_move.cpp:38
gazebo::GazeboRosPlanarMove::cmdVelCallback
void cmdVelCallback(const geometry_msgs::Twist::ConstPtr &cmd_msg)
Definition: gazebo_ros_planar_move.cpp:242
ros::CallbackQueue
gazebo::GazeboRosPlanarMove::~GazeboRosPlanarMove
~GazeboRosPlanarMove()
Definition: gazebo_ros_planar_move.cpp:35
gazebo::GazeboRosPlanarMove::odometry_frame_
std::string odometry_frame_
Definition: gazebo_ros_planar_move.h:76
gazebo::GazeboRosPlanarMove::update_connection_
event::ConnectionPtr update_connection_
Definition: gazebo_ros_planar_move.h:62
gazebo::GazeboRosPlanarMove::alive_
bool alive_
Definition: gazebo_ros_planar_move.h:93
gazebo::GazeboRosPlanarMove::odometry_rate_
double odometry_rate_
Definition: gazebo_ros_planar_move.h:78
gazebo::GazeboRosPlanarMove::robot_base_frame_
std::string robot_base_frame_
Definition: gazebo_ros_planar_move.h:77
gazebo::GazeboRosPlanarMove::x_
double x_
Definition: gazebo_ros_planar_move.h:90
callback_queue.h
gazebo::GazeboRosPlanarMove::last_odom_publish_time_
common::Time last_odom_publish_time_
Definition: gazebo_ros_planar_move.h:94
gazebo::GazeboRosPlanarMove::odometry_pub_
ros::Publisher odometry_pub_
Definition: gazebo_ros_planar_move.h:65
transform_listener.h
advertise_options.h
ros::Time
gazebo::GazeboRosPlanarMove::lock
boost::mutex lock
Definition: gazebo_ros_planar_move.h:71
gazebo::GazeboRosPlanarMove::odometry_topic_
std::string odometry_topic_
Definition: gazebo_ros_planar_move.h:75
gazebo::GazeboRosPlanarMove::transform_broadcaster_
boost::shared_ptr< tf::TransformBroadcaster > transform_broadcaster_
Definition: gazebo_ros_planar_move.h:67
gazebo::GazeboRosPlanarMove::command_topic_
std::string command_topic_
Definition: gazebo_ros_planar_move.h:74
gazebo::GazeboRosPlanarMove::GazeboRosPlanarMove
GazeboRosPlanarMove()
Definition: gazebo_ros_planar_move.cpp:33
gazebo::GazeboRosPlanarMove::tf_prefix_
std::string tf_prefix_
Definition: gazebo_ros_planar_move.h:69
gazebo::GazeboRosPlanarMove::y_
double y_
Definition: gazebo_ros_planar_move.h:91
gazebo::GazeboRosPlanarMove::QueueThread
void QueueThread()
Definition: gazebo_ros_planar_move.cpp:252
ros::Subscriber
gazebo::GazeboRosPlanarMove::last_odom_pose_
ignition::math::Pose3d last_odom_pose_
Definition: gazebo_ros_planar_move.h:95
gazebo::GazeboRosPlanarMove::last_cmd_received_time_
ros::Time last_cmd_received_time_
Definition: gazebo_ros_planar_move.h:80
gazebo::GazeboRosPlanarMove::robot_namespace_
std::string robot_namespace_
Definition: gazebo_ros_planar_move.h:73


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