Pose2SLAMExample.m 566 B

1234567891011121314
  1. graph = NonlinearFactorGraph;
  2. priorNoise = noiseModel.Diagonal.Sigmas([0.3; 0.3; 0.1]);
  3. graph.add(PriorFactorPose2(1, Pose2(0, 0, 0), priorNoise));
  4. %% Add odometry factors
  5. model = noiseModel.Diagonal.Sigmas([0.2; 0.2; 0.1]);
  6. graph.add(BetweenFactorPose2(1, 2, Pose2(2, 0, 0 ), model));
  7. graph.add(BetweenFactorPose2(2, 3, Pose2(2, 0, pi/2), model));
  8. graph.add(BetweenFactorPose2(3, 4, Pose2(2, 0, pi/2), model));
  9. graph.add(BetweenFactorPose2(4, 5, Pose2(2, 0, pi/2), model));
  10. %% Add pose constraint
  11. graph.add(BetweenFactorPose2(5, 2, Pose2(2, 0, pi/2), model));