diff --git a/gtsam/slam/planarSLAM.h b/gtsam/slam/planarSLAM.h index 8fd568a3b..5c9c62d46 100644 --- a/gtsam/slam/planarSLAM.h +++ b/gtsam/slam/planarSLAM.h @@ -33,15 +33,12 @@ namespace planarSLAM { using namespace gtsam; - /// Typedef for a PoseKey with Pose2 data and 'x' symbol - typedef TypedSymbol PoseKey; - - /// Typedef for a PointKey with Point2 data and 'l' symbol - typedef TypedSymbol PointKey; - /// Convenience function for constructing a pose key inline Symbol PoseKey(Index j) { return Symbol('x', j); } + /// Convenience function for constructing a pose key + inline Symbol PointKey(Index j) { return Symbol('l', j); } + /* * List of typedefs for factors */ @@ -72,16 +69,16 @@ namespace planarSLAM { } /// get a pose - Pose2 pose(int key) const { return (*this)[PoseKey(key)]; } + Pose2 pose(Index key) const { return at(PoseKey(key)); } /// get a point - Point2 point(int key) const { return (*this)[PointKey(key)]; } + Point2 point(Index key) const { return at(PointKey(key)); } /// insert a pose - void insertPose(int key, const Pose2& pose) {insert(PoseKey(key), pose); } + void insertPose(Index key, const Pose2& pose) { insert(PoseKey(key), pose); } /// insert a point - void insertPoint(int key, const Point2& point) {insert(PointKey(key), point); } + void insertPoint(Index key, const Point2& point) { insert(PointKey(key), point); } }; /// Creates a NonlinearFactorGraph with the Values type diff --git a/gtsam/slam/pose2SLAM.h b/gtsam/slam/pose2SLAM.h index ab0c60050..7917a3c79 100644 --- a/gtsam/slam/pose2SLAM.h +++ b/gtsam/slam/pose2SLAM.h @@ -35,6 +35,7 @@ namespace pose2SLAM { /// Convenience function for constructing a pose key inline Symbol PoseKey(Index j) { return Symbol('x', j); } + /// Values class, inherited from Values, using PoseKeys, mainly used as a convenience for MATLAB wrapper struct Values: public gtsam::Values { @@ -49,10 +50,10 @@ namespace pose2SLAM { // Convenience for MATLAB wrapper, which does not allow for identically named methods /// get a pose - Pose2 pose(int key) const { return (*this)[PoseKey(key)]; } + Pose2 pose(Index key) const { return at(PoseKey(key)); } /// insert a pose - void insertPose(int key, const Pose2& pose) { insert(PoseKey(key), pose); } + void insertPose(Index key, const Pose2& pose) { insert(PoseKey(key), pose); } }; /**