Go to the documentation of this file.00001 #include "transform_graph/position.h"
00002
00003 #include "Eigen/Dense"
00004 #include "geometry_msgs/Point.h"
00005 #include "geometry_msgs/Vector3.h"
00006 #include "pcl/point_types.h"
00007 #include "tf/transform_datatypes.h"
00008
00009 namespace transform_graph {
00010 Position::Position() : vector_() { vector_ << 0, 0, 0; }
00011
00012 Position::Position(double x, double y, double z) : vector_() {
00013 vector_ << x, y, z;
00014 }
00015
00016 Position::Position(const Eigen::Vector3d& v) : vector_() { vector_ = v; }
00017
00018 Position::Position(const geometry_msgs::Point& p) : vector_() {
00019 vector_ << p.x, p.y, p.z;
00020 }
00021
00022 Position::Position(const geometry_msgs::Vector3& v) : vector_() {
00023 vector_ << v.x, v.y, v.z;
00024 }
00025
00026 Position::Position(const pcl::PointXYZ& p) : vector_() {
00027 vector_ << p.x, p.y, p.z;
00028 }
00029
00030 Position::Position(const tf::Vector3& v) : vector_() {
00031 vector_ << v.x(), v.y(), v.z();
00032 }
00033
00034 Eigen::Vector3d Position::vector() const { return vector_; }
00035
00036 geometry_msgs::Point Position::point() const {
00037 geometry_msgs::Point point;
00038 point.x = vector_.x();
00039 point.y = vector_.y();
00040 point.z = vector_.z();
00041 return point;
00042 }
00043
00044 geometry_msgs::Vector3 Position::vector_msg() const {
00045 geometry_msgs::Vector3 point;
00046 point.x = vector_.x();
00047 point.y = vector_.y();
00048 point.z = vector_.z();
00049 return point;
00050 }
00051
00052 pcl::PointXYZ Position::pcl_point() const {
00053 pcl::PointXYZ point;
00054 point.x = vector_.x();
00055 point.y = vector_.y();
00056 point.z = vector_.z();
00057 return point;
00058 }
00059
00060 tf::Vector3 Position::tf_vector3() const {
00061 tf::Vector3 point(vector_.x(), vector_.y(), vector_.z());
00062 return point;
00063 }
00064
00065 double Position::x() const { return vector_.x(); }
00066
00067 double Position::y() const { return vector_.y(); }
00068
00069 double Position::z() const { return vector_.z(); }
00070 }