gazebo_ros_p3d.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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: 3D position interface for ground truth.
20  * Author: Sachin Chitta and John Hsu
21  * Date: 1 June 2008
22  */
23 
24 #ifndef GAZEBO_ROS_P3D_HH
25 #define GAZEBO_ROS_P3D_HH
26 
27 #include <string>
28 
29 #include <boost/thread.hpp>
30 #include <boost/thread/mutex.hpp>
31 
32 #include <ros/ros.h>
33 #include <nav_msgs/Odometry.h>
34 
35 #include <ros/callback_queue.h>
36 #include <ros/advertise_options.h>
37 
38 #include <gazebo/physics/physics.hh>
39 #include <gazebo/transport/TransportTypes.hh>
40 #include <gazebo/common/Time.hh>
41 #include <gazebo/common/Plugin.hh>
42 #include <gazebo/common/Events.hh>
43 
45 
46 namespace gazebo
47 {
48  class GazeboRosP3D : public ModelPlugin
49  {
51  public: GazeboRosP3D();
52 
54  public: virtual ~GazeboRosP3D();
55 
57  public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
58 
60  protected: virtual void UpdateChild();
61 
62  private: physics::WorldPtr world_;
63  private: physics::ModelPtr model_;
64 
66  private: physics::LinkPtr link_;
67 
69  private: physics::LinkPtr reference_link_;
70 
72  private: bool local_twist_;
73 
74 
77  private: ros::Publisher pub_;
79 
81  private: nav_msgs::Odometry pose_msg_;
82 
84  private: std::string link_name_;
85 
87  private: std::string topic_name_;
88 
91  private: std::string frame_name_;
92  private: std::string tf_frame_name_;
93 
95  private: ignition::math::Pose3d offset_;
96 
98  private: boost::mutex lock;
99 
101  private: common::Time last_time_;
102  private: ignition::math::Vector3d last_vpos_;
103  private: ignition::math::Vector3d last_veul_;
104  private: ignition::math::Vector3d apos_;
105  private: ignition::math::Vector3d aeul_;
106  private: ignition::math::Vector3d last_frame_vpos_;
107  private: ignition::math::Vector3d last_frame_veul_;
108  private: ignition::math::Vector3d frame_apos_;
109  private: ignition::math::Vector3d frame_aeul_;
110 
111  // rate control
112  private: double update_rate_;
113 
115  private: double gaussian_noise_;
116 
118  private: double GaussianKernel(double mu, double sigma);
119 
121  private: std::string robot_namespace_;
122 
124  private: void P3DQueueThread();
125  private: boost::thread callback_queue_thread_;
126 
127  // Pointer to the update event connection
128  private: event::ConnectionPtr update_connection_;
129 
130  // ros publish multi queue, prevents publish() blocking
131  private: PubMultiQueue pmq;
132  };
133 }
134 #endif
gazebo::GazeboRosP3D::last_vpos_
ignition::math::Vector3d last_vpos_
Definition: gazebo_ros_p3d.h:102
ros::Publisher
gazebo::GazeboRosP3D::last_frame_vpos_
ignition::math::Vector3d last_frame_vpos_
Definition: gazebo_ros_p3d.h:106
gazebo::GazeboRosP3D::link_
physics::LinkPtr link_
The parent Model.
Definition: gazebo_ros_p3d.h:66
gazebo
gazebo::GazeboRosP3D::update_rate_
double update_rate_
Definition: gazebo_ros_p3d.h:112
ros.h
gazebo::GazeboRosP3D::local_twist_
bool local_twist_
Compute twist in the local coordinate frame.
Definition: gazebo_ros_p3d.h:72
gazebo::GazeboRosP3D::pub_Queue
PubQueue< nav_msgs::Odometry >::Ptr pub_Queue
Definition: gazebo_ros_p3d.h:78
gazebo::GazeboRosP3D::last_time_
common::Time last_time_
save last_time
Definition: gazebo_ros_p3d.h:101
gazebo::GazeboRosP3D::world_
physics::WorldPtr world_
Definition: gazebo_ros_p3d.h:62
gazebo::GazeboRosP3D::tf_frame_name_
std::string tf_frame_name_
Definition: gazebo_ros_p3d.h:92
gazebo::GazeboRosP3D::p3d_queue_
ros::CallbackQueue p3d_queue_
Definition: gazebo_ros_p3d.h:123
gazebo::GazeboRosP3D::link_name_
std::string link_name_
store bodyname
Definition: gazebo_ros_p3d.h:84
gazebo::GazeboRosP3D::pose_msg_
nav_msgs::Odometry pose_msg_
ros message
Definition: gazebo_ros_p3d.h:81
gazebo::GazeboRosP3D::callback_queue_thread_
boost::thread callback_queue_thread_
Definition: gazebo_ros_p3d.h:125
gazebo::GazeboRosP3D::frame_name_
std::string frame_name_
frame transform name, should match link name FIXME: extract link name directly?
Definition: gazebo_ros_p3d.h:91
gazebo::GazeboRosP3D::frame_apos_
ignition::math::Vector3d frame_apos_
Definition: gazebo_ros_p3d.h:108
gazebo::GazeboRosP3D::reference_link_
physics::LinkPtr reference_link_
The body of the frame to display pose, twist.
Definition: gazebo_ros_p3d.h:69
gazebo::GazeboRosP3D
Definition: gazebo_ros_p3d.h:48
gazebo::GazeboRosP3D::P3DQueueThread
void P3DQueueThread()
Definition: gazebo_ros_p3d.cpp:419
gazebo::GazeboRosP3D::update_connection_
event::ConnectionPtr update_connection_
Definition: gazebo_ros_p3d.h:128
ros::CallbackQueue
gazebo::GazeboRosP3D::rosnode_
ros::NodeHandle * rosnode_
pointer to ros node
Definition: gazebo_ros_p3d.h:76
gazebo::GazeboRosP3D::Load
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Load the controller.
Definition: gazebo_ros_p3d.cpp:53
gazebo::GazeboRosP3D::robot_namespace_
std::string robot_namespace_
for setting ROS name space
Definition: gazebo_ros_p3d.h:121
gazebo::GazeboRosP3D::pub_
ros::Publisher pub_
Definition: gazebo_ros_p3d.h:77
callback_queue.h
gazebo::GazeboRosP3D::last_frame_veul_
ignition::math::Vector3d last_frame_veul_
Definition: gazebo_ros_p3d.h:107
gazebo::GazeboRosP3D::topic_name_
std::string topic_name_
topic name
Definition: gazebo_ros_p3d.h:87
advertise_options.h
gazebo::GazeboRosP3D::GazeboRosP3D
GazeboRosP3D()
Constructor.
Definition: gazebo_ros_p3d.cpp:34
gazebo::GazeboRosP3D::model_
physics::ModelPtr model_
Definition: gazebo_ros_p3d.h:63
PubMultiQueue
A collection of PubQueue objects, potentially of different types. This class is the programmer's inte...
Definition: PubQueue.h:96
PubQueue.h
gazebo::GazeboRosP3D::pmq
PubMultiQueue pmq
Definition: gazebo_ros_p3d.h:131
gazebo::GazeboRosP3D::aeul_
ignition::math::Vector3d aeul_
Definition: gazebo_ros_p3d.h:105
gazebo::GazeboRosP3D::lock
boost::mutex lock
mutex to lock access to fields used in message callbacks
Definition: gazebo_ros_p3d.h:98
gazebo::GazeboRosP3D::offset_
ignition::math::Pose3d offset_
allow specifying constant xyz and rpy offsets
Definition: gazebo_ros_p3d.h:95
gazebo::GazeboRosP3D::gaussian_noise_
double gaussian_noise_
Gaussian noise.
Definition: gazebo_ros_p3d.h:115
PubQueue
A queue of outgoing messages. Instead of calling publish() directly, you can push() messages here to ...
Definition: PubQueue.h:48
gazebo::GazeboRosP3D::GaussianKernel
double GaussianKernel(double mu, double sigma)
Gaussian noise generator.
Definition: gazebo_ros_p3d.cpp:397
gazebo::GazeboRosP3D::last_veul_
ignition::math::Vector3d last_veul_
Definition: gazebo_ros_p3d.h:103
gazebo::GazeboRosP3D::frame_aeul_
ignition::math::Vector3d frame_aeul_
Definition: gazebo_ros_p3d.h:109
gazebo::GazeboRosP3D::UpdateChild
virtual void UpdateChild()
Update the controller.
Definition: gazebo_ros_p3d.cpp:224
gazebo::GazeboRosP3D::apos_
ignition::math::Vector3d apos_
Definition: gazebo_ros_p3d.h:104
gazebo::GazeboRosP3D::~GazeboRosP3D
virtual ~GazeboRosP3D()
Destructor.
Definition: gazebo_ros_p3d.cpp:40
ros::NodeHandle


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