Skip to content

Commit

Permalink
Reverting API changes pt. 2 + diff clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbianco committed Aug 29, 2023
1 parent 4f81105 commit 016d8bd
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 37 deletions.
10 changes: 4 additions & 6 deletions OpenSim/Examples/checkEnvironment/checkEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,11 @@ int main()

// Specify the paths for the two muscles
// Path for muscle 1
auto& path1 = muscle1->updPath<GeometryPath>();
path1.appendNewPathPoint("muscle1-point1", ground, Vec3(0.0,0.05,-0.35));
path1.appendNewPathPoint("muscle1-point2", *block, Vec3(0.0,0.0,-0.05));
muscle1->addNewPathPoint("muscle1-point1", ground, Vec3(0.0,0.05,-0.35));
muscle1->addNewPathPoint("muscle1-point2", *block, Vec3(0.0,0.0,-0.05));
// Path for muscle 2
auto& path2 = muscle2->updPath<GeometryPath>();
path2.appendNewPathPoint("muscle2-point1", ground, Vec3(0.0,0.05,0.35));
path2.appendNewPathPoint("muscle2-point2", *block, Vec3(0.0,0.0,0.05));
muscle2->addNewPathPoint("muscle2-point1", ground, Vec3(0.0,0.05,0.35));
muscle2->addNewPathPoint("muscle2-point2", *block, Vec3(0.0,0.0,0.05));

// Add the two muscles (as forces) to the model
osimModel.addForce(muscle1);
Expand Down
5 changes: 2 additions & 3 deletions OpenSim/Moco/Test/testMocoActuators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ Model createHangingMuscleModel(double optimalFiberLength,
}
actu->set_max_contraction_velocity(10);
actu->set_pennation_angle_at_optimal(0);
auto& path = actu->updPath<GeometryPath>();
path.appendNewPathPoint("origin", model.updGround(), SimTK::Vec3(0));
path.appendNewPathPoint("insertion", *body, SimTK::Vec3(0));
actu->addNewPathPoint("origin", model.updGround(), SimTK::Vec3(0));
actu->addNewPathPoint("insertion", *body, SimTK::Vec3(0));
model.addForce(actu);

body->attachGeometry(new Sphere(0.05));
Expand Down
5 changes: 2 additions & 3 deletions OpenSim/Moco/Test/testMocoInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1965,9 +1965,8 @@ TEST_CASE("MocoPhase::bound_activation_from_excitation") {
musclePtr->set_ignore_tendon_compliance(true);
musclePtr->set_fiber_damping(0);
musclePtr->setName("muscle");
auto& path = musclePtr->updPath<GeometryPath>();
path.appendNewPathPoint("origin", model.updGround(), SimTK::Vec3(0));
path.appendNewPathPoint("insertion", *body, SimTK::Vec3(0));
musclePtr->addNewPathPoint("origin", model.updGround(), SimTK::Vec3(0));
musclePtr->addNewPathPoint("insertion", *body, SimTK::Vec3(0));
model.addComponent(musclePtr);
model.finalizeConnections();
SECTION("bound_activation_from_excitation is false") {
Expand Down
5 changes: 2 additions & 3 deletions OpenSim/Moco/Test/testMocoMetabolics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ TEST_CASE("Bhargava2004SmoothedMuscleMetabolics basics") {
musclePtr->set_ignore_tendon_compliance(false);
musclePtr->set_fiber_damping(0.01);
musclePtr->setName("muscle");
auto& path = musclePtr->updPath<GeometryPath>();
path.appendNewPathPoint("origin", model.updGround(), SimTK::Vec3(0));
path.appendNewPathPoint("insertion", *body, SimTK::Vec3(0));
musclePtr->addNewPathPoint("origin", model.updGround(), SimTK::Vec3(0));
musclePtr->addNewPathPoint("insertion", *body, SimTK::Vec3(0));
model.addComponent(musclePtr);
auto& muscle = model.getComponent<DeGrooteFregly2016Muscle>("muscle");

Expand Down
10 changes: 5 additions & 5 deletions OpenSim/Simulation/Model/Blankevoort1991Ligament.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ OpenSim_DECLARE_CONCRETE_OBJECT(Blankevoort1991Ligament, Force)
Blankevoort1991Ligament();

Blankevoort1991Ligament(std::string name,
const PhysicalFrame& frame1, SimTK::Vec3 point1,
const PhysicalFrame& frame2, SimTK::Vec3 point2);
const PhysicalFrame& frame1, SimTK::Vec3 point1,
const PhysicalFrame& frame2, SimTK::Vec3 point2);

Blankevoort1991Ligament(std::string name,
const PhysicalFrame& frame1, SimTK::Vec3 point1,
const PhysicalFrame& frame2, SimTK::Vec3 point2,
double linear_stiffness, double slack_length);
const PhysicalFrame& frame1, SimTK::Vec3 point1,
const PhysicalFrame& frame2, SimTK::Vec3 point2,
double linear_stiffness, double slack_length);

Blankevoort1991Ligament(std::string name,
double linear_stiffness, double slack_length);
Expand Down
7 changes: 4 additions & 3 deletions OpenSim/Simulation/Model/PathActuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,17 @@ double PathActuator::getStress( const SimTK::State& s) const
return fabs(getActuation(s)/get_optimal_force());
}


//_____________________________________________________________________________
/**
* Add a Path point to the _path of the actuator. The new point is appended
* to the end of the current path
*
*/
void PathActuator::addNewPathPoint(
const std::string& proposedName,
const PhysicalFrame& aBody,
const SimTK::Vec3& aPositionOnBody) {
const std::string& proposedName,
const PhysicalFrame& aBody,
const SimTK::Vec3& aPositionOnBody) {
// Create new PathPoint already appended to the PathPointSet for the path
updGeometryPath().appendNewPathPoint(proposedName, aBody, aPositionOnBody);
}
Expand Down
4 changes: 2 additions & 2 deletions OpenSim/Simulation/Model/PathActuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class OSIMSIMULATION_API PathActuator : public ScalarActuator {
* @note Only valid if the `path` owned by this PathActuator supports
* PathPoint%s (e.g., GeometryPath). */
void addNewPathPoint(const std::string& proposedName,
const PhysicalFrame& aBody,
const SimTK::Vec3& aPositionOnBody);
const PhysicalFrame& aBody,
const SimTK::Vec3& aPositionOnBody);

//--------------------------------------------------------------------------
// APPLICATION
Expand Down
8 changes: 4 additions & 4 deletions OpenSim/Tests/AddComponents/testAddComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ void addComponentsToModel(Model& osimModel)

// Specify the paths for the two muscles
// Path for muscle 1
muscle1->addNewPathPoint("muscle1-point1", ground, Vec3(0.0,0.05,-0.35));
muscle1->addNewPathPoint("muscle1-point2", *block, Vec3(0.0,0.0,-0.05));
muscle1->addNewPathPoint("muscle1-point1", ground, Vec3(0.0, 0.05, -0.35));
muscle1->addNewPathPoint("muscle1-point2", *block, Vec3(0.0, 0.0, -0.05));
// Path for muscle 2
muscle2->addNewPathPoint("muscle2-point1", ground, Vec3(0.0,0.05,0.35));
muscle2->addNewPathPoint("muscle2-point2", *block, Vec3(0.0,0.0,0.05));
muscle2->addNewPathPoint("muscle2-point1", ground, Vec3(0.0, 0.05, 0.35));
muscle2->addNewPathPoint("muscle2-point2", *block, Vec3(0.0, 0.0, 0.05));

// Add the two muscles (as forces) to the model
osimModel.addComponent(muscle1);
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Tests/Wrapping/testWrapCylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ namespace {
cylinder->setFrame(model.getGround());

model.updComponent<PathSpring>("spring")
.updGeometryPath().addPathWrap(*cylinder.get());
.updGeometryPath().addPathWrap(*cylinder.get());
model.updGround().addWrapObject(cylinder.release());
}

Expand Down
10 changes: 5 additions & 5 deletions OpenSim/Tests/Wrapping/testWrapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ void testWrapCylinder()
PathSpring* spring1 =
new PathSpring("spring1", 1.0, 0.1, 0.01);
spring1->updGeometryPath().
appendNewPathPoint("origin", ground, Vec3(-off, 0, 0));
appendNewPathPoint("origin", ground, Vec3(-off, 0, 0));
spring1->updGeometryPath().
appendNewPathPoint("insert", *body, Vec3(0));
appendNewPathPoint("insert", *body, Vec3(0));
spring1->updGeometryPath().addPathWrap(*pulley1);

model.addComponent(spring1);
Expand All @@ -376,9 +376,9 @@ void testWrapCylinder()
PathSpring* spring2 =
new PathSpring("spring2", 1.0, 0.1, 0.01);
spring2->updGeometryPath().
appendNewPathPoint("origin", ground, Vec3(-off, 0, 0));
appendNewPathPoint("origin", ground, Vec3(-off, 0, 0));
spring2->updGeometryPath().
appendNewPathPoint("insert", *body, Vec3(0));
appendNewPathPoint("insert", *body, Vec3(0));
spring2->updGeometryPath().addPathWrap(*pulley2);
spring2->updGeometryPath().setDefaultColor(Vec3(0, 0.8, 0));

Expand Down Expand Up @@ -546,7 +546,7 @@ void simulateModelWithCables(const string &modelFile, double finalTime)
numMuscles++;
paths.append(&mus->updGeometryPath());
pathNames.append(mus->getName());
cout << mus->getName() << ": " << mus->updGeometryPath().getWrapSet().getSize() << endl;
cout << mus->getName() << ": " << mus->getGeometryPath().getWrapSet().getSize() << endl;
continue;
}
}
Expand Down
4 changes: 2 additions & 2 deletions OpenSim/Tests/Wrapping/testWrappingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ void testSingleWrapObjectPerpendicular(WrapObject* wrapObject, Vec3 axisRotation
new PathSpring("spring1", 1.0, 0.1, 0.01);
//offset in X direction to avoid ambiguous scenario where path passes through center
spring1->updGeometryPath().
appendNewPathPoint("origin", ground, Vec3(r-.1, r, 0));
appendNewPathPoint("origin", ground, Vec3(r-.1, r, 0));
spring1->updGeometryPath().
appendNewPathPoint("insert", *body, Vec3(-r, r, 0));
appendNewPathPoint("insert", *body, Vec3(-r, r, 0));
spring1->updGeometryPath().addPathWrap(*wObj);

model.addComponent(spring1);
Expand Down

0 comments on commit 016d8bd

Please sign in to comment.