Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error with Range factor #782

Closed
mc13756 opened this issue Jun 4, 2021 · 4 comments
Closed

Compilation error with Range factor #782

mc13756 opened this issue Jun 4, 2021 · 4 comments

Comments

@mc13756
Copy link

mc13756 commented Jun 4, 2021

I want to create constraint for the distance between two Point2 variables (i.e. fixed distance of 1m). I'm trying to do it with a range factor like this:

`double door_width(1.0);

static SharedNoiseModel width_noise(noiseModel::Unit::Create(1));
graph.emplace_shared<RangeFactor<Point2, Point2>>(next_door_num_left, next_door_num_right, door_width, width_noise);`

with next_door_num_left and next_door_num_right being integers used as variable keys. I get the following compilation error.:

/usr/local/include/gtsam/sam/RangeFactor.h:59:26: error: invalid use of incomplete type ‘struct gtsam::Range<Eigen::Matrix<double, 2, 1>, Eigen::Matrix<double, 2, 1> >’
return Expression(Range<A1, A2>(), a1_, a2_);
^~~~~~~~~~~~~~~
In file included from /usr/local/include/gtsam/geometry/Pose2.h:23:0,
from /home/spyros/catkin_ws/src/door_detector_1/src/graph_creator_1.cpp:12:
/usr/local/include/gtsam/geometry/BearingRange.h:39:8: note: declaration of ‘struct gtsam::Range<Eigen::Matrix<double, 2, 1>, Eigen::Matrix<double, 2, 1> >’
struct Range;

Where does this come from, and how can I fix it?

@ProfFan
Copy link
Collaborator

ProfFan commented Jun 4, 2021

Range is a trait and is not defined for Point2s. I think what you actually want is a BetweenFactor.

@dellaert
Copy link
Member

dellaert commented Jun 4, 2021

No, we just had this discussion on the Google group. It’s quite easy to add this trait for Point2, look at Point3.h. I offered that solution in the Google group and even asked for a PR, which might be forthcoming.

@dellaert
Copy link
Member

dellaert commented Jun 4, 2021

Not a bug, but a feature request. Solution discussed in Google group.

@dellaert dellaert closed this as completed Jun 4, 2021
@dellaert
Copy link
Member

dellaert commented Jun 4, 2021

Will be fixed by #783

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants