diff --git a/source/RobotAPI/libraries/core/FramedPose.cpp b/source/RobotAPI/libraries/core/FramedPose.cpp index de30cd40ab4a64109dd778e54447236f3ebf1137..4b22c5cff5fd77119a7ee3f1841ea811a9488730 100644 --- a/source/RobotAPI/libraries/core/FramedPose.cpp +++ b/source/RobotAPI/libraries/core/FramedPose.cpp @@ -1,11 +1,6 @@ #include <RobotAPI/libraries/core/FramedPose.h> #include <RobotAPI/libraries/core/remoterobot/RemoteRobot.h> -// boost includes -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/xml_parser.hpp> - - #include <VirtualRobot/Robot.h> #include <VirtualRobot/LinkedCoordinate.h> @@ -169,34 +164,6 @@ namespace armarx return toNewFrame; } - int FramedDirection::readFromXML(const string& xmlData, const Ice::Current& c) - { - int result = Vector3::readFromXML(xmlData); - - boost::property_tree::ptree pt = Variant::GetPropertyTree(xmlData); - - frame = (pt.get<std::string>("frame")); - - return result; - } - - string FramedDirection::writeAsXML(const Ice::Current& c) - { - using namespace boost::property_tree; - ptree pt = Variant::GetPropertyTree(Vector3::writeAsXML()); - pt.add("frame", frame); - -#if BOOST_VERSION >= 105600 - boost::property_tree::xml_parser::xml_writer_settings<std::string> settings('\t', 1); -#else - boost::property_tree::xml_parser::xml_writer_settings<char> settings('\t', 1); -#endif - - std::stringstream stream; - xml_parser::write_xml(stream, pt, settings); - - return stream.str(); - } void FramedDirection::serialize(const ObjectSerializerBasePtr& serializer, const Ice::Current&) const { @@ -361,25 +328,6 @@ namespace armarx return newPose; } - int FramedPose::readFromXML(const string& xmlData, const Ice::Current& c) - { - boost::property_tree::ptree pt = Variant::GetPropertyTree(xmlData); - - - Pose::readFromXML(xmlData); - frame = (pt.get<std::string>("frame")); - - return 1; - } - - string FramedPose::writeAsXML(const Ice::Current&) - { - using namespace boost::property_tree; - std::stringstream stream; - stream << Pose::writeAsXML() - << "<frame>" << frame << "</frame>"; - return stream.str(); - } FramedPositionPtr FramedPose::getPosition() const { @@ -549,31 +497,6 @@ namespace armarx return s.str(); } - int FramedPosition::readFromXML(const string& xmlData, const Ice::Current& c) - { - using namespace boost::property_tree; - ptree pt; - std::stringstream stream; - stream << xmlData; - xml_parser::read_xml(stream, pt); - - Vector3::readFromXML(xmlData); - frame = (pt.get<std::string>("frame")); - agent = (pt.get<std::string>("agent")); - - return 1; - } - - string FramedPosition::writeAsXML(const Ice::Current&) - { - using namespace boost::property_tree; - std::stringstream stream; - stream << Vector3::writeAsXML() << - "<frame>" << frame << "</frame>" << - "<agent>" << agent << "</agent>"; - return stream.str(); - } - void FramedPosition::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c) const { AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer); @@ -729,31 +652,6 @@ namespace armarx return newPos; } - int FramedOrientation::readFromXML(const string& xmlData, const Ice::Current& c) - { - using namespace boost::property_tree; - ptree pt; - std::stringstream stream; - stream << xmlData; - xml_parser::read_xml(stream, pt); - - Quaternion::readFromXML(xmlData); - frame = (pt.get<std::string>("frame")); - agent = (pt.get<std::string>("agent")); - - return 1; - } - - string FramedOrientation::writeAsXML(const Ice::Current&) - { - using namespace boost::property_tree; - std::stringstream stream; - stream << Quaternion::writeAsXML() << - "<frame>" << frame << "</frame>" << - "<agent>" << agent << "</agent>"; - return stream.str(); - } - void FramedOrientation::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c) const { AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer); diff --git a/source/RobotAPI/libraries/core/FramedPose.h b/source/RobotAPI/libraries/core/FramedPose.h index b247d8aaa8534175a05f089bfc9a55bdfaf6e443..fb60bb5e3c3eceb404bde7d9b8b94b23851f386f 100644 --- a/source/RobotAPI/libraries/core/FramedPose.h +++ b/source/RobotAPI/libraries/core/FramedPose.h @@ -22,19 +22,20 @@ #ifndef _ARMARX_COMPONENT_RobotAPI_FramedPose_H #define _ARMARX_COMPONENT_RobotAPI_FramedPose_H -#include <sstream> -#include <Eigen/Core> -#include <Eigen/Geometry> +#include "Pose.h" #include <RobotAPI/interface/core/FramedPoseBase.h> #include <RobotAPI/interface/core/RobotState.h> + #include <ArmarXCore/observers/variant/Variant.h> #include <ArmarXCore/observers/AbstractObjectSerializer.h> - #include <ArmarXCore/core/exceptions/local/ExpressionException.h> -#include <RobotAPI/libraries/core/Pose.h> +#include <Eigen/Core> +#include <Eigen/Geometry> + +#include <sstream> namespace VirtualRobot { @@ -113,23 +114,6 @@ namespace armarx return true; } - /** - * @brief Implementation of virtual function to read a FramedDirection from an XML-file. - *Example xml-layout: - * @code - * <frame>leftHand</frame> - * <x>0</x> - * <y>0</y> - * <z>0</z> - * @endcode - - * @param xmlData String with xml-data. NOT a file path! - * @return ErrorCode, 1 on Success - * @deprecated - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); - friend std::ostream& operator<<(std::ostream& stream, const FramedDirection& rhs) { stream << "FramedDirection: " << std::endl << rhs.output() << std::endl; @@ -191,23 +175,6 @@ namespace armarx return true; } - /** - * @brief Implementation of virtual function to read a FramedPosition from an XML-file. - *Example xml-layout: - * @code - * <frame>leftHand</frame> - * <x>0</x> - * <y>0</y> - * <z>0</z> - * @endcode - - * @param xmlData String with xml-data. NOT a file path! - * @return ErrorCode, 1 on Success - * @deprecated - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); - friend std::ostream& operator<<(std::ostream& stream, const FramedPosition& rhs) { stream << "FramedPosition: " << std::endl << rhs.output() << std::endl; @@ -265,24 +232,6 @@ namespace armarx void changeToGlobal(const VirtualRobot::RobotPtr& referenceRobot); FramedOrientationPtr toGlobal(const SharedRobotInterfacePrx& referenceRobot) const; FramedOrientationPtr toGlobal(const VirtualRobot::RobotPtr& referenceRobot) const; - /** - * @brief Implementation of virtual function to read a FramedOrientation from an XML-file. - *Example xml-layout: - * @code - * <frame>leftHand</frame> - * <qw>0.45</qw> - * <qx>0.2</qx> - * <qy>0</qy> - * <qz>0</qz> - * @endcode - - * @param xmlData String with xml-data. NOT a file path! - * @param c - * @return ErrorCode, 1 on Success - * @deprecated - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); friend std::ostream& operator<<(std::ostream& stream, const FramedOrientation& rhs) { @@ -349,25 +298,6 @@ namespace armarx FramedPosePtr toGlobal(const SharedRobotInterfacePrx& referenceRobot) const; FramedPosePtr toGlobal(const VirtualRobot::RobotPtr& referenceRobot) const; - - - /** - * @brief Implementation of virtual function to read a FramedPose from an XML-file. - *Example xml-layout: - * @code - * <frame>leftHand</frame> - * <x>0</x> - * <y>0</y> - * <z>0</z> - * @endcode - - * @param xmlData String with xml-data. NOT a file path! - * @return ErrorCode, 1 on Success - * @deprecated - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); - friend std::ostream& operator<<(std::ostream& stream, const FramedPose& rhs) { stream << "FramedPose: " << std::endl << rhs.output() << std::endl; diff --git a/source/RobotAPI/libraries/core/LinkedPose.cpp b/source/RobotAPI/libraries/core/LinkedPose.cpp index ea4ebcb674a323ed0c2dd1083608ec9f1d0e462f..b5c09569e34b067cfe10c6d63027745a67dfb15d 100644 --- a/source/RobotAPI/libraries/core/LinkedPose.cpp +++ b/source/RobotAPI/libraries/core/LinkedPose.cpp @@ -1,18 +1,15 @@ #include "LinkedPose.h" #include <RobotAPI/libraries/core/remoterobot/RemoteRobot.h> -//#include "SharedRobotServants.h" #include <ArmarXCore/core/logging/Logging.h> -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/xml_parser.hpp> - #include <Eigen/Geometry> #include <Eigen/Core> #include <VirtualRobot/LinkedCoordinate.h> #include <VirtualRobot/VirtualRobot.h> + #include <Ice/ObjectAdapter.h> @@ -154,38 +151,6 @@ namespace armarx } - int LinkedPose::readFromXML(const std::string& xmlData, const Ice::Current& c) - { - using namespace boost::property_tree; - ptree pt; - std::stringstream stream; - stream << xmlData; - xml_parser::read_xml(stream, pt); - - Pose::readFromXML(xmlData); - frame = (pt.get<std::string>("frame")); - - std::string remoteRobotId = pt.get<std::string>("referenceRobot"); - referenceRobot = SharedRobotInterfacePrx::uncheckedCast(c.adapter->getCommunicator()->stringToProxy(remoteRobotId)); - - if (!referenceRobot) - { - ARMARX_ERROR_S << "ReferenceRobot for LinkedPose not registered: " << remoteRobotId << flush; - return 0; - } - - return 1; - } - - std::string LinkedPose::writeAsXML(const Ice::Current& c) - { - using namespace boost::property_tree; - std::stringstream stream; - stream << FramedPose::writeAsXML() - << "<referenceRobot>" << "Not serializable" << "</referenceRobot>"; - return stream.str(); - } - void LinkedPose::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c) const { AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer); @@ -280,17 +245,6 @@ namespace armarx frame = frVec->frame; } - int LinkedDirection::readFromXML(const std::string& xmlData, const Ice::Current& c) - { - throw LocalException("LinkedDirection cannot be serialized! Serialize FramedDirection"); - - } - - std::string LinkedDirection::writeAsXML(const Ice::Current& c) - { - throw LocalException("LinkedDirection cannot be deserialized! Serialize FramedDirection"); - - } void LinkedDirection::serialize(const ObjectSerializerBasePtr& serializer, const Ice::Current&) const { diff --git a/source/RobotAPI/libraries/core/LinkedPose.h b/source/RobotAPI/libraries/core/LinkedPose.h index 0ccf2b21043908ad6969065f4a53823adec6741a..fe3d681765748639dd6fbf1b4d2b8867ff1554a2 100644 --- a/source/RobotAPI/libraries/core/LinkedPose.h +++ b/source/RobotAPI/libraries/core/LinkedPose.h @@ -34,8 +34,6 @@ #include <Eigen/Core> #include <Eigen/Geometry> - - #include <sstream> @@ -89,23 +87,6 @@ namespace armarx void changeToGlobal(); LinkedPosePtr toGlobal() const; - /** - * @brief Implementation of virtual function to read a LinkedPose from an XML-file. - *Example xml-layout: - * @code - * <referenceRobot>5029a22c-e333-4f87-86b1-cd5e0fcce509</referenceRobot> - * <frame>leftHand</frame> - * <x>0</x> - * <y>0</y> - * <z>0</z> - * @endcode - - * @param xmlData Strinconst SharedRobotInterfacePrx& referenceRobotg with xml-data. NOT a file path! - * @return ErrorCode, 1 on Success - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); - friend std::ostream& operator<<(std::ostream& stream, const LinkedPose& rhs) { stream << "LinkedPose: " << std::endl << rhs.output() << std::endl; @@ -170,9 +151,6 @@ namespace armarx } - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); - friend std::ostream& operator<<(std::ostream& stream, const LinkedDirection& rhs) { stream << "LinkedDirection: " << std::endl << rhs.output() << std::endl; diff --git a/source/RobotAPI/libraries/core/Pose.cpp b/source/RobotAPI/libraries/core/Pose.cpp index 5ee4cbed2688553a928cd4191b84286935df9d3d..e44d4a9f9453920deb25e6470cc9369b16302999 100644 --- a/source/RobotAPI/libraries/core/Pose.cpp +++ b/source/RobotAPI/libraries/core/Pose.cpp @@ -1,11 +1,5 @@ #include "Pose.h" -// boost includes -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/xml_parser.hpp> - - - #include <VirtualRobot/Robot.h> #include <VirtualRobot/LinkedCoordinate.h> #include <VirtualRobot/LinkedCoordinate.h> @@ -55,27 +49,6 @@ namespace armarx return s.str(); } - int Vector2::readFromXML(const string& xmlData, const Ice::Current& c) - { - boost::property_tree::ptree pt = Variant::GetPropertyTree(xmlData); - - x = (pt.get<float>("x")); - y = (pt.get<float>("y")); - return 1; - } - - string Vector2::writeAsXML(const Ice::Current&) - { - using namespace boost::property_tree; - ptree pt; - pt.add("x", x); - pt.add("y", y); - - std::stringstream stream; - xml_parser::write_xml(stream, pt); - return stream.str(); - } - void Vector2::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current&) const { AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer); @@ -141,29 +114,6 @@ namespace armarx return s.str(); } - int Vector3::readFromXML(const string& xmlData, const Ice::Current& c) - { - boost::property_tree::ptree pt = Variant::GetPropertyTree(xmlData); - - x = (pt.get<float>("x")); - y = (pt.get<float>("y")); - z = (pt.get<float>("z")); - return 1; - } - - string Vector3::writeAsXML(const Ice::Current&) - { - using namespace boost::property_tree; - ptree pt; - pt.add("x", x); - pt.add("y", y); - pt.add("z", z); - - std::stringstream stream; - xml_parser::write_xml(stream, pt); - return stream.str(); - } - void Vector3::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current&) const { AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer); @@ -264,54 +214,6 @@ namespace armarx return s.str(); } - int Quaternion::readFromXML(const string& xmlData, const Ice::Current& c) - { - boost::property_tree::ptree pt = Variant::GetPropertyTree(xmlData); - - using namespace Eigen; - - Quaternionf q; - - if (pt.get_optional<float>("angle")) - { - // AxisAngle-Notation - float angle = pt.get<float>("angle"); - - Vector3f axis; - axis << pt.get<float>("x") , pt.get<float>("y"), pt.get<float>("z"); - - AngleAxisf aa(angle, axis); - q = aa; - qw = q.w(); - qx = q.x(); - qy = q.y(); - qz = q.z(); - } - else - { - qx = (pt.get<float>("qx")); - qy = (pt.get<float>("qy")); - qz = (pt.get<float>("qz")); - qw = (pt.get<float>("qw")); - } - - return 1; - } - - string Quaternion::writeAsXML(const Ice::Current&) - { - using namespace boost::property_tree; - ptree pt; - pt.add("qx", qx); - pt.add("qy", qy); - pt.add("qz", qz); - pt.add("qw", qw); - - std::stringstream stream; - xml_parser::write_xml(stream, pt); - return stream.str(); - } - void Quaternion::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current&) const { AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer); @@ -393,23 +295,6 @@ namespace armarx return s.str(); } - int Pose::readFromXML(const string& xmlData, const Ice::Current& c) - { - position->readFromXML(xmlData); - orientation->readFromXML(xmlData); - - return 1; - } - - string Pose::writeAsXML(const Ice::Current&) - { - using namespace boost::property_tree; - std::stringstream stream; - stream << - position->writeAsXML() << - orientation->writeAsXML(); - return stream.str(); - } void Pose::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c) const { diff --git a/source/RobotAPI/libraries/core/Pose.h b/source/RobotAPI/libraries/core/Pose.h index b5566e1d13eaedd204965369a7423348cfaf7af4..82890a9438623fa5909789a905228e2b308f0813 100644 --- a/source/RobotAPI/libraries/core/Pose.h +++ b/source/RobotAPI/libraries/core/Pose.h @@ -23,15 +23,16 @@ #ifndef _ARMARX_COMPONENT_RobotAPI_Pose_H #define _ARMARX_COMPONENT_RobotAPI_Pose_H -#include <sstream> -#include <Eigen/Core> -#include <Eigen/Geometry> +#include <RobotAPI/interface/core/PoseBase.h> #include <ArmarXCore/observers/variant/Variant.h> #include <ArmarXCore/observers/AbstractObjectSerializer.h> #include <ArmarXCore/core/exceptions/local/ExpressionException.h> -#include <RobotAPI/interface/core/PoseBase.h> +#include <Eigen/Core> +#include <Eigen/Geometry> + +#include <sstream> namespace armarx @@ -79,25 +80,11 @@ namespace armarx return true; } - /** - * @brief Implementation of virtual function to read a Vector2 from an XML-file. - *Example xml-layout: - * @code - * <x>0</x> - * <y>0</y> - * @endcode - - * @param xmlData String with xml-data. NOT a file path! - * @return ErrorCode, 1 on Success - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); - friend std::ostream& operator<<(std::ostream& stream, const Vector2& rhs) { stream << "Vector2: " << std::endl << rhs.output() << std::endl; return stream; - }; + } public: // serialization virtual void serialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = ::Ice::Current()) const; @@ -145,26 +132,12 @@ namespace armarx return true; } - /** - * @brief Implementation of virtual function to read a Vector3 from an XML-file. - *Example xml-layout: - * @code - * <x>0</x> - * <y>0</y> - * <z>0</z> - * @endcode - - * @param xmlData String with xml-data. NOT a file path! - * @return ErrorCode, 1 on Success - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); friend std::ostream& operator<<(std::ostream& stream, const Vector3& rhs) { stream << "Vector3: " << std::endl << rhs.output() << std::endl; return stream; - }; + } public: // serialization virtual void serialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = ::Ice::Current()) const; @@ -215,37 +188,12 @@ namespace armarx return true; } - /** - * @brief Implementation of virtual function to read a Quaternion from an XML-file. - *Example xml-layout: - * @code - * <qw>0</qw> - * <qx>0</qx> - * <qy>0</qy> - * <qz>0</qz> - * @endcode - * - *OR in AngleAxis-Notation with radiant - * - * @code - * <angle>0.5</qw> - * <x>0.2</x> - * <y>0.1</y> - * <z>0.7</z> - * @endcode - * - * @param xmlData String with xml-data. NOT a file path! - * @param c - * @return ErrorCode, 1 on Success - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); friend std::ostream& operator<<(std::ostream& stream, const Quaternion& rhs) { stream << "Quaternion: " << std::endl << rhs.output() << std::endl; return stream; - }; + } public: // serialization virtual void serialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = ::Ice::Current()) const; @@ -297,33 +245,11 @@ namespace armarx return true; } - /** - * @brief Implementation of virtual function to read a FramedOrientation from an XML-file. - *Example xml-layout: - * @code - * <frame>leftHand</frame> - * <x>0</x> - * <y>0</y> - * <z>0</z> - * <qw>0.45</qw> - * <qx>0.2</qx> - * <qy>0</qy> - * <qz>0</qz> - * @endcode - - * @param xmlData String with xml-data. NOT a file path! - * @param c - * @return ErrorCode, 1 on Success - * @see Quaternion::readFromXml() for AxisAngle-Notation - */ - int readFromXML(const std::string& xmlData, const Ice::Current& c = ::Ice::Current()); - std::string writeAsXML(const Ice::Current& c = ::Ice::Current()); - friend std::ostream& operator<<(std::ostream& stream, const Pose& rhs) { stream << "Pose: " << std::endl << rhs.output() << std::endl; return stream; - }; + } public: // serialization virtual void serialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = ::Ice::Current()) const;