diff --git a/python/src/sdf/_gz_sdformat_pybind11.cc b/python/src/sdf/_gz_sdformat_pybind11.cc index 681bf6990..0e64d1e8a 100644 --- a/python/src/sdf/_gz_sdformat_pybind11.cc +++ b/python/src/sdf/_gz_sdformat_pybind11.cc @@ -16,6 +16,7 @@ #include #include +#include #include "pyAirPressure.hh" #include "pyAltimeter.hh" @@ -65,6 +66,12 @@ PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) { m.doc() = "sdformat Python Library."; + // Import the gz.math library to automatically add the type conversions + // this module requires to pass mathematical types to python code. + std::string gzMathModule = + std::string("gz.math") + std::to_string(GZ_MATH_MAJOR_VERSION); + pybind11::module::import(gzMathModule.c_str()); + sdf::python::defineAirPressure(m); sdf::python::defineAltimeter(m); sdf::python::defineAtmosphere(m); diff --git a/python/test/pyAirPressure_TEST.py b/python/test/pyAirPressure_TEST.py index 4abf3bccc..3848f6b16 100644 --- a/python/test/pyAirPressure_TEST.py +++ b/python/test/pyAirPressure_TEST.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from gz.math7 import Vector3d from sdformat13 import AirPressure, Noise import sdformat13 as sdf import unittest diff --git a/python/test/pyAltimeter_TEST.py b/python/test/pyAltimeter_TEST.py index 96253e5da..27e862a74 100644 --- a/python/test/pyAltimeter_TEST.py +++ b/python/test/pyAltimeter_TEST.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from gz.math7 import Vector3d from sdformat13 import Altimeter, Noise import sdformat13 as sdf import unittest diff --git a/python/test/pyAtmosphere_TEST.py b/python/test/pyAtmosphere_TEST.py index d2363c1af..e0ac4d3d6 100644 --- a/python/test/pyAtmosphere_TEST.py +++ b/python/test/pyAtmosphere_TEST.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from gz.math7 import Pose3d, Temperature +from gz.math7 import Temperature from sdformat13 import Atmosphere import sdformat13 as sdf import unittest diff --git a/python/test/pyCapsule_TEST.py b/python/test/pyCapsule_TEST.py index 8924c9ba2..b91ba6eb6 100644 --- a/python/test/pyCapsule_TEST.py +++ b/python/test/pyCapsule_TEST.py @@ -14,8 +14,6 @@ import copy -from gz.math7 import Vector3d, Capsuled - import math from sdformat13 import Capsule diff --git a/python/test/pyCylinder_TEST.py b/python/test/pyCylinder_TEST.py index 55b5ecf9a..50b121991 100644 --- a/python/test/pyCylinder_TEST.py +++ b/python/test/pyCylinder_TEST.py @@ -14,8 +14,6 @@ import copy -from gz.math7 import Vector3d - import math from sdformat13 import Cylinder diff --git a/python/test/pyEllipsoid_TEST.py b/python/test/pyEllipsoid_TEST.py index e66953bb9..d3dd7291a 100644 --- a/python/test/pyEllipsoid_TEST.py +++ b/python/test/pyEllipsoid_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from gz.math7 import Vector3d, Ellipsoidd +from gz.math7 import Vector3d import math from sdformat13 import Ellipsoid import unittest diff --git a/python/test/pyJointAxis_TEST.py b/python/test/pyJointAxis_TEST.py index 4d742de54..96f139f15 100644 --- a/python/test/pyJointAxis_TEST.py +++ b/python/test/pyJointAxis_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from gz.math7 import Pose3d, Vector3d +from gz.math7 import Vector3d from sdformat13 import JointAxis, Error, SDFErrorsException import math import unittest diff --git a/python/test/pyLidar_TEST.py b/python/test/pyLidar_TEST.py index 3b81fa255..585c48259 100644 --- a/python/test/pyLidar_TEST.py +++ b/python/test/pyLidar_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from gz.math7 import Angle, Pose3d, Vector3d, Helpers +from gz.math7 import Angle, Helpers from sdformat13 import Lidar, Error, Noise import math import unittest diff --git a/python/test/pyMagnetometer_TEST.py b/python/test/pyMagnetometer_TEST.py index 9366c0fe3..636a5f3aa 100644 --- a/python/test/pyMagnetometer_TEST.py +++ b/python/test/pyMagnetometer_TEST.py @@ -13,7 +13,6 @@ # limitations under the License. import copy -from gz.math7 import Pose3d from sdformat13 import Magnetometer, Noise import sdformat13 as sdf import unittest diff --git a/python/test/pyModel_TEST.py b/python/test/pyModel_TEST.py index 7d756ceda..ae2e575a0 100644 --- a/python/test/pyModel_TEST.py +++ b/python/test/pyModel_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from gz.math7 import Pose3d, Vector3d +from gz.math7 import Pose3d from sdformat13 import (Plugin, Model, Joint, Link, Error, Frame, SemanticPose, SDFErrorsException) import sdformat13 as sdf diff --git a/python/test/pyPlane_TEST.py b/python/test/pyPlane_TEST.py index 118304b01..66ee406ac 100644 --- a/python/test/pyPlane_TEST.py +++ b/python/test/pyPlane_TEST.py @@ -14,7 +14,7 @@ import copy from sdformat13 import Plane -from gz.math7 import Vector3d, Vector2d, Planed +from gz.math7 import Vector3d, Vector2d import unittest diff --git a/python/test/pyRoot_TEST.py b/python/test/pyRoot_TEST.py index d2fb58ef0..6fc956c9d 100644 --- a/python/test/pyRoot_TEST.py +++ b/python/test/pyRoot_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from gz.math7 import Vector3d, Pose3d +from gz.math7 import Pose3d from sdformat13 import (Error, Model, Light, Root, SDF_VERSION, SDFErrorsException, SDF_PROTOCOL_VERSION, World) import sdformat13 as sdf diff --git a/python/test/pySphere_TEST.py b/python/test/pySphere_TEST.py index 792719f27..ed92a72f3 100644 --- a/python/test/pySphere_TEST.py +++ b/python/test/pySphere_TEST.py @@ -13,7 +13,6 @@ # limitations under the License. import copy -from gz.math7 import Sphered import math from sdformat13 import Sphere import unittest diff --git a/python/test/pyWorld_TEST.py b/python/test/pyWorld_TEST.py index 6c053bdd4..05696766a 100644 --- a/python/test/pyWorld_TEST.py +++ b/python/test/pyWorld_TEST.py @@ -13,7 +13,7 @@ # limitations under the License. import copy -from gz.math7 import Color, Pose3d, Vector3d, SphericalCoordinates +from gz.math7 import Color, Vector3d, SphericalCoordinates from sdformat13 import Atmosphere, Gui, Physics, Plugin, Error, Frame, Light, Model, Scene, World import sdformat13 as sdf import unittest