Specify key involved when throwing cheirality exception
parent
dccc742490
commit
2af48952b2
|
|
@ -32,9 +32,17 @@ namespace gtsam {
|
||||||
class GTSAM_EXPORT CheiralityException: public ThreadsafeException<
|
class GTSAM_EXPORT CheiralityException: public ThreadsafeException<
|
||||||
CheiralityException> {
|
CheiralityException> {
|
||||||
public:
|
public:
|
||||||
CheiralityException() :
|
CheiralityException()
|
||||||
ThreadsafeException<CheiralityException>("Cheirality Exception") {
|
: CheiralityException(std::numeric_limits<Key>::max()) {}
|
||||||
}
|
|
||||||
|
CheiralityException(Key j)
|
||||||
|
: ThreadsafeException<CheiralityException>("CheiralityException"),
|
||||||
|
j_(j) {}
|
||||||
|
|
||||||
|
Key nearbyVariable() const {return j_;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Key j_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,19 @@ namespace gtsam {
|
||||||
|
|
||||||
class GTSAM_EXPORT StereoCheiralityException: public std::runtime_error {
|
class GTSAM_EXPORT StereoCheiralityException: public std::runtime_error {
|
||||||
public:
|
public:
|
||||||
StereoCheiralityException() :
|
StereoCheiralityException()
|
||||||
std::runtime_error("Stereo Cheirality Exception") {
|
: StereoCheiralityException(std::numeric_limits<Key>::max()) {}
|
||||||
|
|
||||||
|
StereoCheiralityException(Key j)
|
||||||
|
: std::runtime_error("Stereo Cheirality Exception"),
|
||||||
|
j_(j) {}
|
||||||
|
|
||||||
|
Key nearbyVariable() const {
|
||||||
|
return j_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Key j_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ namespace gtsam {
|
||||||
std::cout << e.what() << ": Landmark "<< DefaultKeyFormatter(this->key2()) <<
|
std::cout << e.what() << ": Landmark "<< DefaultKeyFormatter(this->key2()) <<
|
||||||
" moved behind camera " << DefaultKeyFormatter(this->key1()) << std::endl;
|
" moved behind camera " << DefaultKeyFormatter(this->key1()) << std::endl;
|
||||||
if (throwCheirality_)
|
if (throwCheirality_)
|
||||||
throw e;
|
throw CheiralityException(this->key2());
|
||||||
}
|
}
|
||||||
return Vector2::Constant(2.0 * K_->fx());
|
return Vector2::Constant(2.0 * K_->fx());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public:
|
||||||
std::cout << e.what() << ": Landmark "<< DefaultKeyFormatter(this->key2()) <<
|
std::cout << e.what() << ": Landmark "<< DefaultKeyFormatter(this->key2()) <<
|
||||||
" moved behind camera " << DefaultKeyFormatter(this->key1()) << std::endl;
|
" moved behind camera " << DefaultKeyFormatter(this->key1()) << std::endl;
|
||||||
if (throwCheirality_)
|
if (throwCheirality_)
|
||||||
throw e;
|
throw StereoCheiralityException(this->key2());
|
||||||
}
|
}
|
||||||
return Vector3::Constant(2.0 * K_->fx());
|
return Vector3::Constant(2.0 * K_->fx());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue