Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Chris Chambers <chrischambers1234.player@gm...>  20080615 06:26:15
Attachments:
text/plain

Index: server/drivers/mixed/p2os/kinecalc.cc ===================================================================  server/drivers/mixed/p2os/kinecalc.cc (revision 6577) +++ server/drivers/mixed/p2os/kinecalc.cc (working copy) @@ 129,9 +129,19 @@ { KineVector result; double length = sqrt (vector.x * vector.x + vector.y * vector.y + vector.z * vector.z);  result.x = vector.x / length;  result.y = vector.y / length;  result.z = vector.z / length; + if (length != 0) + { + result.x = vector.x / length; + result.y = vector.y / length; + result.z = vector.z / length; + } + else + { + PLAYER_WARN("Warning in p2os driver  Trying to normalise a vector of zero length in p2os driver"); + result.x = 0; + result.y = 0; + result.z = 0; + } return result; } @@ 141,6 +151,27 @@ result.x = pose.o.y * pose.a.z  pose.a.y * pose.o.z; result.y = pose.o.z * pose.a.x  pose.a.z * pose.o.x; result.z = pose.o.x * pose.a.y  pose.a.x * pose.o.y; + if (result.x == 0 && result.y == 0 && result.z == 0) + { + PLAYER_WARN("Warning in p2os driver Your approch and orientation cannot be the same vector  their cross product cannot be zero"); + // Ensures that a differnt orientation vector is created + KineVector orient; + if (pose.a.y == 0 && pose.a.z == 0) + { + orient.x = 0; + orient.y = 1; + orient.z = 0; + } + else + { + orient.x = 1; + orient.y = 0; + orient.z = 0; + } + result.x = orient.y * pose.a.z  pose.a.y * orient.z; + result.y = orient.z * pose.a.x  pose.a.z * orient.x; + result.z = orient.x * pose.a.y  pose.a.x * orient.y; + } return Normalise (result); } @@ 202,7 +233,7 @@ // Next, using theta1_a, calculate thetas 2 and 3 (a and b) // First up is calculating r and rz double r = 0.0f, rz = 0.0f;  if (sin (solutions[0][0]) < 0.1f  sin(solutions[0][0]) > 0.1f) + if (sin (solutions[0][0]) < 0.1f && sin(solutions[0][0]) > 0.1f) { r = ((p.x  (link5 * a.x)) / cos (solutions[0][0]))  link1; } @@ 258,7 +289,7 @@ // First up is calculating r and rz r = 0.0f; rz = 0.0f;  if (sin (solutions[2][0]) < 0.1f  sin(solutions[2][0]) > 0.1f) + if (sin (solutions[2][0]) < 0.1f && sin(solutions[2][0]) > 0.1f) { r = (p.x  link5 * a.x) / cos (solutions[2][0])  link1; } @@ 477,7 +508,7 @@ { for (int ii = 0; ii < 5; ii++) {  if (angles[ii] < jointMin[ii]  angles[ii] > jointMax[ii]) + if (angles[ii] < jointMin[ii]  angles[ii] > jointMax[ii]  isnan(angles[ii])) return false; } 
From: gbiggs <gbiggs@ki...>  20080616 00:55:22

Thanks for the fixes. They've been checked into the SVN trunk. By the way, in the future, please use the patch tracker. Patches are less likely to get lost and forgotten there. Geoff Chris Chambers wrote: > Hey, > > I fixed a couple of logic errors and improved the handling of errors in > the kinecalc part of the p2os driver. These have been tested on a > pioneer. Attached is the svn diff. If one of you could commit this. 
Sign up for the SourceForge newsletter:
No, thanks