converter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, the neonavigation authors
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  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef TRAJECTORY_TRACKER_MSGS_CONVERTER_H
31 #define TRAJECTORY_TRACKER_MSGS_CONVERTER_H
32 
33 #include <geometry_msgs/PoseStamped.h>
34 #include <geometry_msgs/Vector3.h>
35 #include <nav_msgs/Path.h>
36 #include <trajectory_tracker_msgs/PathWithVelocity.h>
37 
39 {
40 inline PathWithVelocity toPathWithVelocity(
41  const nav_msgs::Path& src,
42  const double vel)
43 {
44  PathWithVelocity dest;
45  dest.header = src.header;
46  dest.poses.clear();
47  dest.poses.reserve(src.poses.size());
48  for (const geometry_msgs::PoseStamped& p : src.poses)
49  {
50  PoseStampedWithVelocity pv;
51  pv.header = p.header;
52  pv.pose = p.pose;
53  pv.linear_velocity.x = vel;
54  dest.poses.push_back(pv);
55  }
56  return dest;
57 }
58 inline PathWithVelocity toPathWithVelocity(
59  const nav_msgs::Path& src,
60  const geometry_msgs::Vector3& vel)
61 {
62  PathWithVelocity dest;
63  dest.header = src.header;
64  dest.poses.clear();
65  dest.poses.reserve(src.poses.size());
66  for (const geometry_msgs::PoseStamped& p : src.poses)
67  {
68  PoseStampedWithVelocity pv;
69  pv.header = p.header;
70  pv.pose = p.pose;
71  pv.linear_velocity = vel;
72  dest.poses.push_back(pv);
73  }
74  return dest;
75 }
76 } // namespace trajectory_tracker_msgs
77 
78 #endif // TRAJECTORY_TRACKER_MSGS_CONVERTER_H
PathWithVelocity toPathWithVelocity(const nav_msgs::Path &src, const double vel)
Definition: converter.h:40


trajectory_tracker_msgs
Author(s): Atsushi Watanabe
autogenerated on Fri Jun 7 2019 22:01:07