Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for torque-driven model #66

Merged
merged 5 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ This is not a comprehensive list of changes but rather a hand-curated collection

Changes
=======
- 06/29/2023: Add support for torque-driven models ([pull request](https://github.com/stanfordnmbl/opencap-processing/pull/66))
- 06/28/2023: Add support for contacts on one side only ([pull request](https://github.com/stanfordnmbl/opencap-processing/pull/57))
- 12/16/2022: Install CMake using conda, no need to install manually anymore ([pull request](https://github.com/stanfordnmbl/opencap-processing/pull/45)).
80 changes: 17 additions & 63 deletions UtilsDynamicSimulations/OpenSimAD/boundsOpenSimAD.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,73 +277,27 @@ def getBoundsForceDerivative(self):
return (upperBoundsForceDerivative, lowerBoundsForceDerivative,
scalingForceDerivative)

def getBoundsArmExcitation(self, armJoints):
def getBoundsCoordinateDynamics(self, coordinates, optimal_forces = {},
default_optimal_force=500):

lb = [-1]
lb_vec = lb * len(armJoints)
lb_vec = lb * len(coordinates)
ub = [1]
ub_vec = ub * len(armJoints)
s = [150]
s_vec = s * len(armJoints)
upperBoundsArmExcitation = pd.DataFrame([ub_vec],
columns=armJoints)
lowerBoundsArmExcitation = pd.DataFrame([lb_vec],
columns=armJoints)
scalingArmExcitation = pd.DataFrame([s_vec], columns=armJoints)

return (upperBoundsArmExcitation, lowerBoundsArmExcitation,
scalingArmExcitation)

def getBoundsArmActivation(self, armJoints):

lb = [-1]
lb_vec = lb * len(armJoints)
ub = [1]
ub_vec = ub * len(armJoints)
s = [150]
s_vec = s * len(armJoints)
upperBoundsArmActivation = pd.DataFrame([ub_vec],
columns=armJoints)
lowerBoundsArmActivation = pd.DataFrame([lb_vec],
columns=armJoints)
scalingArmActivation = pd.DataFrame([s_vec], columns=armJoints)

return (upperBoundsArmActivation, lowerBoundsArmActivation,
scalingArmActivation)

def getBoundsLumbarExcitation(self, lumbarJoints):

lb = [-1]
lb_vec = lb * len(lumbarJoints)
ub = [1]
ub_vec = ub * len(lumbarJoints)
s = [300]
s_vec = s * len(lumbarJoints)
upperBoundsLumbarExcitation = pd.DataFrame([ub_vec],
columns=lumbarJoints)
lowerBoundsLumbarExcitation = pd.DataFrame([lb_vec],
columns=lumbarJoints)
scalingLumbarExcitation = pd.DataFrame([s_vec], columns=lumbarJoints)

return (upperBoundsLumbarExcitation, lowerBoundsLumbarExcitation,
scalingLumbarExcitation)

def getBoundsLumbarActivation(self, lumbarJoints):

lb = [-1]
lb_vec = lb * len(lumbarJoints)
ub = [1]
ub_vec = ub * len(lumbarJoints)
s = [300]
s_vec = s * len(lumbarJoints)
upperBoundsLumbarActivation = pd.DataFrame([ub_vec],
columns=lumbarJoints)
lowerBoundsLumbarActivation = pd.DataFrame([lb_vec],
columns=lumbarJoints)
scalingLumbarActivation = pd.DataFrame([s_vec], columns=lumbarJoints)
ub_vec = ub * len(coordinates)
s_vec = []
for coord in coordinates:
if coord in optimal_forces:
s_vec.append(optimal_forces[coord])
else:
s_vec.append(default_optimal_force)
upperBoundsCoordinateExcitation = pd.DataFrame([ub_vec],
columns=coordinates)
lowerBoundsCoordinateExcitation = pd.DataFrame([lb_vec],
columns=coordinates)
scalingCoordinateExcitation = pd.DataFrame([s_vec], columns=coordinates)

return (upperBoundsLumbarActivation, lowerBoundsLumbarActivation,
scalingLumbarActivation)
return (upperBoundsCoordinateExcitation, lowerBoundsCoordinateExcitation,
scalingCoordinateExcitation)

def getBoundsReserveActuators(self, joint, value):

Expand Down
Loading