Serialization

release/4.3a0
Frank Dellaert 2019-05-06 19:27:06 -04:00 committed by Fan Jiang
parent 3193af9698
commit 8eacdcbe58
3 changed files with 46 additions and 46 deletions

View File

@ -60,7 +60,7 @@ template <>
SO4 SO4::ChartAtOrigin::Retract(const Vector6 &omega, ChartJacobian H); SO4 SO4::ChartAtOrigin::Retract(const Vector6 &omega, ChartJacobian H);
template <> template <>
Vector6 SO4::ChartAtOrigin::Local(const SO4& R, ChartJacobian H); Vector6 SO4::ChartAtOrigin::Local(const SO4 &Q, ChartJacobian H);
/** /**
* Project to top-left 3*3 matrix. Note this is *not* in general \in SO(3). * Project to top-left 3*3 matrix. Note this is *not* in general \in SO(3).
@ -73,31 +73,30 @@ Matrix3 topLeft(const SO4& Q, OptionalJacobian<9, 6> H = boost::none);
*/ */
Matrix43 stiefel(const SO4 &Q, OptionalJacobian<12, 6> H = boost::none); Matrix43 stiefel(const SO4 &Q, OptionalJacobian<12, 6> H = boost::none);
// private: /** Serialization function */
// /** Serialization function */ template <class Archive>
// friend class boost::serialization::access; void serialize(Archive &ar, SO4 &Q, const unsigned int /*version*/) {
// template <class ARCHIVE> Matrix4 &M = Q.matrix_;
// void serialize(ARCHIVE &ar, const unsigned int /*version*/) { ar &boost::serialization::make_nvp("Q11", M(0, 0));
// ar &boost::serialization::make_nvp("Q11", (*this)(0, 0)); ar &boost::serialization::make_nvp("Q12", M(0, 1));
// ar &boost::serialization::make_nvp("Q12", (*this)(0, 1)); ar &boost::serialization::make_nvp("Q13", M(0, 2));
// ar &boost::serialization::make_nvp("Q13", (*this)(0, 2)); ar &boost::serialization::make_nvp("Q14", M(0, 3));
// ar &boost::serialization::make_nvp("Q14", (*this)(0, 3));
// ar &boost::serialization::make_nvp("Q21", (*this)(1, 0)); ar &boost::serialization::make_nvp("Q21", M(1, 0));
// ar &boost::serialization::make_nvp("Q22", (*this)(1, 1)); ar &boost::serialization::make_nvp("Q22", M(1, 1));
// ar &boost::serialization::make_nvp("Q23", (*this)(1, 2)); ar &boost::serialization::make_nvp("Q23", M(1, 2));
// ar &boost::serialization::make_nvp("Q24", (*this)(1, 3)); ar &boost::serialization::make_nvp("Q24", M(1, 3));
// ar &boost::serialization::make_nvp("Q31", (*this)(2, 0)); ar &boost::serialization::make_nvp("Q31", M(2, 0));
// ar &boost::serialization::make_nvp("Q32", (*this)(2, 1)); ar &boost::serialization::make_nvp("Q32", M(2, 1));
// ar &boost::serialization::make_nvp("Q33", (*this)(2, 2)); ar &boost::serialization::make_nvp("Q33", M(2, 2));
// ar &boost::serialization::make_nvp("Q34", (*this)(2, 3)); ar &boost::serialization::make_nvp("Q34", M(2, 3));
// ar &boost::serialization::make_nvp("Q41", (*this)(3, 0)); ar &boost::serialization::make_nvp("Q41", M(3, 0));
// ar &boost::serialization::make_nvp("Q42", (*this)(3, 1)); ar &boost::serialization::make_nvp("Q42", M(3, 1));
// ar &boost::serialization::make_nvp("Q43", (*this)(3, 2)); ar &boost::serialization::make_nvp("Q43", M(3, 2));
// ar &boost::serialization::make_nvp("Q44", (*this)(3, 3)); ar &boost::serialization::make_nvp("Q44", M(3, 3));
// } }
/* /*
* Define the traits. internal::LieGroup provides both Lie group and Testable * Define the traits. internal::LieGroup provides both Lie group and Testable

View File

@ -270,6 +270,10 @@ class SO : public LieGroup<SO<N>, internal::DimensionSO(N)> {
VectorN2 vec(OptionalJacobian<internal::NSquaredSO(N), dimension> H = VectorN2 vec(OptionalJacobian<internal::NSquaredSO(N), dimension> H =
boost::none) const; boost::none) const;
/// @} /// @}
template <class Archive>
friend void serialize(Archive& ar, SO& R, const unsigned int /*version*/);
friend class boost::serialization::access;
}; };
using SOn = SO<Eigen::Dynamic>; using SOn = SO<Eigen::Dynamic>;

View File

@ -93,23 +93,20 @@ Vector3 SO3::ChartAtOrigin::Local(const SO3& R, ChartJacobian H) {
template <> template <>
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const; Vector9 SO3::vec(OptionalJacobian<9, 3> H) const;
// private: /** Serialization function */
template <class Archive>
// /** Serialization function */ void serialize(Archive& ar, SO3& R, const unsigned int /*version*/) {
// friend class boost::serialization::access; Matrix3& M = R.matrix_;
// template<class ARCHIVE> ar& boost::serialization::make_nvp("R11", M(0, 0));
// void serialize(ARCHIVE & ar, const unsigned int /*version*/) ar& boost::serialization::make_nvp("R12", M(0, 1));
// { ar& boost::serialization::make_nvp("R13", M(0, 2));
// ar & boost::serialization::make_nvp("R11", (*this)(0,0)); ar& boost::serialization::make_nvp("R21", M(1, 0));
// ar & boost::serialization::make_nvp("R12", (*this)(0,1)); ar& boost::serialization::make_nvp("R22", M(1, 1));
// ar & boost::serialization::make_nvp("R13", (*this)(0,2)); ar& boost::serialization::make_nvp("R23", M(1, 2));
// ar & boost::serialization::make_nvp("R21", (*this)(1,0)); ar& boost::serialization::make_nvp("R31", M(2, 0));
// ar & boost::serialization::make_nvp("R22", (*this)(1,1)); ar& boost::serialization::make_nvp("R32", M(2, 1));
// ar & boost::serialization::make_nvp("R23", (*this)(1,2)); ar& boost::serialization::make_nvp("R33", M(2, 2));
// ar & boost::serialization::make_nvp("R31", (*this)(2,0)); }
// ar & boost::serialization::make_nvp("R32", (*this)(2,1));
// ar & boost::serialization::make_nvp("R33", (*this)(2,2));
// }
namespace sot { namespace sot {