Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef TRAJECTORY_TRACKER_MSGS_CONVERTER_H
00031 #define TRAJECTORY_TRACKER_MSGS_CONVERTER_H
00032
00033 #include <geometry_msgs/PoseStamped.h>
00034 #include <geometry_msgs/Vector3.h>
00035 #include <nav_msgs/Path.h>
00036 #include <trajectory_tracker_msgs/PathWithVelocity.h>
00037
00038 namespace trajectory_tracker_msgs
00039 {
00040 inline PathWithVelocity toPathWithVelocity(
00041 const nav_msgs::Path& src,
00042 const double vel)
00043 {
00044 PathWithVelocity dest;
00045 dest.header = src.header;
00046 dest.poses.clear();
00047 dest.poses.reserve(src.poses.size());
00048 for (const geometry_msgs::PoseStamped& p : src.poses)
00049 {
00050 PoseStampedWithVelocity pv;
00051 pv.header = p.header;
00052 pv.pose = p.pose;
00053 pv.linear_velocity.x = vel;
00054 dest.poses.push_back(pv);
00055 }
00056 return dest;
00057 }
00058 inline PathWithVelocity toPathWithVelocity(
00059 const nav_msgs::Path& src,
00060 const geometry_msgs::Vector3& vel)
00061 {
00062 PathWithVelocity dest;
00063 dest.header = src.header;
00064 dest.poses.clear();
00065 dest.poses.reserve(src.poses.size());
00066 for (const geometry_msgs::PoseStamped& p : src.poses)
00067 {
00068 PoseStampedWithVelocity pv;
00069 pv.header = p.header;
00070 pv.pose = p.pose;
00071 pv.linear_velocity = vel;
00072 dest.poses.push_back(pv);
00073 }
00074 return dest;
00075 }
00076 }
00077
00078 #endif // TRAJECTORY_TRACKER_MSGS_CONVERTER_H