Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for utilizing Analytical IK #530

Merged
merged 44 commits into from
Nov 11, 2015
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c75fa6e
created API for analytical IK
mxgrey Jul 21, 2015
f726503
made Analytical IK robust to differences in DOF usage
mxgrey Jul 22, 2015
e704e5c
shortcut if the domain is empty
mxgrey Jul 22, 2015
ffa522f
tweaked the controls
mxgrey Jul 22, 2015
d04c1ac
added wrap to pi and mod convenience functions
mxgrey Jul 23, 2015
d0a16f1
fixed sign on desired tf computation
mxgrey Jul 23, 2015
c4e2ae1
using the base type produces clearer error messages
mxgrey Jul 23, 2015
353a9a8
better ranking of analytical solutions
mxgrey Jul 23, 2015
773a76d
improve error computations for analytical IK
mxgrey Jul 24, 2015
d9a6c3c
reconstruct DOF map when the DOFs are changed
mxgrey Jul 25, 2015
e7958a9
shortcutting and fixed indexing
mxgrey Jul 26, 2015
2190f7b
enabled use of extra DOFs in Analytical IK solver
mxgrey Jul 27, 2015
4317f80
remove unnecessary iostream
mxgrey Jul 27, 2015
3430bde
fixing Node pointer bugs
mxgrey Jul 27, 2015
1cc0c2d
added Analytical extra error clamping functions
mxgrey Jul 27, 2015
b635aff
initializing mActive
mxgrey Jul 28, 2015
7527a7b
don't block spacebar when simulation is disabled
mxgrey Jul 28, 2015
4006db3
implemented screen capturing and recording
mxgrey Jul 28, 2015
dc3aae5
fixed Problem setup
mxgrey Jul 28, 2015
34a404f
accept parallel lines in convex hull
mxgrey Jul 28, 2015
6a7d18d
disable posture optimizer for noww
mxgrey Jul 28, 2015
b6259bd
merged in latest grey/osg
mxgrey Jul 29, 2015
0b4b00c
added hubo puppet example for OSG
mxgrey Jul 29, 2015
6c3f112
added drchubo model to the repo
mxgrey Jul 29, 2015
29f737a
Merge branch 'grey/osg' into grey/analytical
mxgrey Jul 30, 2015
f18d30f
Merge branch 'grey/osg' into grey/analytical
mxgrey Aug 13, 2015
5058e70
Merge branch 'grey/osg' into grey/analytical
mxgrey Aug 18, 2015
0ff0c46
Merge branch 'grey/analytical' of http://github.com/dartsim/dart into…
mxgrey Aug 18, 2015
07d0538
fixing license
mxgrey Aug 18, 2015
ed2cba1
Merge branch 'grey/osg' into grey/analytical
mxgrey Aug 24, 2015
29e65d1
Merge branch 'grey/osg' into grey/analytical
mxgrey Aug 28, 2015
085dee2
Merge branch 'grey/osg' into grey/analytical
mxgrey Sep 20, 2015
7a7b543
Merge branch 'grey/osg' into grey/analytical
mxgrey Sep 20, 2015
dedb36f
merged in version 5.1
mxgrey Sep 30, 2015
8ebd23d
modified IK methods to follow the Properties idiom for better cloning
mxgrey Oct 2, 2015
c64f140
Merge branch 'grey/fix_jacobian_final' into grey/analytical
mxgrey Oct 5, 2015
b9e534c
Merge branch 'master' into grey/analytical
mxgrey Oct 19, 2015
16adfa1
merging in the latest master
mxgrey Oct 25, 2015
5c5c5af
removed unused variable
mxgrey Nov 5, 2015
a5eda7e
use std::fmod instead of our own implementation
mxgrey Nov 10, 2015
1048a06
improved comments
mxgrey Nov 10, 2015
b66b679
use .empty() since it may perform better
mxgrey Nov 10, 2015
e65a82a
added clarifying comment
mxgrey Nov 10, 2015
1e34ac5
Merge branch 'master' into grey/analytical
mxgrey Nov 10, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
671 changes: 612 additions & 59 deletions dart/dynamics/InverseKinematics.cpp

Large diffs are not rendered by default.

392 changes: 368 additions & 24 deletions dart/dynamics/InverseKinematics.h

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions dart/dynamics/detail/InverseKinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@
#ifndef DART_DYNAMICS_DETAIL_INVERSEKINEMATICS_H_
#define DART_DYNAMICS_DETAIL_INVERSEKINEMATICS_H_

#include <type_traits>

namespace dart {
namespace dynamics {

//==============================================================================
template <class IKErrorMethod, typename... Args>
IKErrorMethod& InverseKinematics::setErrorMethod(Args&&... args)
{
IKErrorMethod* newMethod =
new IKErrorMethod(this, std::forward<Args>(args)...);
mErrorMethod = std::unique_ptr<IKErrorMethod>(newMethod);
mErrorMethod = std::unique_ptr<ErrorMethod>(newMethod);
return *newMethod;
}

Expand All @@ -53,7 +58,12 @@ IKGradientMethod& InverseKinematics::setGradientMethod(Args&&... args)
{
IKGradientMethod* newMethod =
new IKGradientMethod(this, std::forward<Args>(args)...);
mGradientMethod = std::unique_ptr<IKGradientMethod>(newMethod);
mGradientMethod = std::unique_ptr<GradientMethod>(newMethod);

mAnalytical = dynamic_cast<Analytical*>(mGradientMethod.get());
if(nullptr != mAnalytical)
mAnalytical->constructDofMap();

return *newMethod;
}

Expand All @@ -69,4 +79,7 @@ void InverseKinematics::setDofs(const std::vector<DegreeOfFreedomT*>& _dofs)
setDofs(indices);
}

} // namespace dart
} // namespace dynamics
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be switched the comments.


#endif // DART_DYNAMICS_DETAIL_INVERSEKINEMATICS_H_
2 changes: 1 addition & 1 deletion dart/dynamics/detail/NodePtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class TemplateWeakNodePtr
}

mWeakBodyNodePtr = _ptr->getBodyNodePtr();
mWeakDestructor = _ptr->mDestructor;
mWeakDestructor = _ptr->getOrCreateDestructor();
mNode = _ptr;
}

Expand Down
2 changes: 1 addition & 1 deletion dart/math/Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ Eigen::Vector2d computeCentroidOfHull(const SupportPolygon& _convexHull)
Intersection_t result =
computeIntersection(intersect, p0, midp12, p2, midp01);

if(INTERSECTING != result)
if(BEYOND_ENDPOINTS == result)
{
double a1 = atan2( (p1-p0)[1], (p1-p0)[0] )*180.0/M_PI;
double a2 = atan2( (p2-p0)[1], (p2-p0)[0] )*180.0/M_PI;
Expand Down
16 changes: 16 additions & 0 deletions dart/math/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,22 @@ bool verifyRotation(const Eigen::Matrix3d& _R);
/// all the elements are not NaN values.
bool verifyTransform(const Eigen::Isometry3d& _T);

/// Get the remainder of dividing x by y
inline double mod(double x, double y)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason we don't use std::fmod(double, double)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly because I did not know that function existed. Good catch!

if( 0.0 == y )
return x;

return x - y * floor(x/y);
}

/// Compute the angle (in the range of -pi to +pi) which ignores any full
/// rotations
inline double wrapToPi(double angle)
{
return mod(angle+M_PI, 2*M_PI) - M_PI;
}

template <typename MatrixType, typename ReturnType>
void extractNullSpace(const Eigen::JacobiSVD<MatrixType>& _SVD, ReturnType& _NS)
{
Expand Down
7 changes: 7 additions & 0 deletions dart/optimizer/GradientDescentSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ bool GradientDescentSolver::solve()
double gamma = mGradientP.mStepSize;
size_t dim = problem->getDimension();

if(dim == 0)
{
problem->setOptimalSolution(Eigen::VectorXd());
problem->setOptimumValue(0.0);
return true;
}

Eigen::VectorXd x = problem->getInitialGuess();
assert(x.size() == static_cast<int>(dim));

Expand Down
5 changes: 5 additions & 0 deletions data/urdf/drchubo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 2.8.3)
project(drchubo)
find_package(catkin REQUIRED)
catkin_package()

Loading