Go to the documentation of this file.00001 #ifndef GEOMETRY_MSG_TWIST_H
00002 #define GEOMETRY_MSG_TWIST_H
00003
00004 #include <geometry_msgs/Twist.h>
00005 #include <geometry_msgs/TwistStamped.h>
00006 #include "ros_parser_base.h"
00007
00008 class GeometryMsgTwist: public RosParserBase
00009 {
00010 public:
00011
00012 GeometryMsgTwist()
00013 {
00014 _data.emplace_back( "/linear/x" );
00015 _data.emplace_back( "/linear/y" );
00016 _data.emplace_back( "/linear/z" );
00017 _data.emplace_back( "/angular/x" );
00018 _data.emplace_back( "/angular/y" );
00019 _data.emplace_back( "/angular/z" );
00020 }
00021
00022 static const std::string& getCompatibleKey()
00023 {
00024 static std::string str = ros::message_traits::MD5Sum<geometry_msgs::Twist>::value();
00025 return str;
00026 }
00027
00028 const std::unordered_set<std::string>& getCompatibleKeys() const override
00029 {
00030 static std::unordered_set<std::string> temp = { getCompatibleKey() };
00031 return temp;
00032 }
00033
00034 virtual void pushMessageRef(const std::string& ,
00035 const MessageRef& msg,
00036 double timestamp) override
00037 {
00038 geometry_msgs::Twist twist;
00039 ros::serialization::IStream is( const_cast<uint8_t*>(msg.data()), msg.size() );
00040 ros::serialization::deserialize(is, twist);
00041
00042 _data[0].pushBack( {timestamp, twist.linear.x} );
00043 _data[1].pushBack( {timestamp, twist.linear.y} );
00044 _data[2].pushBack( {timestamp, twist.linear.z} );
00045 _data[3].pushBack( {timestamp, twist.angular.x} );
00046 _data[4].pushBack( {timestamp, twist.angular.y} );
00047 _data[5].pushBack( {timestamp, twist.angular.z} );
00048 }
00049
00050 void extractData(PlotDataMapRef& plot_map, const std::string& prefix) override
00051 {
00052 for (auto& it: _data)
00053 {
00054 appendData(plot_map, prefix + it.name(), it);
00055 }
00056 }
00057
00058 private:
00059 std::vector<PlotData> _data;
00060 };
00061
00062 typedef
00063 RosMessageStampedParser<geometry_msgs::TwistStamped, geometry_msgs::Twist, GeometryMsgTwist>
00064 GeometryMsgTwistStamped;
00065
00066
00067 #endif // GEOMETRY_MSG_TWIST_H