fleshed out visualSLAM namespace for Matlab wrapping
parent
6bf036d3c1
commit
c558a67786
|
|
@ -181,7 +181,7 @@ Cal3_S2 cal1(1.0, 2.0, 0.3, 0.1, 0.5);
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST (Serialization, visual_system) {
|
TEST (Serialization, visual_system) {
|
||||||
using namespace visualSLAM;
|
using namespace visualSLAM;
|
||||||
Values values;
|
visualSLAM::Values values;
|
||||||
Symbol x1('x',1), x2('x',2);
|
Symbol x1('x',1), x2('x',2);
|
||||||
Symbol l1('l',1), l2('l',2);
|
Symbol l1('l',1), l2('l',2);
|
||||||
Pose3 pose1 = pose3, pose2 = pose3.inverse();
|
Pose3 pose1 = pose3, pose2 = pose3.inverse();
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,13 @@ namespace visualSLAM {
|
||||||
push_back(factor);
|
push_back(factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
void Graph::addStereoMeasurement(const StereoPoint2& measured, const SharedNoiseModel& model,
|
||||||
|
Key poseKey, Key pointKey, const shared_ptrKStereo& K) {
|
||||||
|
boost::shared_ptr<StereoFactor> factor(new StereoFactor(measured, model, poseKey, pointKey, K));
|
||||||
|
push_back(factor);
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void Graph::addPoseConstraint(Key poseKey, const Pose3& p) {
|
void Graph::addPoseConstraint(Key poseKey, const Pose3& p) {
|
||||||
boost::shared_ptr<PoseConstraint> factor(new PoseConstraint(poseKey, p));
|
boost::shared_ptr<PoseConstraint> factor(new PoseConstraint(poseKey, p));
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,27 @@ namespace visualSLAM {
|
||||||
typedef GenericProjectionFactor<Pose3, Point3> ProjectionFactor;
|
typedef GenericProjectionFactor<Pose3, Point3> ProjectionFactor;
|
||||||
typedef GenericStereoFactor<Pose3, Point3> StereoFactor;
|
typedef GenericStereoFactor<Pose3, Point3> StereoFactor;
|
||||||
|
|
||||||
|
/// Values class, inherited from Values, mainly used as a convenience for MATLAB wrapper
|
||||||
|
struct Values: public gtsam::Values {
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<Values> shared_ptr;
|
||||||
|
|
||||||
|
/// Default constructor
|
||||||
|
Values() {}
|
||||||
|
|
||||||
|
/// Copy constructor
|
||||||
|
Values(const gtsam::Values& values) :
|
||||||
|
gtsam::Values(values) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// insert a pose
|
||||||
|
void insertPose(Key i, const Pose3& pose) { insert(i, pose); }
|
||||||
|
|
||||||
|
/// get a pose
|
||||||
|
Pose3 pose(Key i) const { return at<Pose3>(i); }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non-linear factor graph for vanilla visual SLAM
|
* Non-linear factor graph for vanilla visual SLAM
|
||||||
*/
|
*/
|
||||||
|
|
@ -80,6 +101,17 @@ namespace visualSLAM {
|
||||||
void addMeasurement(const Point2& measured, const SharedNoiseModel& model,
|
void addMeasurement(const Point2& measured, const SharedNoiseModel& model,
|
||||||
Key poseKey, Key pointKey, const shared_ptrK& K);
|
Key poseKey, Key pointKey, const shared_ptrK& K);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a stereo factor measurement
|
||||||
|
* @param measured the measurement
|
||||||
|
* @param model the noise model for the measurement
|
||||||
|
* @param poseKey variable key for the camera pose
|
||||||
|
* @param pointKey variable key for the landmark
|
||||||
|
* @param K shared pointer to stereo calibration object
|
||||||
|
*/
|
||||||
|
void addStereoMeasurement(const StereoPoint2& measured, const SharedNoiseModel& model,
|
||||||
|
Key poseKey, Key pointKey, const shared_ptrKStereo& K);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a constraint on a pose (for now, *must* be satisfied in any Values)
|
* Add a constraint on a pose (for now, *must* be satisfied in any Values)
|
||||||
* @param key variable key of the camera pose
|
* @param key variable key of the camera pose
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue