Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
uam_task_ctrl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pep Martí Saumell
uam_task_ctrl
Commits
a3926392
Commit
a3926392
authored
8 years ago
by
Angel Santamaria-Navarro
Browse files
Options
Downloads
Plain Diff
merged with master. CalcPinv back to normal
parents
8ce20d36
41344f30
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
FindKDL.cmake
+3
-3
3 additions, 3 deletions
FindKDL.cmake
src/common_fc.cpp
+4
-48
4 additions, 48 deletions
src/common_fc.cpp
src/kinematics.cpp
+0
-2
0 additions, 2 deletions
src/kinematics.cpp
with
7 additions
and
53 deletions
FindKDL.cmake
+
3
−
3
View file @
a3926392
# Locate KDL install directory
MESSAGE
(
STATUS
"Detecting KDL: using orocos_kdl-config.cmake to locate files."
)
FIND_PATH
(
KDL_DIR orocos_kdl-config.cmake /usr/local/share/orocos_kdl
)
INCLUDE
(
${
KDL_DIR
}
/orocos_kdl-config.cmake
)
MESSAGE
(
STATUS
"Detecting KDL: using orocos_kdl-config.cmake to locate files."
)
IF
(
orocos_kdl_INCLUDE_DIRS AND orocos_kdl_LIBRARIES
)
SET
(
KDL_FOUND TRUE
)
MESSAGE
(
STATUS
" Libraries:
${
orocos_kdl_LIBRARIES
}
"
)
MESSAGE
(
STATUS
" Defines:
${
orocos_kdl_INCLUDE_DIRS
}
"
)
ELSE
(
orocos_kdl_INCLUDE_DIRS AND orocos_kdl_LIBRARIES
)
SET
(
KDL_FOUND FALSE
)
ENDIF
(
orocos_kdl_INCLUDE_DIRS AND orocos_kdl_LIBRARIES
)
ENDIF
(
orocos_kdl_INCLUDE_DIRS AND orocos_kdl_LIBRARIES
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/common_fc.cpp
+
4
−
48
View file @
a3926392
...
...
@@ -8,54 +8,10 @@ CCommon_Fc::~CCommon_Fc(){}
Eigen
::
MatrixXd
CCommon_Fc
::
CalcPinv
(
const
Eigen
::
MatrixXd
&
a
,
double
epsilon
)
{
/* // Eigen::JacobiSVD<Eigen::MatrixXd> svdd(a, Eigen::ComputeThinU | Eigen::ComputeThinV);
// double tolerance = epsilon * std::max(a.cols(), a.rows()) *svdd.singularValues().array().abs()(0);
// Eigen::MatrixXd mpinv = svdd.matrixV() * (svdd.singularValues().array().abs() > tolerance).select(svdd.singularValues().array().inverse(), 0).matrix().asDiagonal() * svdd.matrixU().adjoint();
// return mpinv;
// see : http://en.wikipedia.org/wiki/Moore-Penrose_pseudoinverse#The_general_case_and_the_SVD_method
const Eigen::MatrixXd* m;
Eigen::MatrixXd t;
Eigen::MatrixXd m_pinv;
// transpose so SVD decomp can work...
if ( a.rows()<a.cols() )
{
t = a.transpose();
m = &t;
}
else
m = &a;
// SVD
//JacobiSVD<Eigen::MatrixXd> svd = m->jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV);
Eigen::JacobiSVD<Eigen::MatrixXd> svd = m->jacobiSvd(Eigen::ComputeThinU | Eigen::ComputeThinV);
Eigen::MatrixXd vSingular = svd.singularValues();
// Build a diagonal matrix with the Inverted Singular values
// The pseudo inverted singular matrix is easy to compute :
// is formed by replacing every nonzero entry by its reciprocal (inversing).
Eigen::MatrixXd vPseudoInvertedSingular(svd.matrixV().cols(),1);
for (int iRow =0; iRow<vSingular.rows(); iRow++)
{
if ( fabs(vSingular(iRow))<=epsilon )
vPseudoInvertedSingular(iRow,0)=0.;
else
vPseudoInvertedSingular(iRow,0)=1./vSingular(iRow);
}
// A little optimization here
Eigen::MatrixXd mAdjointU = svd.matrixU().adjoint().block(0,0,vSingular.rows(),svd.matrixU().adjoint().cols());
// Pseudo-Inversion : V * S * U'
m_pinv = (svd.matrixV() * vPseudoInvertedSingular.asDiagonal()) * mAdjointU ;
// transpose back if necessary
if ( a.rows()<a.cols() )
return m_pinv.transpose();*/
Eigen
::
MatrixXd
m_pinv
;
m_pinv
=
a
.
transpose
();
return
m_pinv
;
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
svdd
(
a
,
Eigen
::
ComputeThinU
|
Eigen
::
ComputeThinV
);
double
tolerance
=
epsilon
*
std
::
max
(
a
.
cols
(),
a
.
rows
())
*
svdd
.
singularValues
().
array
().
abs
()(
0
);
Eigen
::
MatrixXd
mpinv
=
svdd
.
matrixV
()
*
(
svdd
.
singularValues
().
array
().
abs
()
>
tolerance
).
select
(
svdd
.
singularValues
().
array
().
inverse
(),
0
).
matrix
().
asDiagonal
()
*
svdd
.
matrixU
().
adjoint
();
return
mpinv
;
}
...
...
This diff is collapsed.
Click to expand it.
src/kinematics.cpp
+
0
−
2
View file @
a3926392
...
...
@@ -24,8 +24,6 @@ void CKinematics::UAMKine(const UAM::CQuad& quad, UAM::CArm& arm, UAM::CHT& HT,
// Quadrotor Jacobian body to inertial frames
Eigen
::
MatrixXd
Jb2i
=
QuadJac
(
quad
.
pos
);
std
::
cout
<<
__LINE__
<<
" ["
<<
quad
.
pos
.
transpose
()
<<
"]"
<<
std
::
endl
;
// Inertial to body frames
Eigen
::
MatrixXd
Ji2b
=
UAM
::
CCommon_Fc
::
CalcPinv
(
Jb2i
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment