-
Notifications
You must be signed in to change notification settings - Fork 331
Upgrade InverseKinematicsTool to new Property system #2685
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
Conversation
…to all other object registrations
…racking orientations
…f only tracking orientations" This reverts commit ca8ccdc.
Ready for review @carmichaelong when you have a chance |
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.
Thanks, @aymanhab! I've left a bunch of minor comments (some just clarifications for my understanding).
@@ -274,7 +274,6 @@ bool InverseDynamicsTool::run() | |||
<< _lowpassCutoffFrequency << "..." << endl << endl; | |||
_coordinateValues->pad(_coordinateValues->getSize()/2); | |||
_coordinateValues->lowpassIIR(_lowpassCutoffFrequency); | |||
if (getVerboseLevel()==Debug) _coordinateValues->print("coordinateDataFiltered.sto"); |
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.
Is this a loss of functionality for someone trying to debug?
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.
True but rarely used AFAIK, we're moving in the direction of having a logger that does logging across all objects/tools so a private verbosity level flag is very ad-hoc and can be removed.
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.
Sounds good. Is there an issue open about what the plans are for the logger? Would be good to make sure these are in there if so.
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.
PR #2551 is the new logger PR
@@ -318,10 +163,10 @@ bool InverseKinematicsTool::run() | |||
// Adjust the time range for the tool if the provided range exceeds | |||
// that of the marker data. | |||
SimTK::Vec2 markersValidTimRange = markersReference.getValidTimeRange(); |
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.
I know that it's not part of the PR, but could be good to make the change of markersValidTimRange
->markersValidTimeRange
void setStartTime(double d) { _timeRange[0] = d; }; | ||
double getStartTime() const {return _timeRange[0]; }; | ||
void setStartTime(double d) { upd_time_range(0) = d; }; | ||
double getStartTime() const {return get_time_range(0); }; |
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.
I didn't find anything about conventions for one-liners in headers files in our contributing file, but it would be good to at least be consistent with spacing through this section.
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.
Does the format file that @chrisdembia included take care of this? If not I will update since I agree with your suggestion
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.
Unsure, do you know where that file is and how it works? If so, I could try to look into it, but in the mean time might just be good to clean up this section?
OpenSim/Tools/Tool.h
Outdated
Tool() : _inputsDir(_inputsDirProp.getValueStr()), | ||
_resultsDir(_resultsDirProp.getValueStr()) | ||
{ setNull(); }; | ||
Tool() { constructProperties(); |
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.
Put constructProperties()
on own line?
@@ -511,9 +359,7 @@ void InverseKinematicsTool::updateFromXMLNode(SimTK::Xml::Element& aNode, int ve | |||
for (; p!= trialIter->node_end(); ++p) { | |||
iter->insertNodeAfter( iter->node_end(), p->clone()); | |||
} | |||
iter->insertNodeAfter( iter->node_end(), Xml::Comment(_constraintWeightProp.getComment())); |
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.
Just to double check, the comments will still be in the files due to the way the new property system works, correct?
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.
Yes, the goal is to construct an object with the correct property values, comments on the other hand are never read so setting them here is unnecessary
@@ -22,10 +22,10 @@ | |||
* See the License for the specific language governing permissions and * | |||
* limitations under the License. * | |||
* -------------------------------------------------------------------------- */ | |||
|
|||
#include "Simbody.h" |
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.
I think this is only needed for SimTK::ReferencePtr
? Can the include be of smaller scope?
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.
That is true, I followed suit with similar usage because headers that defines templates are tricky to surgically include but I can look into it further if you think it's worth it.
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.
Will #include <SimTKcommon/internal/ReferencePtr.h>
work?
double &_accuracy; | ||
OpenSim_DECLARE_PROPERTY(accuracy, double, | ||
"The accuracy of the solution in absolute terms, i.e. the number of " | ||
"significant digits to which the solution can be trusted. Default 1e-6."); |
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.
I think the default is 1e-5
?
PropertyDblArray _timeRangeProp; | ||
Array<double> &_timeRange; | ||
OpenSim_DECLARE_PROPERTY(coordinate_file, std::string, | ||
"The name of the storage (.sto or .mot) file containing the time " |
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.
Can this be a path too?
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.
We don't have a path property, feel free to propose one 😉 All file names in xml are string properties AFAIK
PropertyStr _markerFileNameProp; | ||
std::string &_markerFileName; | ||
OpenSim_DECLARE_PROPERTY(marker_file, std::string, | ||
"Name/path to a .trc or .sto file of type Vec3 of marker data."); |
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.
Many users using the GUI or files won't know what "type Vec3" will mean. How can we convey the necessary info to that type of user?
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.
May also be useful to keep some of the original comment, but reword, so that users have context for this. For instance: Markers in this " "file that have a corresponding task and model marker are included."
This comment isn't perfect, but it's getting at something useful about having a corresponding IK task a model marker aligned with each of the experimental markers.
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.
Good point regarding comments. I basically had to consolidate comments from old InverseKinematicsTool and IMUInverseKinematicsTool which have same properties with different comments. In this case I used the one from the more recent IMUInverseKinematicsTool but I agree the old InverseKinematicsTool comments were better,were the remaining properties clear or should I revert all comments?
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.
I think the others were alright, this one definitely stuck out the most. Probably shouldn't revert all comments.
|
||
return(*this); | ||
constructProperty_model_file(""); | ||
constructProperty_constraint_weight(Infinity); |
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.
Is Infinity
defined from Simbody? What's the rationale on switching this from std::numeric_limits<SimTK::Real>::infinity()
?
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.
Infinity is SimTK::Infinity and as such is much cleaner than the more complicated syntax that returns same value (unless you're aware of other potential side-effects) it was used in other code already.
@carmichaelong Thanks for the thorough review, I believe I addressed your feedback, let me know what you think when you have a chance. Thank you |
Ready for another pass @carmichaelong Thank you |
I left a few comments on the open threads. Overall it's just a few very minor things:
Merging should be easy after these are addressed since they're pretty minor. |
ok, changes/updates made per your request @carmichaelong Thank you |
Thanks @aymanhab, I'll keep an eye out for the tests completing |
Testing finished 😃 |
Thanks, and sorry, wanted to make sure to at least put a note about the logging somewhere (I put it in the other PR for now). Separately, I know you've already continued work from this branch, so I didn't want to delete the |
Thanks @carmichaelong I'll rebase my branch on master and then delete this branch. Thank you |
Fixes issue #<issue_number>
Brief summary of changes
Convert inversekinematicstool to use new property system, other cleanup. Kept old API around
Testing I've completed
Ran tests
Looking for feedback on...
CHANGELOG.md (choose one)
The Doxygen for this PR can be viewed at http://myosin.sourceforge.net/?C=N;O=D; click the folder whose name is this PR's number.
This change is