|
NASA Astrobee Robot Software
0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
|
Go to the documentation of this file.
19 #ifndef GRAPH_FACTORS_POINT_TO_LINE_SEGMENT_FACTOR_H_
20 #define GRAPH_FACTORS_POINT_TO_LINE_SEGMENT_FACTOR_H_
25 #include <gtsam/geometry/Pose3.h>
26 #include <gtsam/geometry/Point3.h>
39 const double line_length,
const SharedNoiseModel& model, Key pose_key,
45 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
46 return boost::static_pointer_cast<gtsam::NonlinearFactor>(gtsam::NonlinearFactor::shared_ptr(
new This(*
this)));
49 void print(
const std::string& s =
"",
const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const override {
50 std::cout << s <<
"PointToLineSegmentFactor, z = ";
51 std::cout <<
"line length: " << line_length_;
55 bool equals(
const NonlinearFactor& p,
double tol = 1e-9)
const override {
56 const This* e =
dynamic_cast<const This*
>(&p);
60 Vector
evaluateError(
const Pose3& world_T_body, boost::optional<Matrix&> H = boost::none)
const override {
61 const auto line_t_point =
Base::error(world_T_body, H);
62 const auto line_z_point = line_t_point.z();
63 Point3
error = line_t_point;
68 if (line_z_point >= -1.0 * line_length_ / 2.0 && line_z_point <= line_length_ / 2.0) {
71 H->block<1, 6>(2, 0) = Eigen::Matrix<double, 1, 6>::Zero();
73 }
else if (line_z_point < -1.0 * line_length_ / 2.0) {
82 H->block<1, 6>(2, 0) = d_silu_d_z * H->block<1, 6>(2, 0);
94 template <
class ARCHIVE>
95 void serialize(ARCHIVE& ar,
const unsigned int ) {
96 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
97 ar& BOOST_SERIALIZATION_NVP(line_length_);
98 ar& BOOST_SERIALIZATION_NVP(use_silu_);
106 #endif // GRAPH_FACTORS_POINT_TO_LINE_SEGMENT_FACTOR_H_
PointToLineSegmentFactor(const Point3 &sensor_t_point, const Pose3 &world_T_line, const Pose3 &body_T_sensor, const double line_length, const SharedNoiseModel &model, Key pose_key, const bool use_silu=false)
Definition: point_to_line_segment_factor.h:38
Vector error(const Pose3 &world_T_body, boost::optional< Matrix & > H=boost::none) const
Definition: point_to_line_factor_base.h:62
Definition: point_to_line_segment_factor.h:31
double SiluWithOffsetTwoWay(const double x, const double offset, gtsam::OptionalJacobian< 1, 1 > d_silu_d_x=boost::none)
Definition: silu.cc:37
const Point3 & sensor_t_point() const
Definition: point_to_line_factor_base.h:87
Definition: point_to_line_factor_base.h:29
bool use_silu() const
Definition: point_to_line_segment_factor.h:90
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
Definition: point_to_line_factor_base.h:55
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Definition: point_to_line_factor_base.h:47
const Pose3 & world_T_line() const
Definition: point_to_line_factor_base.h:88
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Definition: point_to_line_segment_factor.h:49
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
Definition: point_to_line_segment_factor.h:55
Definition: cumulative_factor.h:26
Vector evaluateError(const Pose3 &world_T_body, boost::optional< Matrix & > H=boost::none) const override
Definition: point_to_line_segment_factor.h:60
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition: point_to_line_segment_factor.h:45
PointToLineSegmentFactor()
Definition: point_to_line_segment_factor.h:36
double line_length() const
Definition: point_to_line_segment_factor.h:89
const Pose3 & body_T_sensor() const
Definition: point_to_line_factor_base.h:89
friend class boost::serialization::access
Definition: point_to_line_segment_factor.h:93