How can I access Simscape Multibody solid properties calculated via geometry in a script?
조회 수: 6 (최근 30일)
이전 댓글 표시
Hey everyone. I've been using Simscape Multibody and I made a very basic model. I wanted to make a .m script that would be able to access the inertial properties of the solids I make which are set to "calculate from geometry" based on the dimensions and densities I set. So far I figured out how to use the "get_param" function to access properties of my model, but when I try to get something like "MomentsOfInertia" of a rod that I made, I get [0 0 0], which is the default of the manual input for moments of inertia. So there must be a different way to access the inertia properties that were calculated from the geometry of the solid. I would really like to be able to access this data in my script somehow.
Is there a way to do this? I would greatly appreciate some guidance.
댓글 수: 0
답변 (1개)
Divyajyoti Nayak
2024년 12월 20일
Accessing the derived values, such as center of mass, moments of inertia, etc. that are calculated from geometry in a Simscape model, through MATLAB scripts directly is not supported as of MATLAB R2024b. The ‘MomentsOfInertia’ property that you are getting from ‘get_param’ is the custom ‘MomentsOf Inertia’ property. Here’s a link to its documentation
A workaround for this could be to add an ‘Inertia Sensor’ block to your solid and output the calculated values to your workspace on running the simulation. Here’s some documentation to help you out:
‘Inertia Sensor’ Block: https://www.mathworks.com/help/sm/ref/inertiasensor.html
‘To Workspace’ Block: https://www.mathworks.com/help/simulink/slref/toworkspace.html
참고 항목
카테고리
Help Center 및 File Exchange에서 Bodies에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!