Add Port to SimMechanics Body Block programmatically
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, currently I am trying to add new CS Ports or the CG Port to a SimMechanics Body block programmatically. Therefore I type into the command line of Matlab: set_param('mdl/Body','CG','Left$CG$[0 0 0]$WORLD$WORLD$m$[0 0 0]$Euler X-Y-Z$deg$WORLD$true$none'). After setting the parameter, there is no error or something. But the parameter change is not taking any effect visually. Only if I open the block parameters and press OK the new Port shows up in the diagram (the hook of "show port" is already set, due to the parameter change).
Does anyone know how the parameter change takes effect (visually) immediately without manual action?
Thank you very much for your help!
0 commentaires
Réponses (2)
Ryan G
le 17 Mai 2013
This is a tough one for me, but I'll try to get you started. I should mention that SimMechanics 2G is now available too.
If you use the function:
get(gcbh,'Ports')
It will display the ports on each side as part of this vector. For me it was
[0 0 0 0 0 1 1 0]
When I updated the block it was
[0 0 0 0 0 2 1 0]
So you would think you could just update this. Unfortunately it appears to be read-only. So I'm not sure how to bypass that. You can modify the xml, which I assume you know about since the set_param command you gave could only be figured out if you understand the model xml. That being said, I highly suggest you avoid doing that if at all possible.
0 commentaires
Christopher
le 21 Mai 2013
3 commentaires
Ryan G
le 19 Juin 2013
What is the problem with simulating friction? How are you doing it in 1G that 2G can't do (I'm confident it can). I took a look at more options for the 1G port, but no luck.
Voir également
Catégories
En savoir plus sur Simscape Multibody dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!