Skip to content

Commit

Permalink
Remove SmoothSphereHalfSpaceForce from Moco.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdembia committed Mar 27, 2020
1 parent 11c96a1 commit ccd39f8
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 562 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
% modified version of the 'gait10dof18musc.osim' available within OpenSim. We
% replaced the moving knee flexion axis by a fixed flexion axis, replaced the
% Millard2012EquilibriumMuscles by DeGrooteFregly2016Muscles, and added
% SmoothSphereHalfSpaceForces (two contact spheres per foot) to model the
% SmoothSphereHalfSpaceForces (two contacts per foot) to model the
% contact interactions between the feet and the ground.
%
% Data
Expand Down Expand Up @@ -168,15 +168,15 @@

% Extract ground reaction forces
% ==============================
contactSpheres_r = StdVectorString();
contactSpheres_l = StdVectorString();
contactSpheres_r.add('contactSphereHeel_r');
contactSpheres_r.add('contactSphereFront_r');
contactSpheres_l.add('contactSphereHeel_l');
contactSpheres_l.add('contactSphereFront_l');
contact_r = StdVectorString();
contact_l = StdVectorString();
contact_r.add('contactHeel_r');
contact_r.add('contactFront_r');
contact_l.add('contactHeel_l');
contact_l.add('contactFront_l');

externalForcesTableFlat = opensimMoco.createExternalLoadsTableForGait(model, ...
fullStride,contactSpheres_r,contactSpheres_l);
fullStride,contact_r,contact_l);
opensimMoco.writeTableToFile(externalForcesTableFlat, ...
'gaitTracking_solution_fullStride_GRF.sto');

Expand Down Expand Up @@ -313,20 +313,20 @@

% Extract ground reaction forces
% ==============================
contactSpheres_r = StdVectorString();
contactSpheres_l = StdVectorString();
contactSpheres_r.add('contactSphereHeel_r');
contactSpheres_r.add('contactSphereFront_r');
contactSpheres_l.add('contactSphereHeel_l');
contactSpheres_l.add('contactSphereFront_l');
contact_r = StdVectorString();
contact_l = StdVectorString();
contact_r.add('contactHeel_r');
contact_r.add('contactFront_r');
contact_l.add('contactHeel_l');
contact_l.add('contactFront_l');

% Create a conventional ground reaction forces file by summing the contact
% forces of contact spheres on each foot.
% For details, navigate to
% User Guide > Utilities > Model and trajectory utilities
% in the Moco Documentation.
externalForcesTableFlat = opensimMoco.createExternalLoadsTableForGait(model, ...
fullStride, contactSpheres_r, contactSpheres_l);
fullStride, contact_r, contact_l);
opensimMoco.writeTableToFile(externalForcesTableFlat, ...
'gaitPrediction_solution_fullStride_GRF.sto');

Expand Down
1 change: 0 additions & 1 deletion Moco/Bindings/OpenSimHeaders_moco.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <Moco/Components/ModelFactory.h>
#include <Moco/Components/MultivariatePolynomialFunction.h>
#include <Moco/Components/PositionMotion.h>
#include <Moco/Components/SmoothSphereHalfSpaceForce.h>
#include <Moco/MocoBounds.h>
#include <Moco/MocoCasADiSolver/MocoCasADiSolver.h>
#include <Moco/MocoControlBoundConstraint.h>
Expand Down
1 change: 0 additions & 1 deletion Moco/Bindings/moco.i
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ moco_unique_ptr(OpenSim::PositionMotion);
%template(analyzeSpatialVec) OpenSim::analyze<SimTK::SpatialVec>;

%include <Moco/Components/ModelFactory.h>
%include <Moco/Components/SmoothSphereHalfSpaceForce.h>
%include <Moco/Components/MultivariatePolynomialFunction.h>

%include <Moco/ModelOperators.h>
92 changes: 40 additions & 52 deletions Moco/Examples/C++/example2DWalking/2D_gait.osim
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,9 @@
<Model name="2D_gait">
<!--List of components that this component owns and serializes.-->
<components>
<SmoothSphereHalfSpaceForce name="contactSphereHeel_r">
<!--Path to a Component that satisfies the Socket 'sphere_frame' of type PhysicalFrame (description: The body to which the contact sphere is attached.).-->
<socket_sphere_frame>/bodyset/calcn_r</socket_sphere_frame>
<!--Path to a Component that satisfies the Socket 'half_space_frame' of type PhysicalFrame (description: The body to which the contact half space is attached.).-->
<socket_half_space_frame>/ground</socket_half_space_frame>
<!--The location of the contact sphere in the body frame.-->
<contact_sphere_location>0.031307527581931796 0.010435842527310599 0</contact_sphere_location>
<!--The radius of the contact sphere.-->
<contact_sphere_radius>0.035000000000000003</contact_sphere_radius>
<!--The location of the contact half space in the body frame, default is Vec3(0).-->
<contact_half_space_location>0 0 0</contact_half_space_location>
<!--The orientation of the contact half space in the body frame. (body-fixed XYZ Euler angles), default is Vec3(0).-->
<contact_half_space_orientation>0 0 -1.5707963267948966</contact_half_space_orientation>
<SmoothSphereHalfSpaceForce name="contactHeel_r">
<socket_sphere>/contactgeometryset/heel_r</socket_sphere>
<socket_half_space>/contactgeometryset/floor</socket_half_space>
<!--The stiffness constant (i.e., plain strain modulus), default is 1 (N/m^2)-->
<stiffness>3067776</stiffness>
<!--The dissipation coefficient, default is 0 (s/m).-->
Expand All @@ -35,19 +25,9 @@
<!--The parameter that determines the smoothness of the transition of the tanh used to smooth the Hunt-Crossley force. The larger the steeper the transition but also the more discontinuous-like, default is 50.-->
<hunt_crossley_smoothing>50</hunt_crossley_smoothing>
</SmoothSphereHalfSpaceForce>
<SmoothSphereHalfSpaceForce name="contactSphereHeel_l">
<!--Path to a Component that satisfies the Socket 'sphere_frame' of type PhysicalFrame (description: The body to which the contact sphere is attached.).-->
<socket_sphere_frame>/bodyset/calcn_l</socket_sphere_frame>
<!--Path to a Component that satisfies the Socket 'half_space_frame' of type PhysicalFrame (description: The body to which the contact half space is attached.).-->
<socket_half_space_frame>/ground</socket_half_space_frame>
<!--The location of the contact sphere in the body frame.-->
<contact_sphere_location>0.031307527581931796 0.010435842527310599 0</contact_sphere_location>
<!--The radius of the contact sphere.-->
<contact_sphere_radius>0.035000000000000003</contact_sphere_radius>
<!--The location of the contact half space in the body frame, default is Vec3(0).-->
<contact_half_space_location>0 0 0</contact_half_space_location>
<!--The orientation of the contact half space in the body frame. (body-fixed XYZ Euler angles), default is Vec3(0).-->
<contact_half_space_orientation>0 0 -1.5707963267948966</contact_half_space_orientation>
<SmoothSphereHalfSpaceForce name="contactHeel_l">
<socket_sphere>/contactgeometryset/heel_l</socket_sphere>
<socket_half_space>/contactgeometryset/floor</socket_half_space>
<!--The stiffness constant (i.e., plain strain modulus), default is 1 (N/m^2)-->
<stiffness>3067776</stiffness>
<!--The dissipation coefficient, default is 0 (s/m).-->
Expand All @@ -67,19 +47,9 @@
<!--The parameter that determines the smoothness of the transition of the tanh used to smooth the Hunt-Crossley force. The larger the steeper the transition but also the more discontinuous-like, default is 50.-->
<hunt_crossley_smoothing>50</hunt_crossley_smoothing>
</SmoothSphereHalfSpaceForce>
<SmoothSphereHalfSpaceForce name="contactSphereFront_r">
<!--Path to a Component that satisfies the Socket 'sphere_frame' of type PhysicalFrame (description: The body to which the contact sphere is attached.).-->
<socket_sphere_frame>/bodyset/calcn_r</socket_sphere_frame>
<!--Path to a Component that satisfies the Socket 'half_space_frame' of type PhysicalFrame (description: The body to which the contact half space is attached.).-->
<socket_half_space_frame>/ground</socket_half_space_frame>
<!--The location of the contact sphere in the body frame.-->
<contact_sphere_location>0.17740932296428019 -0.015653763790965898 0.0052179212636552993</contact_sphere_location>
<!--The radius of the contact sphere.-->
<contact_sphere_radius>0.014999999999999999</contact_sphere_radius>
<!--The location of the contact half space in the body frame, default is Vec3(0).-->
<contact_half_space_location>0 0 0</contact_half_space_location>
<!--The orientation of the contact half space in the body frame. (body-fixed XYZ Euler angles), default is Vec3(0).-->
<contact_half_space_orientation>0 0 -1.5707963267948966</contact_half_space_orientation>
<SmoothSphereHalfSpaceForce name="contactFront_r">
<socket_sphere>/contactgeometryset/front_r</socket_sphere>
<socket_half_space>/contactgeometryset/floor</socket_half_space>
<!--The stiffness constant (i.e., plain strain modulus), default is 1 (N/m^2)-->
<stiffness>3067776</stiffness>
<!--The dissipation coefficient, default is 0 (s/m).-->
Expand All @@ -99,19 +69,9 @@
<!--The parameter that determines the smoothness of the transition of the tanh used to smooth the Hunt-Crossley force. The larger the steeper the transition but also the more discontinuous-like, default is 50.-->
<hunt_crossley_smoothing>50</hunt_crossley_smoothing>
</SmoothSphereHalfSpaceForce>
<SmoothSphereHalfSpaceForce name="contactSphereFront_l">
<!--Path to a Component that satisfies the Socket 'sphere_frame' of type PhysicalFrame (description: The body to which the contact sphere is attached.).-->
<socket_sphere_frame>/bodyset/calcn_l</socket_sphere_frame>
<!--Path to a Component that satisfies the Socket 'half_space_frame' of type PhysicalFrame (description: The body to which the contact half space is attached.).-->
<socket_half_space_frame>/ground</socket_half_space_frame>
<!--The location of the contact sphere in the body frame.-->
<contact_sphere_location>0.17740932296428019 -0.015653763790965898 -0.0052179212636552993</contact_sphere_location>
<!--The radius of the contact sphere.-->
<contact_sphere_radius>0.014999999999999999</contact_sphere_radius>
<!--The location of the contact half space in the body frame, default is Vec3(0).-->
<contact_half_space_location>0 0 0</contact_half_space_location>
<!--The orientation of the contact half space in the body frame. (body-fixed XYZ Euler angles), default is Vec3(0).-->
<contact_half_space_orientation>0 0 -1.5707963267948966</contact_half_space_orientation>
<SmoothSphereHalfSpaceForce name="contactFront_l">
<socket_sphere>/contactgeometryset/front_l</socket_sphere>
<socket_half_space>/contactgeometryset/floor</socket_half_space>
<!--The stiffness constant (i.e., plain strain modulus), default is 1 (N/m^2)-->
<stiffness>3067776</stiffness>
<!--The dissipation coefficient, default is 0 (s/m).-->
Expand Down Expand Up @@ -2850,5 +2810,33 @@
<objects />
<groups />
</ForceSet>
<ContactGeometrySet name="contactgeometryset">
<objects>
<ContactSphere name="heel_r">
<socket_frame>/bodyset/calcn_r</socket_frame>
<radius>0.035000000000000003</radius>
<location>0.031307527581931796 0.010435842527310599 0</location>
</ContactSphere>
<ContactSphere name="heel_l">
<socket_frame>/bodyset/calcn_l</socket_frame>
<radius>0.035000000000000003</radius>
<location>0.031307527581931796 0.010435842527310599 0</location>
</ContactSphere>
<ContactSphere name="front_r">
<socket_frame>/bodyset/calcn_r</socket_frame>
<radius>0.014999999999999999</radius>
<location>0.17740932296428019 -0.015653763790965898 0.0052179212636552993</location>
</ContactSphere>
<ContactSphere name="front_l">
<socket_frame>/bodyset/calcn_l</socket_frame>
<radius>0.014999999999999999</radius>
<location>0.17740932296428019 -0.015653763790965898 -0.0052179212636552993</location>
</ContactSphere>
<ContactHalfSpace name="floor">
<socket_frame>/ground</socket_frame>
<orientation>0 0 -1.5707963267948966</orientation>
</ContactHalfSpace>
</objects>
</ContactGeometrySet>
</Model>
</OpenSimDocument>
16 changes: 8 additions & 8 deletions Moco/Examples/C++/example2DWalking/example2DWalking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/// modified version of the 'gait10dof18musc.osim' available within OpenSim. We
/// replaced the moving knee flexion axis by a fixed flexion axis, replaced the
/// Millard2012EquilibriumMuscles by DeGrooteFregly2016Muscles, and added
/// SmoothSphereHalfSpaceForces (two contact spheres per foot) to model the
/// SmoothSphereHalfSpaceForces (two contacts per foot) to model the
/// contact interactions between the feet and the ground.
///
/// Data
Expand Down Expand Up @@ -287,14 +287,14 @@ void gaitPrediction(const MocoSolution& gaitTrackingSolution) {

// Extract ground reaction forces.
// ===============================
std::vector<std::string> contactSpheres_r;
std::vector<std::string> contactSpheres_l;
contactSpheres_r.push_back("contactSphereHeel_r");
contactSpheres_r.push_back("contactSphereFront_r");
contactSpheres_l.push_back("contactSphereHeel_l");
contactSpheres_l.push_back("contactSphereFront_l");
std::vector<std::string> contact_r;
std::vector<std::string> contact_l;
contact_r.push_back("contactHeel_r");
contact_r.push_back("contactFront_r");
contact_l.push_back("contactHeel_l");
contact_l.push_back("contactFront_l");
TimeSeriesTable externalForcesTableFlat = createExternalLoadsTableForGait(
model, full, contactSpheres_r, contactSpheres_l);
model, full, contact_r, contact_l);
writeTableToFile(externalForcesTableFlat,
"gaitPrediction_solutionGRF_fullcycle.sto");

Expand Down
2 changes: 0 additions & 2 deletions Moco/Moco/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ set(MOCO_SOURCES
MocoFrameDistanceConstraint.cpp
Components/DeGrooteFregly2016Muscle.h
Components/DeGrooteFregly2016Muscle.cpp
Components/SmoothSphereHalfSpaceForce.h
Components/SmoothSphereHalfSpaceForce.cpp
Components/ActivationCoordinateActuator.h
Components/StationPlaneContactForce.h
Components/StationPlaneContactForce.cpp
Expand Down

0 comments on commit ccd39f8

Please sign in to comment.