Phoenix and CH3-R sharing same IK

I’m trying to make my code portable, and so far, I’ve successfully separated all the constants from the variables and functions.

Strange thing however,

After calculating what the end effector is, the length of the coxa, tibia, and femur, and inputting all the different dimensions, my CH3-R is really hurky jerky.

I don’t understand what the problem is, everything in the code is the same except for the constants such as the dimensions and the “tibia” offset that I was using in the phoenix (since knee centered does not equal the feet lining up with the knee servo’s horn).

One of the major thing that is different between the two is that the knee and the hip vertical servos are flipped around 180-degree with respect to each other’s.

Has anyone faced any difficulties sharing codes between the Phoenix and the CH3-R?

Hi,

There has been some issues. You can find some threads about that. I believe the major difference between them is the body dimension. Check all variables that are byte size, you might need to change them to word size. Especially when it comes to the middle legs.

Thanks for the heads-up Zenta…

I read through that thread still seemed to have left the problem open…

I’ve audited the data types in my code, and it seems every IK variable I’ve been using is either a “float” or a “slong.” This is something I need to eventually get rid of when I migrate the code to fixed point…

But I still can’t figure out what’s happening.

I’ve rechecked the channel numbers to make sure that the hip horizontal and the hip vertical wasn’t flip-flopped…

One of the things I’ve observed in my CH3-R is that during the “standup” routine, the knees folds inwards (still need to incorporate MAX/MIN checks to protect the servo).

Another thing I observed was that I have a routine that does the initialization of the RIPPLE gaiting, which positions each leg in the correct position so that they can start “phasing” with respect to each other. It is a function put in there to make sure that I’m not going to stress the legs out during the first step since the legs are at an unknown state… During this routine, the legs BARELY lifts itself.

It does ripple gait forward and side-ways, but the leg tips seems to “slip” which tells me something is definitely wrong… I’ve checked and rechecked the leg dimensions, and I can’t seem to figure out where it’s going wrong…

The last weirdo stuff I saw in my code was the flip-flap code. Normally, the CH3-R’s flip-flap routine, which “clears” the legs by tripoding it standing still, is a no-brainer, but this flip-flap routine I have uses kinematics since it was adopted from the phoenix… It doesn’t flip-flap correctly either…

I think what I really need to do is start from the bottom up again with some serout() and start debugging/troubleshooting where the CH3-R’s setup is struggling with…

Will keep you and any other people that want to use the same code in the Phoenix and the CH3-R updated on the subtle differences I find…