scarakins flip motion

More
10 years 1 month ago #80262 by Deckerjwd
Replied by Deckerjwd on topic scarakins flip motion
so the problem is that the math func is not able to return a value greater that 1 or -1 which = +/-180 so the joint 1 and joint 0 can never cross over because this would make a triangle with 1 side that = 0, since we can not divide by 0 the kin drive the joint 0 around so that it can make a triangle with a side greater than 0.
where this code is im not sure, i think it is line 136 though 144, i have change my code to read
Code:
rsq = xt*xt + yt*yt; /* joint 1 angle needed to make arm length match sqrt(rsq) */ cc = (rsq - D2*D2 - D4*D4) / (2*D2*D4); if(cc < -1) q1 = acos(cc+1) + PM_PI; else if(cc > 1) q1 = 0 - acos(cc-1); else q1 = acos(cc);
acos cant return greater that pi [acos(-1)=3.14...] and if you feed it above 1 [acos(1)=0] you need to make it a negative. while this provides the math to cross 180 deg still looking for the limit that stops the kin from getting to 180 deg i can get close 179.99... but it flip if the step would take me over.

may give up and move arm off center so i never cross this point, but this project has been super fun and educational andypugh thx for all your input

Please Log in to join the conversation.

Time to create page: 0.034 seconds
Powered by Kunena Forum