speedFactor.h 786 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // Created by zx on 23-6-13.
  3. //
  4. #ifndef GTSAM_TEST_SPEEDFACTOR_H
  5. #define GTSAM_TEST_SPEEDFACTOR_H
  6. #include <ostream>
  7. #include <gtsam/base/Testable.h>
  8. #include <gtsam/base/Lie.h>
  9. #include <gtsam/nonlinear/NonlinearFactor.h>
  10. #include <gtsam/geometry/Pose2.h>
  11. using namespace gtsam;
  12. class SpeedFactor: public NoiseModelFactor2<gtsam::Pose2, gtsam::Pose2>{
  13. public:
  14. SpeedFactor(Key i,Key j,double v,double w,const SharedNoiseModel& model):
  15. v_(v),w_(w),NoiseModelFactor2<Pose2,Pose2>(model,i,j){
  16. }
  17. virtual ~SpeedFactor(){}
  18. Vector evaluateError(const Pose2& p1, const Pose2& p2, boost::optional<Matrix&> H1 =
  19. boost::none, boost::optional<Matrix&> H2 = boost::none) const {
  20. }
  21. protected:
  22. double v_;
  23. double w_;
  24. };
  25. #endif //GTSAM_TEST_SPEEDFACTOR_H