Skip to content

fix an inverse kinematics bug #60

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

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions cisstRobot/code/robManipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,6 @@ robManipulator::InverseKinematics( vctDynamicVector<double>& q,
// Evaluate the spatial Jacobian (also evaluate the forward kin)
JacobianSpatial( q );

// compute the translation error
vctFixedSizeVector<double,3> dt( Rts[0][3]-Rt[0][3],
Rts[1][3]-Rt[1][3],
Rts[2][3]-Rt[2][3] );

// compute the orientation error
// first build the [ n o a ] vectors
vctFixedSizeVector<double,3> n1( Rt[0][0], Rt[1][0], Rt[2][0] );
Expand All @@ -468,6 +463,11 @@ robManipulator::InverseKinematics( vctDynamicVector<double>& q,
// This is the orientation error
vctFixedSizeVector<double,3> dr = 0.5*( (n1%n2) + (o1%o2) + (a1%a2) );

// compute the translation error
vctFixedSizeVector<double,3> dt( Rts[0][3]-Rt[0][3]-Rt[2][3]*dr[1]+Rt[1][3]*dr[2],
Rts[1][3]-Rt[1][3]+Rt[2][3]*dr[0]-Rt[0][3]*dr[2],
Rts[2][3]-Rt[2][3]-Rt[1][3]*dr[0]+Rt[0][3]*dr[1]);

// combine both errors in one R^6 vector
doublereal e[6] = { dt[0], dt[1], dt[2], dr[0], dr[1], dr[2] };

Expand Down