Can the points of a Simscape Point Cloud be exported for use in another block?

18 views (last 30 days)
Take the built Point Cloud example as a starting model. (openExample('sm/PointCloudContactExample'))
Within this model is a Ball, Grid Surface and Dumbbell. Assume I want to use the points from the Ball in some downstream custom function. The geometry frame from the Ball has this information in the help section:
"Geometry frame that represents the points defined by this block. To model contacts on the points, connect this port to a Spatial Contact Force or a Planar Contact Force block."
Sounds good to me but ... how do I use that frame with something other than a contact force block? My motivation for this I want to replace the builtin contact blocks with my own.

Answers (2)

Soumya
Soumya on 28 Oct 2025 at 9:02
Hi @Matthew,
I understand you are working with the 'PointCloudContactExamplemodel' and plan to use the point data from the Ball geometry in a custom downstream function, effectively replacing the built-in contact force blocks with your own logic. However, as confirmed in the official Simscape Multibody documentation, that geometry frame port is designed only for connecting to Multibody contact-related blocks such as Spatial Contact Force or Planar Contact Force. The port communicates the frame and pose information needed for those interactions, but it does not provide direct access to the underlying point-cloud coordinates for general-purpose use.
You can follow a few different approaches if you want to swap out the built-in contact force blocks for your own logic:
  • Custom Simscape Component: Write a custom ‘.ssc’ block that receives the geometry frame and computes your own contact forces inside Simscape.
  • Rebuild the Point Cloud in MATLAB: If the point geometry is known, recreate the coordinates in MATLAB and process them with a MATLAB Function or Simulink Function block using your own force logic.
  • Custom Contact Blocks Using Simscape Tools: Let Simscape handle positioning and transforms of the points, while you replace only the force-law part with your custom version.
You can refer to the following documentations for more information:
I hope this helps!

Yifeng Tang
Yifeng Tang ongeveer 24 uur ago
I hope I understood your goal correctly: you want to be able to implement a custom set of equations inside the "Spatial Contact Force" block. It's not directly possible, but here is a workaround I can think of:
(1) still use the spatial contact force block, but make it very "weak", meaning low contact stiffness, damping, etc.
(2) use the sensing function of the block to get information like penetration depth, direction, etc, for your own calculation of the contact force.
(3) Apply the force with an external force block. Make sure apply opposite forces to both bodies in contact.
(4) you may also sense the contact force itself, which should be very low, and counter that with an external force block.
I also suggest that you try to write your own contact force equations in Simscape language as a .ssc block, probably using the physical signal domain. This way it won't need to going to Simulink and back to Simscape, saving some overhead.
Just a thougtht. I haven't done this myself before. Hope this helps.
  1 Comment
Yifeng Tang
Yifeng Tang ongeveer 24 uur ago
And I just saw this post that may help with your custom contact force modeling.
https://www.mathworks.com/matlabcentral/answers/2180745-how-do-i-customize-contact-force-calculation-in-simscape-multibody

Sign in to comment.

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!