This video shows a part of the project for the modular mocap.
Here you can see that at the first try, the bone does not align correctly. That's because the bones are in different position in relation to each other.
Preparing to run:
First run the code in the script view(0_RUN_Menu_retarget). Then you will have a new menu Called "MediaPipe Preview"
Retargeting:
To correctly retarget, you must first, in pose mode, put the origin bone at the same (or close to) position as the destination bone is.
Then you select first the origin bone, then the last one, and click to retarget.
Do the same for all the bones that you want to retarget.