Flatland
model_tf_publisher.h
1 /*
2  * ______ __ __ __
3  * /\ _ \ __ /\ \/\ \ /\ \__
4  * \ \ \L\ \ __ __ /\_\ \_\ \ \ \____ ___\ \ ,_\ ____
5  * \ \ __ \/\ \/\ \\/\ \ /'_` \ \ '__`\ / __`\ \ \/ /',__\
6  * \ \ \/\ \ \ \_/ |\ \ \/\ \L\ \ \ \L\ \/\ \L\ \ \ \_/\__, `\
7  * \ \_\ \_\ \___/ \ \_\ \___,_\ \_,__/\ \____/\ \__\/\____/
8  * \/_/\/_/\/__/ \/_/\/__,_ /\/___/ \/___/ \/__/\/___/
9  * @copyright Copyright 2017 Avidbots Corp.
10  * @name model_tf_publisher.h
11  * @brief Publish tf in robots
12  * @author Chunshang Li
13  *
14  * Software License Agreement (BSD License)
15  *
16  * Copyright (c) 2017, Avidbots Corp.
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions
21  * are met:
22  *
23  * * Redistributions of source code must retain the above copyright
24  * notice, this list of conditions and the following disclaimer.
25  * * Redistributions in binary form must reproduce the above
26  * copyright notice, this list of conditions and the following
27  * disclaimer in the documentation and/or other materials provided
28  * with the distribution.
29  * * Neither the name of the Avidbots Corp. nor the names of its
30  * contributors may be used to endorse or promote products derived
31  * from this software without specific prior written permission.
32  *
33  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
36  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
37  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
38  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
39  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
41  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
43  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44  * POSSIBILITY OF SUCH DAMAGE.
45  */
46 
47 #include <flatland_plugins/update_timer.h>
48 #include <flatland_server/model_plugin.h>
49 #include <flatland_server/timekeeper.h>
50 #include <ros/ros.h>
51 #include <tf/transform_broadcaster.h>
52 
53 #ifndef FLATLAND_PLUGINS_MODEL_TF_PUBLISHER_H
54 #define FLATLAND_PLUGINS_MODEL_TF_PUBLISHER_H
55 
56 using namespace flatland_server;
57 
58 namespace flatland_plugins {
59 
64 class ModelTfPublisher : public ModelPlugin {
65  public:
66  std::string world_frame_id_;
68  std::vector<Body *> excluded_bodies_;
70  double update_rate_;
71 
72  tf::TransformBroadcaster tf_broadcaster;
74 
79  void OnInitialize(const YAML::Node &config) override;
80 
85  void BeforePhysicsStep(const Timekeeper &timekeeper) override;
86 };
87 };
88 
89 #endif
Definition: model_tf_publisher.h:64
Definition: dummy_model_plugin.h:59
double update_rate_
publish rate
Definition: model_tf_publisher.h:70
Definition: body.h:55
tf::TransformBroadcaster tf_broadcaster
For publish ROS TF.
Definition: model_tf_publisher.h:72
std::string world_frame_id_
name of the world frame id
Definition: model_tf_publisher.h:66
bool publish_tf_world_
if to publish the world position of the bodies
Definition: model_tf_publisher.h:67
Definition: timekeeper.h:55
Definition: model_plugin.h:64
Definition: body.h:61
UpdateTimer update_timer_
for managing update rate
Definition: model_tf_publisher.h:73
std::vector< Body * > excluded_bodies_
list of bodies to ignore
Definition: model_tf_publisher.h:68
Body * reference_body_
body used as a reference to other bodies
Definition: model_tf_publisher.h:69
Definition: update_timer.h:55