Adding Conditional Path Points:

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Musa Audu
Posts: 47
Joined: Mon Nov 24, 2008 11:30 am

Adding Conditional Path Points:

Post by Musa Audu » Mon Sep 11, 2017 7:59 am

Hi,
I am trying to incorporate a new muscle model into a skeletal model (.osim file that started off
with no muscle defined in it- only rigid segments connected by joints). I have all the
info on each of the muscles that I need to add to the skeletal model; but in particular
I have a problem with the path points.

For each path point I have the following info:
1. Name
2. Location (Vec3)
3. Segment
4. (Flag that says whether it is a regular path point or a conditional path point).
5. If a conditional path point I have the additional info:
(a) Coordinate
(b) Range min
(c) Range max
I realize that the only method in the C++ API for creating an instance of the path point
is named 'addNewPathPoint'. But this method only takes as arguments the name, location
and segment info on a path point. I have the following issues:

1. If the path point is a conditional path point initially instantiated using addNewPathPoint,
I have no access to the instance of the new path point to use to read in the additional info
on the path point. I tried the following:

// ------------------- Code starts
116 OpenSim::Body &aBody = bs.get(segment_name);
117 PathPoint newPathPoint = updGeometryPath().appendNewPathPoint(pathpoint_name,
118 aBody, point);
119
120 ConditionalPathPoint* mycpp = new ConditionalPathPoint;
121 // mycpp = ConditionalPathPoint.safeDownCast(newPathPoint); // Error in compile!
122 mycpp->init(newPathPoint); // No compile error
123 if(cond_flag) // this is a conditional path point
124 {
125 infp >> gencoord_name >> range_min >> range_max;
126 mycpp->setCoordinate(si,coords().get(gencoord_name));
127 mycpp->setRangeMin(si, range_min);
128 mycpp->setRangeMax(si, range_max);
129
130 }
// -------------------- Code ends

I got the following compile time errors with the reference only in the
above code sinppet:

\appendMuscles.cpp(117): error C3861: 'updGeometryPath': identifier not found
\appendMuscles.cpp(117): error C2228: left of '.appendNewPathPoint' must have class/struct/union
\appendMuscles.cpp(117): note: type is 'unknown-type'
\appendMuscles.cpp(126): error C2064: term does not evaluate to a function taking 0 arguments
\appendMuscles.cpp(126): error C2228: left of '.get' must have class/struct/union
\appendMuscles.cpp(126): error C2660: 'OpenSim::ConditionalPathPoint::setCoordinate': function does not take 1 arguments

I am not sure why I got the first error as I have added the header file PathActuator.h
which does contain the definition of 'updGeometryPath'. Also I did not see any methods to set
the values of the 3 arguments in addNewPathPoint if I instantiate a new path with the default
constructor.

I will appreciate any insight on how to get around the two issues above.
Thanks.
Musa

User avatar
Thomas Uchida
Posts: 1789
Joined: Wed May 16, 2012 11:40 am

Re: Adding Conditional Path Points:

Post by Thomas Uchida » Mon Sep 11, 2017 11:14 am

I am not sure why I got the first error as I have added the header file PathActuator.h which does contain the definition of 'updGeometryPath'.
updGeometryPath() is a method on PathActuator, and would be used as follows:

Code: Select all

myPathActuator.updGeometryPath().appendNewPathPoint('name', body, Vec3(0));

POST REPLY