exempleSquattoSTand- Add external Load
- Mouaad BOUFADNA
- Posts: 22
- Joined: Mon Mar 16, 2020 3:24 am
exempleSquattoSTand- Add external Load
Hi everyone
I am working on the SquattoStand exemple for a Master thesis project based on this movement.
I'd like to integrate in the model an external load on the body, corresponding to a barebell load.
I tried to use "problem.setControlInfo('/actuator',MocoBounds(-196.2));" to characterize the barebell weight acting on the body, but I got this error message :
"Java exception occurred:
java.lang.RuntimeException: Control info provided for nonexistent or disabled actuator '/actuator'.
Thrown at MocoProblemRep.cpp:373 in initialize().
at org.opensim.modeling.opensimMocoJNI.MocoStudy_initCasADiSolver(Native Method)
at org.opensim.modeling.MocoStudy.initCasADiSolver(MocoStudy.java:113)"
Please does someone have the solution to my problem ?
Thank you !
I am working on the SquattoStand exemple for a Master thesis project based on this movement.
I'd like to integrate in the model an external load on the body, corresponding to a barebell load.
I tried to use "problem.setControlInfo('/actuator',MocoBounds(-196.2));" to characterize the barebell weight acting on the body, but I got this error message :
"Java exception occurred:
java.lang.RuntimeException: Control info provided for nonexistent or disabled actuator '/actuator'.
Thrown at MocoProblemRep.cpp:373 in initialize().
at org.opensim.modeling.opensimMocoJNI.MocoStudy_initCasADiSolver(Native Method)
at org.opensim.modeling.MocoStudy.initCasADiSolver(MocoStudy.java:113)"
Please does someone have the solution to my problem ?
Thank you !
- Nicholas Bianco
- Posts: 1003
- Joined: Thu Oct 04, 2012 8:09 pm
Re: exempleSquattoSTand- Add external Load
Hi Mouaad,
If you want to model a barbell load, the easiest approach would be to simply add a body to the model with the desired barbell mass. You don't need to use an actuator.
-Nick
If you want to model a barbell load, the easiest approach would be to simply add a body to the model with the desired barbell mass. You don't need to use an actuator.
-Nick
- Mouaad BOUFADNA
- Posts: 22
- Joined: Mon Mar 16, 2020 3:24 am
Re: exempleSquattoSTand- Add external Load
Hi Niholas
Thank you for your answer
Should I add the barbell mass in my osim model in OpenSim with the Scale tool (body mass+ barbell mass in the Mass box) ?
Thank you for your answer
Should I add the barbell mass in my osim model in OpenSim with the Scale tool (body mass+ barbell mass in the Mass box) ?
- Nicholas Bianco
- Posts: 1003
- Joined: Thu Oct 04, 2012 8:09 pm
Re: exempleSquattoSTand- Add external Load
Hi Mouaad,
You shouldn't use the Scale tool in this situation. Either just modify the mass parameter of the body that the barbell is "attached" to, or add a new body representing the barbell to the model (e.g., welded to the hand).
Please refer to the main OpenSim project documentation for guidance on modeling questions: https://simtk-confluence.stanford.edu:8 ... umentation.
-Nick
You shouldn't use the Scale tool in this situation. Either just modify the mass parameter of the body that the barbell is "attached" to, or add a new body representing the barbell to the model (e.g., welded to the hand).
Please refer to the main OpenSim project documentation for guidance on modeling questions: https://simtk-confluence.stanford.edu:8 ... umentation.
-Nick
- Mouaad BOUFADNA
- Posts: 22
- Joined: Mon Mar 16, 2020 3:24 am
Re: exempleSquattoSTand- Add external Load
Ok sorry I didn't undertsand in that way.
I will proceed as you advice. If I have a question I will contact you again.
Thank you
Mouaad
I will proceed as you advice. If I have a question I will contact you again.
Thank you
Mouaad
- Mouaad BOUFADNA
- Posts: 22
- Joined: Mon Mar 16, 2020 3:24 am
Re: exempleSquattoSTand- Add external Load
Hi Nicholas
I tried to modify the mass parameter of the body to add a 20kg loading in my code like this :
I got this message error :
Should I freeze the value to add/ or the value of my body plus the load ?
Thank you
Mouaad
I tried to modify the mass parameter of the body to add a 20kg loading in my code like this :
Code: Select all
problem.addParameter("body_mass","body","mass",{75,95});
Code: Select all
Check for missing argument or incorrect argument data type in call to function 'addParameter'.
Error in exampleSquatToStand_answers (line 58)
problem.addParameter("body_mass","body","mass",{75,95});
Thank you
Mouaad
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: exempleSquattoSTand- Add external Load
Do you intend to optimize the mass of the barbell, or do you want to use a fixed mass? You only need to use a MocoParameter (addParameter()) if you want to optimize the mass.
If you want to use a fixed mass, then directly edit the mass properties of your model.
If you want to use a fixed mass, then directly edit the mass properties of your model.
- Mouaad BOUFADNA
- Posts: 22
- Joined: Mon Mar 16, 2020 3:24 am
Re: exempleSquattoSTand- Add external Load
Just to add a fixed barbell mass on the torso
Is there specific function to edit body properties in MocoClass ?
Something like model.updProperties("mass",value)?
Is there specific function to edit body properties in MocoClass ?
Something like model.updProperties("mass",value)?
Last edited by Mouaad BOUFADNA on Mon Jun 22, 2020 8:51 am, edited 2 times in total.
- Mouaad BOUFADNA
- Posts: 22
- Joined: Mon Mar 16, 2020 3:24 am
Re: exempleSquattoSTand- Add external Load
Hi Chris
I edited my body mass in OpenSim GUI and created a new .osim file with my new mass but when I use this new model Moco isn't solving the problem after the max iterations number.
I didn't modified anything else from my previous simulation which worked well.
Should I update my solver parameters ?
I entered those ones :
I edited my body mass in OpenSim GUI and created a new .osim file with my new mass but when I use this new model Moco isn't solving the problem after the max iterations number.
I didn't modified anything else from my previous simulation which worked well.
Should I update my solver parameters ?
I entered those ones :
Code: Select all
% Configure the solver
% ====================
solver = study.initCasADiSolver();
solver.set_num_mesh_intervals(30);
solver.set_verbosity(2);
solver.set_optim_solver('ipopt');
solver.set_optim_convergence_tolerance(1e-4);
solver.set_optim_constraint_tolerance(1e-4);
solver.set_optim_max_iterations(1000);
- Mouaad BOUFADNA
- Posts: 22
- Joined: Mon Mar 16, 2020 3:24 am
Re: exempleSquattoSTand- Add external Load
Hi Chris
I tried to edit the "2D_gait" model in the XML file with NotePad++ to add the barbell load, as explained in https://simtk-confluence.stanford.edu/d ... el+Editing
But I am not able to open it anymore in Open Sim GUI with my modificatons. When I try to use the Edit -> File command I got this message :
"Could not construct an object from the specified file"
Here the way I added the barbell to the model :
With the WeldJoint (to fix the barbell to the torso) :
I tried to edit the "2D_gait" model in the XML file with NotePad++ to add the barbell load, as explained in https://simtk-confluence.stanford.edu/d ... el+Editing
But I am not able to open it anymore in Open Sim GUI with my modificatons. When I try to use the Edit -> File command I got this message :
"Could not construct an object from the specified file"
Here the way I added the barbell to the model :
Code: Select all
<Body name ="barbell">
<!--The geometry used to display the axes of this Frame.-->
<FrameGeometry name="frame_geometry">
<!--Path to a Component that satisfies the Socket 'frame' of type Frame.-->
<socket_frame>..</socket_frame>
<!--Scale factors in X, Y, Z directions respectively.-->
<scale_factors>0.20000000000000001 0.20000000000000001 0.20000000000000001</scale_factors>
</FrameGeometry>
<!--List of geometry attached to this Frame. Note, the geometry are treated as fixed to the frame and they share the transform of the frame when visualized-->
<attached_geometry>
<Ellipsoid name ="barbell_geom_1">
<socket_frame>..</socket_frame>
<radii>0.014 0.014 1.20 </radii>
</attached_geometry>
<!--The mass of the body (kg)-->
<mass>8</mass>
<!--The location (Vec3) of the mass center in the body frame.-->
<mass_center>0 0 0</mass_center>
<!--The elements of the inertia tensor (Vec6) as [Ixx Iyy Izz Ixy Ixz Iyz] measured about the mass_center and not the body origin.-->
<inertia>0 0 0 0 0 0</inertia>
<Appearance>
<!--The opacity used to display the geometry between 0:transparent, 1:opaque.-->
<opacity>1</opacity>
<!--The color, (red, green, blue), [0, 1], used to display the geometry. -->
<color>0.5 0.5 0.5</color>
</Appearance>
</objects>
<groups />
</BodySet>
Code: Select all
<WeldJoint name="BarbellToTorso">
<!--Path to a Component that satisfies the Socket 'parent_frame' of type PhysicalFrame (description: The parent frame for the joint.).-->
<socket_parent_frame>torso_offset</socket_parent_frame>
<!--Path to a Component that satisfies the Socket 'child_frame' of type PhysicalFrame (description: The child frame for the joint.).-->
<socket_child_frame>Barbell_offset</socket_child_frame>
<!--Physical offset frames owned by the Joint that are typically used to satisfy the owning Joint's parent and child frame connections (sockets). PhysicalOffsetFrames are often used to describe the fixed transformation from a Body's origin to another location of interest on the Body (e.g., the joint center). When the joint is deleted, so are the PhysicalOffsetFrame components in this list.-->
<frames>
<PhysicalOffsetFrame name="torso_offset">
<!--The geometry used to display the axes of this Frame.-->
<FrameGeometry name="frame_geometry">
<!--Path to a Component that satisfies the Socket 'frame' of type Frame.-->
<socket_frame>..</socket_frame>
<!--Scale factors in X, Y, Z directions respectively.-->
<scale_factors>0.20000000000000001 0.20000000000000001 0.20000000000000001</scale_factors>
</FrameGeometry>
<!--Path to a Component that satisfies the Socket 'parent' of type C (description: The parent frame to this frame.).-->
<socket_parent>/bodyset/torso</socket_parent>
<!--Translational offset (in meters) of this frame's origin from the parent frame's origin, expressed in the parent frame.-->
<translation>0 0 0</translation>
<!--Orientation offset (in radians) of this frame in its parent frame, expressed as a frame-fixed x-y-z rotation sequence.-->
<orientation>0 0 0</orientation>
</PhysicalOffsetFrame>
<PhysicalOffsetFrame name="barbell_offset">
<!--The geometry used to display the axes of this Frame.-->
<FrameGeometry name="frame_geometry">
<!--Path to a Component that satisfies the Socket 'frame' of type Frame.-->
<socket_frame>..</socket_frame>
<!--Scale factors in X, Y, Z directions respectively.-->
<scale_factors>1 1 1</scale_factors>
</FrameGeometry>
<!--Path to a Component that satisfies the Socket 'parent' of type C (description: The parent frame to this frame.).-->
<socket_parent>/bodyset/barbell</socket_parent>
<!--Translational offset (in meters) of this frame's origin from the parent frame's origin, expressed in the parent frame.-->
<translation>0 0 0</translation>
<!--Orientation offset (in radians) of this frame in its parent frame, expressed as a frame-fixed x-y-z rotation sequence.-->
<orientation>0 0 0</orientation>
</PhysicalOffsetFrame>
</frames>
</WeldJoint>
</objects>
<groups />
</JointSet>