# Center of Mass frame in a multiple body mechanism

4 views (last 30 days)
Georgios Andrikopoulos on 19 Nov 2020
Commented: Zeno Pavanello on 6 Jul 2021 at 10:11
Hello!
For quite some time now, I have been trying to find a way and create a frame from the Center of Mass (CoM) of a multiple body mechanism (e.g. a humanoid robot). The reason for this is that I want to apply 3D external forces to the robot's CoM, which is expected to be changing. Applying these forces directly on a robot part close to where the CoM is expected to move around is creating unwanted torques and the simulation fails. Changing the force resolution frame from attached to world creates different results but still ends up failing.
To amend this, I have extracted the robot CoM via the Intertial Sensor, but it gives the (x,y,z) coordinates and not a frame. I tried to use a Cartesian Joint and displace a robot frame by (px,py,pz) = (CoM exported by the Inertial Sensor, under custom frame coordinates and mechanism sensor extent with excluded ground components), for tricking into using the resulting frame to apply the external forces, but as expected it creates an algebraic loop and the simulation cannot run.
There must be a simpler way to do this, I just cannot see it. Your help will be greatly appreciated!
Paul on 5 Jun 2021
Can you post a link to the doc page of the Interial Sensor? I couldn't find it. When it outputs the (x,y,z) coordinates of the CM, those coordinates must be defined in a coordinate frame. Which one?
If I understand correctly, you want to define a coordinate frame with origin at the CM of the mechanism. So this frame will translate over time. Am I following? At any instant in time, how is the orientation of this frame defined?

Steve Miller on 4 Jun 2021
This is an interesting challenge. The best you can do (at the moment) is what you tried using the Inertia Sensor, but you will need to break the algebraic loop with a transfer function, which will (obviously) introduce a delay. I would be curious to know which physical situation you are trying to model here.
--Steve
##### 2 CommentsShowHide 1 older comment
Zeno Pavanello on 6 Jul 2021 at 10:11
I am having the exact same problem. The introduction of the unit delay does not work for me, since it appears to break the algebraic loop, but the solver is unable to run the model and it throws the error "Solver encountered an error while simulating model at time 0.010000000000053 and cannot continue". Still I don't understand why this system should cause an algebraic loop.

R2020b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!