Multi-robot Playground
GmappingPoseNode.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Alysson Ribeiro da Silva
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  *
8  * 1. Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. All advertising materials mentioning features or use of this software must
16  * display the following acknowledgement:
17  * This product includes software developed by Alysson Ribeiro da Silva.
18  *
19  * 4. Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * 5. The source and the binary form, and any modifications made to them
24  * may not be used for the purpose of training or improving machine learning
25  * algorithms, including but not limited to artificial intelligence, natural
26  * language processing, or data mining. This condition applies to any derivatives,
27  * modifications, or updates based on the Software code. Any usage of the source
28  * or the binary form in an AI-training dataset is considered a breach of
29  * this License.
30  *
31  * THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
32  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
34  * EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
37  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
40  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 */
42 
43 /*
44  * Ros and system
45  */
46 #include <iostream>
47 #include <stdio.h>
48 #include <string.h>
49 #include "ros/ros.h"
50 #include "tf2_ros/transform_listener.h"
51 #include "tf/LinearMath/Matrix3x3.h"
52 #include "tf/tf.h"
53 
54 /*
55  * Messages
56  */
57 #include "geometry_msgs/TransformStamped.h"
58 #include "geometry_msgs/Pose.h"
59 #include "geometry_msgs/Point.h"
60 #include "nav_msgs/MapMetaData.h"
61 #include "nav_msgs/OccupancyGrid.h"
62 #include "multirobotsimulations/CustomPose.h"
63 #include "geometry_msgs/PoseStamped.h"
64 #include "nav_msgs/Path.h"
65 
66 /*
67  * Helpers
68  */
69 #include "Common.h"
70 
72  public:
75 
76  private:
77  void OccCallback(nav_msgs::OccupancyGrid::ConstPtr msg);
78  void Update();
79 
80  /*
81  * Control variables
82  */
83  int aId;
85  bool aHasOcc;
86  double aRate;
87  std::string aNamespace;
88  std::string aTFBaseLink;
89  std::string aTFMap;
90 
91  /*
92  * Routines
93  */
94  std::vector<ros::Timer> aTimers;
95 
96  /*
97  * Subscribers
98  */
99  std::vector<ros::Subscriber> aSubscribers;
100 
101  /*
102  * Advertisers
103  */
104  ros::Publisher aPosePublisher;
105  ros::Publisher aPoseStampedPublisher;
106  ros::Publisher aPathPublisher;
107 
108  /*
109  * Messages
110  */
111  nav_msgs::OccupancyGrid aOcc;
112  multirobotsimulations::CustomPose aPose;
113  geometry_msgs::PoseStamped aPoseStamped;
114  nav_msgs::Path aPath;
115 
116  /*
117  * Helpers
118  */
119  std::shared_ptr<tf2_ros::Buffer> aTFBuffer;
120  std::shared_ptr<tf2_ros::TransformListener> aTFListener;
121 
122 };
GmappingPoseNode::aPose
multirobotsimulations::CustomPose aPose
Definition: GmappingPoseNode.h:112
GmappingPoseNode::aTimers
std::vector< ros::Timer > aTimers
Definition: GmappingPoseNode.h:94
GmappingPoseNode::aNamespace
std::string aNamespace
Definition: GmappingPoseNode.h:87
GmappingPoseNode
Definition: GmappingPoseNode.h:71
GmappingPoseNode::~GmappingPoseNode
~GmappingPoseNode()
GmappingPoseNode::aPathPublisher
ros::Publisher aPathPublisher
Definition: GmappingPoseNode.h:106
GmappingPoseNode::aId
int aId
Definition: GmappingPoseNode.h:83
GmappingPoseNode::aTFListener
std::shared_ptr< tf2_ros::TransformListener > aTFListener
Definition: GmappingPoseNode.h:120
GmappingPoseNode::aOcc
nav_msgs::OccupancyGrid aOcc
Definition: GmappingPoseNode.h:111
GmappingPoseNode::OccCallback
void OccCallback(nav_msgs::OccupancyGrid::ConstPtr msg)
GmappingPoseNode::aQueueSize
int aQueueSize
Definition: GmappingPoseNode.h:84
GmappingPoseNode::GmappingPoseNode
GmappingPoseNode()
GmappingPoseNode::Update
void Update()
Common.h
GmappingPoseNode::aHasOcc
bool aHasOcc
Definition: GmappingPoseNode.h:85
GmappingPoseNode::aPoseStamped
geometry_msgs::PoseStamped aPoseStamped
Definition: GmappingPoseNode.h:113
GmappingPoseNode::aPoseStampedPublisher
ros::Publisher aPoseStampedPublisher
Definition: GmappingPoseNode.h:105
GmappingPoseNode::aSubscribers
std::vector< ros::Subscriber > aSubscribers
Definition: GmappingPoseNode.h:99
GmappingPoseNode::aTFMap
std::string aTFMap
Definition: GmappingPoseNode.h:89
GmappingPoseNode::aTFBaseLink
std::string aTFBaseLink
Definition: GmappingPoseNode.h:88
GmappingPoseNode::aPath
nav_msgs::Path aPath
Definition: GmappingPoseNode.h:114
GmappingPoseNode::aRate
double aRate
Definition: GmappingPoseNode.h:86
GmappingPoseNode::aTFBuffer
std::shared_ptr< tf2_ros::Buffer > aTFBuffer
Definition: GmappingPoseNode.h:119
GmappingPoseNode::aPosePublisher
ros::Publisher aPosePublisher
Definition: GmappingPoseNode.h:104