How to add the user-defined control algorithm for the IK?

Typically: "How do I... ", "How can I... " questions
zhangm365
Posts: 46
Joined: 19 Jun 2021, 12:58

How to add the user-defined control algorithm for the IK?

Post by zhangm365 »

Hello, admin

Now, I am trying to use the customed algorithm for IK control problem to replace with the build-in IK method DLS.

So, what are the key points of the process? i.e, the whole framework of the program, parameter setting, etc

Can you give me a hand?

Best Wishes.
Last edited by zhangm365 on 27 Jan 2022, 09:53, edited 1 time in total.

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: How to use the user-defined control algorithm for the IK?

Post by coppelia »

Hello,

the best would be to fork and modify the Coppelia kinematics routines, and its related CoppeliaSim IK plugin.

Cheers

zhangm365
Posts: 46
Joined: 19 Jun 2021, 12:58

Re: How to add the user-defined control algorithm for the IK?

Post by zhangm365 »

Are there any guidance documents? I am trying to add a user-defined IK method to imitate the build-in method, i.e, DLS.

Best Wishes.
Last edited by zhangm365 on 27 Jan 2022, 09:54, edited 1 time in total.

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: How to use the user-defined control algorithm for the IK?

Post by coppelia »

Have a look at the bottom part of the section on plugins: there are several example projects, the most straightforward is probably this one, which basically just adds a new script function.

Cheers

zhangm365
Posts: 46
Joined: 19 Jun 2021, 12:58

Re: How to add the user-defined control algorithm for the IK?

Post by zhangm365 »

ok, Thanks your reply.

Now, I still have a lot doubt that I don't understand the process you have given above.
coppelia wrote: 25 Jan 2022, 10:03 Hello,

the best would be to fork and modify the Coppelia kinematics routines, and its related CoppeliaSim IK plugin.

Cheers
---------------------------------
coppelia wrote: 26 Jan 2022, 16:30 Have a look at the bottom part of the section on plugins: there are several example projects, the most straightforward is probably this one, which basically just adds a new script function.

Cheers

Please allow me to reformulate my problem as follow:

I am trying to use a customed inverse-kinematic algorithm instead of the built-in algorithm (DLS) to calculate the inverse kinematics. Of course, I need to imatate the original algorithm(DLS) so as to add the new calculate method.

How can I do and what is the guiding route of this process?

Best wishes.

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: How to add the user-defined control algorithm for the IK?

Post by coppelia »

clone coppeliaKinematicsRoutines to your programming folder. then clone simExtIK to your programming folder. Then try to build simExtIK. That's the first step.
The second step would be to modify those two items above.

Then add a new define for your new calculation method in coppeliaKineamticsRoutines/ik.h, near ik_method_undamped_pseudo_inverse. In the whole source code search for appearances of ik_method_undamped_pseudo_inverse and insert your new method here and there.
Then in simExtIK/simExtIK.cpp, add a corresponding entry near:

Code: Select all

simRegisterScriptVariable("simIK.method_undamped_pseudo_inverse@simExtIK",std::to_string(ik_method_undamped_pseudo_inverse).c_str(),0);
Cheers

zhangm365
Posts: 46
Joined: 19 Jun 2021, 12:58

Re: How to add the user-defined control algorithm for the IK?

Post by zhangm365 »

Thanks a lot for your guidance. I try it now away.

Best wishes.

zhangm365
Posts: 46
Joined: 19 Jun 2021, 12:58

Re: How to add the user-defined control algorithm for the IK?

Post by zhangm365 »

Dear admin:

Now, I want to express the formula of the joint angle \(\boldsymbol \theta\) as follow:

\(\dot{\boldsymbol \theta}(t)=\boldsymbol J^\dagger (\dot{\boldsymbol p}_d(t)+\gamma (\boldsymbol p_d(t)-\boldsymbol p_a(t))) \label{tracking}\).

Unlike the DLS method form, \(||\boldsymbol J\bigtriangleup {\boldsymbol \theta} - \boldsymbol e||^2 + \lambda^2||\bigtriangleup {\boldsymbol \theta}||^2\), its final expression only include the Jacobian matrix and can be easily written.

The \(\dot{\boldsymbol p}_d(t)\) stands for the velocity of the desired path, how should it be represented in source code in my case?

Best Wishes.

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: How to add the user-defined control algorithm for the IK?

Post by coppelia »

You will have to look at the source code around this line, and figure out where to plug in your part.

Cheers

zhangm365
Posts: 46
Joined: 19 Jun 2021, 12:58

Re: How to add the user-defined control algorithm for the IK?

Post by zhangm365 »

Well, I noticed that it is where the code should be inserted.

However, I mean the formula in my case as follow:

\(\dot{\boldsymbol \theta}=\boldsymbol J^\dagger (\dot{\boldsymbol p}_d+\gamma (\boldsymbol p_d-\boldsymbol p_a)) \) .

i.e, the variable \(\dot{\boldsymbol p}_d\) ( the velocity of the target position ) is how to be represented?

Post Reply