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 
71 
74  private: ros::Publisher pub_;
76 
78  private: nav_msgs::Odometry pose_msg_;
79 
81  private: std::string link_name_;
82 
84  private: std::string topic_name_;
85 
88  private: std::string frame_name_;
89  private: std::string tf_frame_name_;
90 
92  private: ignition::math::Pose3d offset_;
93 
95  private: boost::mutex lock;
96 
98  private: common::Time last_time_;
99  private: ignition::math::Vector3d last_vpos_;
100  private: ignition::math::Vector3d last_veul_;
101  private: ignition::math::Vector3d apos_;
102  private: ignition::math::Vector3d aeul_;
103  private: ignition::math::Vector3d last_frame_vpos_;
104  private: ignition::math::Vector3d last_frame_veul_;
105  private: ignition::math::Vector3d frame_apos_;
106  private: ignition::math::Vector3d frame_aeul_;
107 
108  // rate control
109  private: double update_rate_;
110 
112  private: double gaussian_noise_;
113 
115  private: double GaussianKernel(double mu, double sigma);
116 
118  private: std::string robot_namespace_;
119 
121  private: void P3DQueueThread();
122  private: boost::thread callback_queue_thread_;
123 
124  // Pointer to the update event connection
125  private: event::ConnectionPtr update_connection_;
126 
127  private: unsigned int seed;
128 
129  // ros publish multi queue, prevents publish() blocking
130  private: PubMultiQueue pmq;
131  };
132 }
133 #endif
ignition::math::Pose3d offset_
allow specifying constant xyz and rpy offsets
double gaussian_noise_
Gaussian noise.
double GaussianKernel(double mu, double sigma)
Gaussian noise generator.
GazeboRosP3D()
Constructor.
ignition::math::Vector3d frame_aeul_
physics::LinkPtr reference_link_
The body of the frame to display pose, twist.
std::string frame_name_
frame transform name, should match link name FIXME: extract link name directly?
event::ConnectionPtr update_connection_
virtual void UpdateChild()
Update the controller.
boost::mutex lock
mutex to lock access to fields used in message callbacks
ros::NodeHandle * rosnode_
pointer to ros node
virtual ~GazeboRosP3D()
Destructor.
std::string robot_namespace_
for setting ROS name space
A collection of PubQueue objects, potentially of different types. This class is the programmer&#39;s inte...
Definition: PubQueue.h:96
ignition::math::Vector3d aeul_
physics::ModelPtr model_
ignition::math::Vector3d last_frame_vpos_
A queue of outgoing messages. Instead of calling publish() directly, you can push() messages here to ...
Definition: PubQueue.h:48
ignition::math::Vector3d last_vpos_
physics::WorldPtr world_
PubQueue< nav_msgs::Odometry >::Ptr pub_Queue
ros::CallbackQueue p3d_queue_
ignition::math::Vector3d apos_
ignition::math::Vector3d last_veul_
common::Time last_time_
save last_time
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Load the controller.
physics::LinkPtr link_
The parent Model.
ignition::math::Vector3d frame_apos_
boost::thread callback_queue_thread_
ignition::math::Vector3d last_frame_veul_
std::string topic_name_
topic name
nav_msgs::Odometry pose_msg_
ros message
std::string tf_frame_name_
ros::Publisher pub_
std::string link_name_
store bodyname


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