64 v->pose.y()-v->parent->pose.y(),
65 v->pose.theta()-v->parent->pose.theta());
69 TreeOptimizer2::TreeOptimizer2():
110 for (
uint i=0; i<
M.size(); i++)
139 for (
int dir=0; dir<2; dir++){
140 Vertex* n = (dir==0)? e->v1 : e->v2;
143 M[i].values[0]+=W.
values[0][0];
144 M[i].values[1]+=W.
values[1][1];
145 M[i].values[2]+=W.
values[2][2];
155 for (
uint i=0; i<
M.size(); i++){
156 cerr <<
"M[" << i <<
"]=" <<
M[i].x() <<
" " <<
M[i].y() <<
" " <<
M[i].theta() <<endl;
196 double angle=r.theta();
224 double tw[3]={0.,0.,0.};
225 for (
int dir=0; dir<2; dir++) {
226 Vertex* n = (dir==0)? v1 : v2;
229 tw[0]+=1./
M[i].values[0];
230 tw[1]+=1./
M[i].values[1];
231 tw[2]+=1./
M[i].values[2];
236 double beta[3] = {l*alpha[0]*d.
values[0], l*alpha[1]*d.
values[1], l*alpha[2]*d.
values[2]};
237 beta[0]=(fabs(beta[0])>fabs(r.values[0]))?r.values[0]:beta[0];
238 beta[1]=(fabs(beta[1])>fabs(r.values[1]))?r.values[1]:beta[1];
239 beta[2]=(fabs(beta[2])>fabs(r.values[2]))?r.values[2]:beta[2];
244 for (
int dir=0; dir<2; dir++) {
245 Vertex* n = (dir==0)? v1 : v2;
246 double sign=(dir==0)? -1. : 1.;
249 assert(
M[i].values[0]>0);
250 assert(
M[i].values[1]>0);
251 assert(
M[i].values[2]>0);
253 Pose delta( beta[0]/(
M[i].values[0]*tw[0]), beta[1]/(
M[i].values[1]*tw[1]), beta[2]/(
M[i].values[2]*tw[2]));
258 n->parameters.x()+=delta.
x();
259 n->parameters.y()+=delta.
y();
260 n->parameters.theta()+=delta.
theta();
292 v->pose.x()=v->parent->pose.x()+v->parameters.x();
293 v->pose.y()=v->parent->pose.y()+v->parameters.y();
294 v->pose.theta()=v->parent->pose.theta()+v->parameters.theta();
303 p.
x()+=aux->parameters.x();
304 p.
y()+=aux->parameters.y();
305 p.
theta()+=aux->parameters.theta();
308 p.
x()+=aux->pose.x();
309 p.
y()+=aux->pose.y();
310 p.
theta()+=aux->pose.theta();
316 const Vertex* v1=e->v1;
317 const Vertex* v2=e->v2;
335 double angle=r.theta();
357 return r.x()*r1.
x()+r.y()*r1.
y()+r.theta()*r1.
theta();
361 double globalError=0.;
362 for (TreePoseGraph2::EdgeMap::const_iterator it=
edges.begin(); it!=
edges.end(); it++){
363 globalError+=
error(it->second);
void initializeOnlineOptimization()
virtual ~TreeOptimizer2()
void iterate(TreePoseGraph2::EdgeSet *eset=0)
SMatrix3< T > transpose() const
void initializeTreeParameters()
Defines the core optimizer class for 2D graphs which is a subclass of TreePoseGraph2.
A class to represent symmetric 3x3 matrices.
GLM_FUNC_DECL genType e()
void computePreconditioner()
GLM_FUNC_DECL T angle(detail::tquat< T, P > const &x)
GLM_FUNC_DECL genType sign(genType const &x)
GLM_FUNC_DECL genType cos(genType const &angle)
GLM_FUNC_DECL genType sin(genType const &angle)
T values[3]
container for x, y, and theta
void updatePoseChain(Vertex *v, Vertex *top)
GLM_FUNC_QUALIFIER T atan2(T x, T y)
Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what q...
Pose getPose(Vertex *v, Vertex *top)
GLM_FUNC_DECL genType max(genType const &x, genType const &y)
void treeDepthVisit(Action &act, Vertex *v)
Operations2D< double >::PoseType Pose
void initializeOptimization()
A class (struct) to compute the parameterization of the vertex v.
void perform(TreePoseGraph2::Vertex *v)
2D Point (x,y) with orientation (theta)
std::multiset< Edge *, EVComparator< Edge *> > EdgeSet