XmlParserHomogeneousMatrix¶
- class XmlParserHomogeneousMatrix(self)¶
Bases:
pybind11_object
XML parser to load and save an homogeneous matrix in a file.
Warning
This class is only available if pugixml third-party is successfully built.
To have a complete description of the homogeneous matrix implemented in ViSP, see vpHomogeneousMatrix .
Example of an XML file “homogeneous_matrixes.xml” containing a Pose vector that will be converted in an homogeneous matrix:
<?xml version="1.0"?> <root> <homogeneous_transformation> <!--Name of the homogeneous matrix--> <name>eMc</name> <values> <!--Translation vector with values in meters --> <tx>1.00</tx> <ty>1.30</ty> <tz>3.50</tz> <!--Rotational vector expressed in angle axis representation with values in radians --> <theta_ux>0.20</theta_ux> <theta_uy>0.30</theta_uy> <theta_uz>0.50</theta_uz> </values> </homogeneous_transformation> </root>
Example of loading an existing homogeneous matrix from an XML file.
#include <iostream> #include <string> #include <visp3/core/vpXmlParserHomogeneousMatrix.h> int main(int argc, char* argv[]) { vpHomogeneousMatrix eMc; // Create a XML parser vpXmlParserHomogeneousMatrix p; // Define the name of the matrix to load std::string name = "eMc"; if (p.parse(eMc,"homogeneous_matrixes.xml", name) != vpXmlParserHomogeneousMatrix::SEQUENCE_OK) { std::cout << "Cannot found the Homogeneous matrix named " << name << "." << std::endl; } else std::cout << "Homogeneous matrix " << name <<": " << std::endl << eMc << std::endl; return 0; }
Example of writing an homogenoeus matrix in a XML file.
Note
Before writing an homogeneous matrix check if there is already in the xml file a matrix with the same name. If you are sure to overwrite it please delete it manually from the file before.
#include <iostream> #include <string> #include <visp3/core/vpXmlParserHomogeneousMatrix.h> int main(int argc, char* argv[]) { // Create Pose Vector and convert to homogeneous matrix vpPoseVector r(1.0,1.3,3.5,0.2,0.3,0.5); vpHomogeneousMatrix M(r); // Create a XML parser vpXmlParserHomogeneousMatrix p; // Define the name of the matrix std::string name_M = "eMe"; // Define name of the file xml to fill std::string filename = "homogeneous_matrixes.xml"; if (p.save(M, filename, name_M) != vpXmlParserHomogeneousMatrix::SEQUENCE_OK) { std::cout << "Cannot save the Homogeneous matrix" << std::endl; } return 0; }
Methods
Inherited Methods
Operators
__doc__
__module__
Attributes
SEQUENCE_ERROR
SEQUENCE_OK
__annotations__
- class XmlCodeSequenceType(self, value: int)¶
Bases:
pybind11_object
Values:
SEQUENCE_OK
SEQUENCE_ERROR
- getHomogeneousMatrix(self) visp.core.HomogeneousMatrix ¶