From 86b44d4d5ce8dbd299d2d60d4b9ded1008f4299c Mon Sep 17 00:00:00 2001 From: Mirko Waechter <mirko.waechter@kit.edu> Date: Sat, 23 Jun 2018 23:35:25 +0200 Subject: [PATCH] made pose output more consistent --- source/RobotAPI/libraries/core/FramedPose.cpp | 9 +++++---- source/RobotAPI/libraries/core/Pose.cpp | 6 +++--- source/RobotAPI/libraries/core/Pose.h | 3 +++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/source/RobotAPI/libraries/core/FramedPose.cpp b/source/RobotAPI/libraries/core/FramedPose.cpp index 0cd53f085..ff6bcc0ed 100644 --- a/source/RobotAPI/libraries/core/FramedPose.cpp +++ b/source/RobotAPI/libraries/core/FramedPose.cpp @@ -220,7 +220,7 @@ namespace armarx string FramedDirection::output(const Ice::Current& c) const { std::stringstream s; - s << toEigen() << std::endl << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent)); + s << toEigen().format(ArmarXEigenFormat) << std::endl << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent)); return s.str(); } @@ -318,7 +318,8 @@ namespace armarx string FramedPose::output(const Ice::Current& c) const { std::stringstream s; - s << toEigen() << std::endl << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent)); + const Eigen::IOFormat ArmarXEigenFormat(Eigen::StreamPrecision, 4, " ", "\n", "", ""); + s << toEigen().format(ArmarXEigenFormat) << std::endl << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent)); return s.str(); } @@ -658,7 +659,7 @@ namespace armarx string FramedPosition::output(const Ice::Current& c) const { std::stringstream s; - s << toEigen() << std::endl << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent)); + s << toEigen().format(ArmarXEigenFormat) << std::endl << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent)); return s.str(); } @@ -728,7 +729,7 @@ namespace armarx string FramedOrientation::output(const Ice::Current& c) const { std::stringstream s; - s << toEigen() << std::endl << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent)); + s << toEigen()/*.format(ArmarXEigenFormat)*/ << std::endl << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent)); return s.str(); } diff --git a/source/RobotAPI/libraries/core/Pose.cpp b/source/RobotAPI/libraries/core/Pose.cpp index f6e8963d3..cf2ef51c6 100644 --- a/source/RobotAPI/libraries/core/Pose.cpp +++ b/source/RobotAPI/libraries/core/Pose.cpp @@ -147,7 +147,7 @@ namespace armarx string Vector3::output(const Ice::Current& c) const { std::stringstream s; - s << toEigen(); + s << toEigen().format(ArmarXEigenFormat); return s.str(); } @@ -247,7 +247,7 @@ namespace armarx string Quaternion::output(const Ice::Current& c) const { std::stringstream s; - s << toEigen(); + s << toEigen()/*.format(ArmarXEigenFormat)*/; return s.str(); } @@ -328,7 +328,7 @@ namespace armarx string Pose::output(const Ice::Current& c) const { std::stringstream s; - s << toEigen(); + s << toEigen()/*.format(ArmarXEigenFormat)*/; return s.str(); } diff --git a/source/RobotAPI/libraries/core/Pose.h b/source/RobotAPI/libraries/core/Pose.h index a3c79e750..6911f7870 100644 --- a/source/RobotAPI/libraries/core/Pose.h +++ b/source/RobotAPI/libraries/core/Pose.h @@ -47,6 +47,9 @@ namespace armarx const VariantTypeId Pose = Variant::addTypeName("::armarx::PoseBase"); } + const Eigen::IOFormat ArmarXEigenFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, " ", "\n", "", ""); + + /** * @brief The Vector2 class * @ingroup VariantsGrp -- GitLab