diff --git a/symforce/pybind/cc_sym.pyi b/symforce/pybind/cc_sym.pyi index b9900787a..3c01a75f8 100644 --- a/symforce/pybind/cc_sym.pyi +++ b/symforce/pybind/cc_sym.pyi @@ -26,6 +26,7 @@ from sym import Pose3 from sym import Rot2 from sym import Rot3 from sym import SphericalCameraCal +from sym import Unit3 # isort: off @@ -956,6 +957,10 @@ class Values: Add or update a value by key. Returns true if added, false if updated. + Update a value by index entry with no map lookup (compared to Set(key)). This does NOT add new values and assumes the key exists already. + + Add or update a value by key. Returns true if added, false if updated. + Update a value by index entry with no map lookup (compared to Set(key)). This does NOT add new values and assumes the key exists already. """ @typing.overload @@ -977,6 +982,8 @@ class Values: @typing.overload def set(self, key: Key, value: SphericalCameraCal) -> bool: ... @typing.overload + def set(self, key: Key, value: Unit3) -> bool: ... + @typing.overload def set(self, key: Key, value: float) -> bool: ... @typing.overload def set(self, key: Key, value: numpy.ndarray) -> bool: ... @@ -1001,6 +1008,8 @@ class Values: @typing.overload def set(self, key: index_entry_t, value: SphericalCameraCal) -> None: ... @typing.overload + def set(self, key: index_entry_t, value: Unit3) -> None: ... + @typing.overload def set(self, key: index_entry_t, value: float) -> None: ... @typing.overload def set(self, key: index_entry_t, value: numpy.ndarray) -> None: ... diff --git a/symforce/pybind/cc_values.cc b/symforce/pybind/cc_values.cc index ffbf3cabe..3f4e681fd 100644 --- a/symforce/pybind/cc_values.cc +++ b/symforce/pybind/cc_values.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -274,6 +275,7 @@ void AddValuesWrapper(pybind11::module_ module) { RegisterTypeWithValues(values_class); RegisterTypeWithValues(values_class); RegisterTypeWithValues(values_class); + RegisterTypeWithValues(values_class); RegisterTypeWithValues(values_class); RegisterTypeWithValues(values_class); RegisterTypeWithValues(values_class); diff --git a/symforce/pybind/sym_type_casters.cc b/symforce/pybind/sym_type_casters.cc index 76152d4ec..63aac03b2 100644 --- a/symforce/pybind/sym_type_casters.cc +++ b/symforce/pybind/sym_type_casters.cc @@ -12,6 +12,7 @@ constexpr descr<4> handle_sym_type_name::name; constexpr descr<4> handle_sym_type_name::name; constexpr descr<5> handle_sym_type_name::name; constexpr descr<5> handle_sym_type_name::name; +constexpr descr<5> handle_sym_type_name::name; constexpr descr<13> handle_sym_type_name::name; constexpr descr<21> handle_sym_type_name::name; constexpr descr<24> handle_sym_type_name::name; diff --git a/symforce/pybind/sym_type_casters.h b/symforce/pybind/sym_type_casters.h index 5cf468818..6928edeeb 100644 --- a/symforce/pybind/sym_type_casters.h +++ b/symforce/pybind/sym_type_casters.h @@ -27,6 +27,7 @@ #include #include #include +#include namespace py = pybind11; @@ -59,6 +60,11 @@ struct handle_sym_type_name { static constexpr auto name = _("Pose3"); }; +template <> +struct handle_sym_type_name { + static constexpr auto name = _("Unit3"); +}; + template <> struct handle_sym_type_name { static constexpr auto name = _("ATANCameraCal"); @@ -133,6 +139,8 @@ struct type_caster : public sym_type_caster {}; template <> struct type_caster : public sym_type_caster {}; template <> +struct type_caster : public sym_type_caster {}; +template <> struct type_caster : public sym_type_caster {}; template <> struct type_caster diff --git a/test/symforce_cc_sym_stubs_codegen_test.py b/test/symforce_cc_sym_stubs_codegen_test.py index d61ca2151..35be2545d 100644 --- a/test/symforce_cc_sym_stubs_codegen_test.py +++ b/test/symforce_cc_sym_stubs_codegen_test.py @@ -103,6 +103,7 @@ class TypeStubParts: "Rot2", "Rot3", "SphericalCameraCal", + "Unit3", ], third_party_includes=["import scipy"], cleaned_up_stubgen_output=stubgen_output, diff --git a/test/symforce_values_test.py b/test/symforce_values_test.py index ce1fa5520..ba68cfbe9 100644 --- a/test/symforce_values_test.py +++ b/test/symforce_values_test.py @@ -551,6 +551,7 @@ def test_from_storage_index(self) -> None: sf.Rot3, sf.Pose2, sf.Pose3, + sf.Unit3, sf.Complex, sf.Quaternion, sf.DualQuaternion,