Go to the documentation of this file.
33 static const Rot2
R_PI_2(Rot2::fromCosSin(0., 1.));
37 Matrix2
R = r_.matrix();
39 R0.block<2,2>(0,0) =
R;
42 T << t_.x(), t_.y(), 1.0;
44 RT_.block<3,2>(0,0) =
R0;
45 RT_.block<3,1>(0,2) =
T;
51 std::cout << (
s.empty() ?
s :
s +
" ") << *
this << std::endl;
56 os <<
"(" <<
pose.x() <<
", " <<
pose.y() <<
", " <<
pose.theta() <<
")";
61 bool Pose2::equals(
const Pose2&
q,
double tol)
const {
67 assert(
xi.size() == 3);
68 if (
H) *
H = Pose2::ExpmapDerivative(
xi);
70 const double w =
xi(2);
74 const Rot2 R(Rot2::fromAngle(
w));
76 const Point2 t = (v_ortho -
R.rotate(v_ortho)) /
w;
83 if (
H) *
H = Pose2::LogmapDerivative(
p);
90 double c_1 =
R.c()-1.0,
s =
R.s();
91 double det = c_1*c_1 +
s*
s;
100 #ifdef GTSAM_SLOW_BUT_CORRECT_EXPMAP
112 #ifdef GTSAM_SLOW_BUT_CORRECT_EXPMAP
126 Matrix3 Pose2::AdjointMap()
const {
127 double c = r_.c(),
s = r_.s(),
x = t_.x(),
y = t_.y();
148 Matrix3 Pose2::ExpmapDerivative(
const Vector3&
v) {
163 J << sZalpha, -c_1Zalpha, v1Zalpha + v2Zalpha*c_1Zalpha - v1Zalpha*sZalpha,
164 c_1Zalpha, sZalpha, -v1Zalpha*c_1Zalpha + v2Zalpha - v2Zalpha*sZalpha,
179 Matrix3 Pose2::LogmapDerivative(
const Pose2&
p) {
184 double alphaInv = 1/
alpha;
186 double v1 =
v[0],
v2 =
v[1];
188 J <<
alpha*halfCotHalfAlpha, -0.5*
alpha,
v1*alphaInv -
v1*halfCotHalfAlpha + 0.5*
v2,
189 0.5*
alpha,
alpha*halfCotHalfAlpha,
v2*alphaInv - 0.5*
v1 -
v2*halfCotHalfAlpha,
202 return Pose2(r_.inverse(), r_.unrotate(
Point2(-t_.x(), -t_.y())));
211 const Point2 q = r_.unrotate(
point - t_, Hrotation, Hpoint);
212 if (Htranslation) *Htranslation << -1.0, 0.0, 0.0, -1.0;
217 if (points.rows() != 2) {
218 throw std::invalid_argument(
"Pose2:transformTo expects 2*N matrix.");
221 return Rt * (points.colwise() - t_);
231 if (Htranslation) *Htranslation = (Hpoint ? *Hpoint : r_.matrix());
237 if (points.rows() != 2) {
238 throw std::invalid_argument(
"Pose2:transformFrom expects 2*N matrix.");
241 return (
R * points).colwise() + t_;
248 Matrix23 D_d_pose; Matrix2 D_d_point;
250 if (!Hpose && !Hpoint)
return Rot2::relativeBearing(
d);
252 Rot2 result = Rot2::relativeBearing(
d, Hpose || Hpoint ? &D_result_d : 0);
253 if (Hpose) *Hpose = D_result_d * D_d_pose;
254 if (Hpoint) *Hpoint = D_result_d * D_d_point;
264 Matrix12 H2_ = D2 *
pose.r().matrix();
265 *Hother << H2_, Z_1x1;
273 if (!Hpose && !Hpoint)
return d.norm();
275 double r =
norm2(
d, D_r_d);
278 D_d_pose << -r_.c(), r_.s(), 0.0,
279 -r_.s(), -r_.c(), 0.0;
280 *Hpose = D_r_d * D_d_pose;
282 if (Hpoint) *Hpoint = D_r_d;
291 if (!Hpose && !Hother)
return d.norm();
293 double r =
norm2(
d, D_r_d);
297 -r_.c(), r_.s(), 0.0,
298 -r_.s(), -r_.c(), 0.0;
299 *Hpose = D_r_d * D_d_pose;
306 *Hother = D_r_d * D_d_other;
331 const size_t n = ab_pairs.size();
337 Point2 ca(0, 0), cb(0, 0);
342 const double f = 1.0/
n;
349 Point2 da = pair.first - ca;
350 Point2 db = pair.second - cb;
351 c += db.x() * da.x() + db.y() * da.y();
352 s += -db.y() * da.x() + db.x() * da.y();
356 const double theta =
atan2(
s,
c);
357 const Rot2 R = Rot2::fromAngle(theta);
363 if (
a.rows() != 2 ||
b.rows() != 2 ||
a.cols() !=
b.cols()) {
364 throw std::invalid_argument(
365 "Pose2:Align expects 2*N matrices of equal shape.");
369 ab_pairs.emplace_back(
a.col(
j),
b.col(
j));
Rot3 rotation(const Pose3 &pose, OptionalJacobian< 3, 6 > H)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
const EIGEN_DEVICE_FUNC InverseReturnType inverse() const
Concept-checking macros for geometric objects Each macro instantiates a concept check structure,...
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static const double d[K][N]
Concept check for values that can be used in unit tests.
Jet< T, N > sin(const Jet< T, N > &f)
const Rot2 & rotation(OptionalJacobian< 1, 3 > Hself={}) const
rotation
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
Eigen::Triplet< double > T
ofstream os("timeSchurFactors.csv")
Jet< T, N > cos(const Jet< T, N > &f)
std::pair< Point2, Point2 > Point2Pair
Double_ range(const Point2_ &p, const Point2_ &q)
Pose2_ Expmap(const Vector3_ &xi)
Point3_ transformFrom(const Pose3_ &x, const Point3_ &p)
JacobiRotation< float > J
Line3 transformTo(const Pose3 &wTc, const Line3 &wL, OptionalJacobian< 4, 6 > Dpose, OptionalJacobian< 4, 4 > Dline)
EIGEN_DEVICE_FUNC const Scalar & q
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
double theta() const
get theta
AnnoyingScalar atan2(const AnnoyingScalar &y, const AnnoyingScalar &x)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
OptionalJacobian< Rows, N > cols(int startCol)
#define GTSAM_CONCEPT_POSE_INST(T)
std::ostream & operator<<(std::ostream &os, const Pose2 &pose)
Array< int, Dynamic, 1 > v
Matrix3 transpose() const
static const Rot2 R_PI_2(Rot2::fromCosSin(0., 1.))
std::vector< Point2Pair > Point2Pairs
static Similarity2 Align(const Point2Pairs &d_abPointPairs, const Rot2 &aRb, const Point2Pair ¢roids)
This method estimates the similarity transform from differences point pairs, given a known or estimat...
double norm2(const Point2 &p, OptionalJacobian< 1, 2 > H)
Distance of the point from the origin, with Jacobian.
Rot2 R(Rot2::fromAngle(0.1))
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:34:24