-
Notifications
You must be signed in to change notification settings - Fork 2
Added code snippets to Muscle Modeling tutorial to enable testing #47
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//# BEGIN SNIPPET 1 | ||
// This is a very simple model for demonstration of muscle modeling | ||
Main = { | ||
|
||
AnyFolder MyModel = { | ||
|
||
// Global Reference Frame | ||
AnyFixedRefFrame GlobalRef = { | ||
AnyDrawRefFrame drw = { | ||
RGB = {1,0,0}; | ||
}; | ||
}; // Global reference frame | ||
|
||
// Define one simple segment | ||
AnySeg Arm = { | ||
r0 = {0.500000, 0.000000, 0.000000}; | ||
Mass = 1.000000; | ||
Jii = {0.100000, 1.000000, 1.000000}*0.03; | ||
AnyRefNode Jnt = { | ||
sRel = {-0.5, 0.0, 0}; | ||
}; | ||
AnyDrawSeg drw = {}; | ||
}; | ||
|
||
// Attach the segment to ground by a revolute joint | ||
AnyRevoluteJoint Jnt = { | ||
AnyRefFrame &ref1 = .GlobalRef; | ||
AnyRefFrame &ref2 = .Arm.Jnt; | ||
Axis = z; | ||
}; | ||
|
||
// Drive the revolute joint at constant velocity | ||
AnyKinEqSimpleDriver Drv = { | ||
DriverPos = {-10*pi/180}; | ||
DriverVel = {40*pi/180}; | ||
AnyRevoluteJoint &Jnt = .Jnt; | ||
Reaction.Type = {Off}; | ||
}; | ||
|
||
}; // MyModel | ||
|
||
// The study: Operations to be performed on the model | ||
AnyBodyStudy MyStudy = { | ||
AnyFolder &Model = .MyModel; | ||
InverseDynamics.Criterion.Type = MR_MinMaxStrict; | ||
Gravity = {0.0, -9.81, 0.0}; | ||
}; | ||
}; // Main | ||
//# END SNIPPET 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
//expect_errors = ["<ObjectName>", "Model loading skipped"] | ||
|
||
// This is a very simple model for demonstration of muscle modeling | ||
Main = { | ||
|
||
AnyFolder MyModel = { | ||
|
||
// Global Reference Frame | ||
AnyFixedRefFrame GlobalRef = { | ||
AnyDrawRefFrame drw = { | ||
RGB = {1,0,0}; | ||
}; | ||
}; // Global reference frame | ||
|
||
// Define one simple segment | ||
AnySeg Arm = { | ||
r0 = {0.500000, 0.000000, 0.000000}; | ||
Mass = 1.000000; | ||
Jii = {0.100000, 1.000000, 1.000000}*0.03; | ||
AnyRefNode Jnt = { | ||
sRel = {-0.5, 0.0, 0}; | ||
}; | ||
AnyDrawSeg drw = {}; | ||
}; | ||
|
||
// Attach the segment to ground by a revolute joint | ||
AnyRevoluteJoint Jnt = { | ||
AnyRefFrame &ref1 = .GlobalRef; | ||
AnyRefFrame &ref2 = .Arm.Jnt; | ||
Axis = z; | ||
}; | ||
|
||
//# BEGIN SNIPPET 1 | ||
// Drive the revolute joint at constant velocity | ||
AnyKinEqSimpleDriver Drv = { | ||
DriverPos = {-10*pi/180}; | ||
DriverVel = {40*pi/180}; | ||
AnyRevoluteJoint &Jnt = .Jnt; | ||
Reaction.Type = {Off}; | ||
}; | ||
|
||
§AnyMuscleModel <ObjectName> = | ||
{ | ||
F0 = 0.0; | ||
//Lf0 = 0.0; | ||
//Vol0 = 0.0; | ||
};§ | ||
//# END SNIPPET 1 | ||
|
||
}; // MyModel | ||
|
||
// The study: Operations to be performed on the model | ||
AnyBodyStudy MyStudy = { | ||
AnyFolder &Model = .MyModel; | ||
InverseDynamics.Criterion.Type = MR_MinMaxStrict; | ||
Gravity = {0.0, -9.81, 0.0}; | ||
}; | ||
}; // Main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//expect_errors = ["<ObjectName>", "Model loading skipped"] | ||
|
||
// This is a very simple model for demonstration of muscle modeling | ||
Main = { | ||
|
||
AnyFolder MyModel = { | ||
|
||
// Global Reference Frame | ||
AnyFixedRefFrame GlobalRef = { | ||
AnyDrawRefFrame drw = { | ||
RGB = {1,0,0}; | ||
}; | ||
}; // Global reference frame | ||
|
||
// Define one simple segment | ||
AnySeg Arm = { | ||
r0 = {0.500000, 0.000000, 0.000000}; | ||
Mass = 1.000000; | ||
Jii = {0.100000, 1.000000, 1.000000}*0.03; | ||
AnyRefNode Jnt = { | ||
sRel = {-0.5, 0.0, 0}; | ||
}; | ||
AnyDrawSeg drw = {}; | ||
}; | ||
|
||
// Attach the segment to ground by a revolute joint | ||
AnyRevoluteJoint Jnt = { | ||
AnyRefFrame &ref1 = .GlobalRef; | ||
AnyRefFrame &ref2 = .Arm.Jnt; | ||
Axis = z; | ||
}; | ||
|
||
// Drive the revolute joint at constant velocity | ||
AnyKinEqSimpleDriver Drv = { | ||
DriverPos = {-10*pi/180}; | ||
DriverVel = {40*pi/180}; | ||
AnyRevoluteJoint &Jnt = .Jnt; | ||
Reaction.Type = {Off}; | ||
}; | ||
//# BEGIN SNIPPET 1 | ||
AnyMuscleModel §SimpleModel§ = { | ||
F0 = §100§; | ||
//Lf0 = 0.0; | ||
//Vol0 = 0.0; | ||
}; | ||
//# END SNIPPET 1 | ||
|
||
//# BEGIN SNIPPET 2 | ||
// End of AnyMuscleModel | ||
|
||
§AnyViaPointMuscle <ObjectName> = | ||
{ | ||
//viewForce.Visible = Off; | ||
//MetabModel = Null; | ||
//FatigueModel = Null; | ||
//MuscleModel = Null; | ||
//viewMuscle.Visible = Off; | ||
AnyMuscleModel &<Insert name0> = <Insert object reference (or full object definition)>; | ||
AnyRefFrame &<Insert name0> = <Insert object reference (or full object definition)>; | ||
AnyRefFrame &<Insert name1> = <Insert object reference (or full object definition)>; | ||
//AnyRefFrame &<Insert name2> = <Insert object reference (or full object definition)>; | ||
//AnyRefFrame &<Insert name3> = <Insert object reference (or full object definition)>; You can make any number of AnyRefFrame objects! | ||
};§ | ||
//# END SNIPPET 2 | ||
|
||
}; // MyModel | ||
|
||
// The study: Operations to be performed on the model | ||
AnyBodyStudy MyStudy = { | ||
AnyFolder &Model = .MyModel; | ||
InverseDynamics.Criterion.Type = MR_MinMaxStrict; | ||
Gravity = {0.0, -9.81, 0.0}; | ||
}; | ||
}; // Main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//expect_errors = ["<Insert", "Model loading skipped"] | ||
|
||
// This is a very simple model for demonstration of muscle modeling | ||
Main = { | ||
|
||
AnyFolder MyModel = { | ||
|
||
//# BEGIN SNIPPET 2 | ||
// Global Reference Frame | ||
AnyFixedRefFrame GlobalRef = { | ||
AnyDrawRefFrame drw = { | ||
RGB = {1,0,0}; | ||
}; | ||
§AnyRefNode M1Origin = { | ||
sRel = {0.0, 0.1, 0}; | ||
};§ | ||
}; // Global reference frame | ||
|
||
// Define one simple segment | ||
AnySeg Arm = { | ||
r0 = {0.500000, 0.000000, 0.000000}; | ||
Mass = 1.000000; | ||
Jii = {0.100000, 1.000000, 1.000000}*0.03; | ||
AnyRefNode Jnt = { | ||
sRel = {-0.5, 0.0, 0}; | ||
}; | ||
§AnyRefNode M1Insertion = { | ||
sRel = {0.0, 0.1, 0}; | ||
};§ | ||
AnyDrawSeg drw = {}; | ||
}; | ||
//# END SNIPPET 2 | ||
|
||
// Attach the segment to ground by a revolute joint | ||
AnyRevoluteJoint Jnt = { | ||
AnyRefFrame &ref1 = .GlobalRef; | ||
AnyRefFrame &ref2 = .Arm.Jnt; | ||
Axis = z; | ||
}; | ||
|
||
// Drive the revolute joint at constant velocity | ||
AnyKinEqSimpleDriver Drv = { | ||
DriverPos = {-10*pi/180}; | ||
DriverVel = {40*pi/180}; | ||
AnyRevoluteJoint &Jnt = .Jnt; | ||
Reaction.Type = {Off}; | ||
}; | ||
//# BEGIN SNIPPET 1 | ||
AnyMuscleModel SimpleModel = { | ||
F0 = 100; | ||
//Lf0 = 0.0; | ||
//Vol0 = 0.0; | ||
}; | ||
|
||
AnyMuscleViaPoint §Muscle1§ = { | ||
AnyMuscleModel &§Model§ = §.SimpleModel§; | ||
AnyRefFrame &<Insert name0> = <Insert object reference (or full object definition)>; | ||
AnyRefFrame &<Insert name1> = <Insert object reference (or full object definition)>; | ||
}; | ||
//# END SNIPPET 1 | ||
|
||
}; // MyModel | ||
|
||
// The study: Operations to be performed on the model | ||
AnyBodyStudy MyStudy = { | ||
AnyFolder &Model = .MyModel; | ||
InverseDynamics.Criterion.Type = MR_MinMaxStrict; | ||
Gravity = {0.0, -9.81, 0.0}; | ||
}; | ||
}; // Main |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be helpful to uncomment this line to visualize the muscle in the model view. This can aid in debugging and understanding the model's behavior. What is the rationale for commenting it out?