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

Add override keyword to functions in PoseToPointFactor #956

Merged
merged 2 commits into from
Dec 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions gtsam_unstable/slam/PoseToPointFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ class PoseToPointFactor : public NoiseModelFactor2<POSE, POINT> {
/** implement functions needed for Testable */

/** print */
virtual void print(const std::string& s, const KeyFormatter& keyFormatter =
DefaultKeyFormatter) const {
virtual void print(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not have virtual and override. One or the other. Surprised that does not trigger a warning (check clang)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, my mistake! I just fixed it

const std::string& s,
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const override {
std::cout << s << "PoseToPointFactor(" << keyFormatter(this->key1()) << ","
<< keyFormatter(this->key2()) << ")\n"
<< " measured: " << measured_.transpose() << std::endl;
Expand All @@ -55,7 +56,7 @@ class PoseToPointFactor : public NoiseModelFactor2<POSE, POINT> {

/** equals */
virtual bool equals(const NonlinearFactor& expected,
double tol = 1e-9) const {
double tol = 1e-9) const override {
const This* e = dynamic_cast<const This*>(&expected);
return e != nullptr && Base::equals(*e, tol) &&
traits<POINT>::Equals(this->measured_, e->measured_, tol);
Expand All @@ -70,9 +71,10 @@ class PoseToPointFactor : public NoiseModelFactor2<POSE, POINT> {
*
* Note: measured_ and the error are in local coordiantes.
*/
Vector evaluateError(const POSE& w_T_b, const POINT& w_P,
boost::optional<Matrix&> H1 = boost::none,
boost::optional<Matrix&> H2 = boost::none) const {
Vector evaluateError(
const POSE& w_T_b, const POINT& w_P,
boost::optional<Matrix&> H1 = boost::none,
boost::optional<Matrix&> H2 = boost::none) const override {
return w_T_b.transformTo(w_P, H1, H2) - measured_;
}

Expand Down