Another question:
In inverse kinematics, i want to modify the InverseKinematics.cpp to enable the following functionality:
Add 2 markers on the scapula, for every moment, ensure that the distance between the markers and the mass center is minimal. The problem is, how can I know the actual position of my markers during the mouvement? In the .trc file I only have coordinates for other points, I can't see how we can get the coordinate of my 2 markers.
If I understood the InverseKinematics correctly, the program will, for every moment, calculate the minimal distance between the marker's real position(recorded in .trc) and it's experimental position(don't know where is stored), but it will only work for those markers who have a certain weight and coordinates in the .trc file, so when the marker have no .trc records, it won't work.
How to change local coordinates to global coordinates
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: How to change local coordinates to global coordinates
Code: Select all
if (bs[i].getName() == "scapula"){
fromBody = bs[i];
cout << "fromBody found!!!" << endl;
}
else if (bs[i].getName() == "ground"){
toBody = bs[i];
cout << "toBody found!!!" << endl;
}
You can get a body form the BodySet by name e.g. bodySet.get("scapula"), if the body exists.
Best
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: How to change local coordinates to global coordinates
You have to implement your own optimization objective here, because InverseKineamtics.cpp calls the underlying Simbody for performing a tracking step.In inverse kinematics, i want to modify the InverseKinematics.cpp to enable the following functionality:
Add 2 markers on the scapula, for every moment, ensure that the distance between the markers and the mass center is minimal.
Please see this for more details on how to create your own optimization:
http://simtk-confluence.stanford.edu:80 ... timization
The .trc contains the positions of the markers that were recorded for a particular experiment. Maybe this experiment did not contain the two markers of the scapula that you are interested.In the .trc file I only have coordinates for other points, I can't see how we can get the coordinate of my 2 markers.
Best
Re: How to change local coordinates to global coordinates
Thank you for your answer!mitkof6 wrote: You can get a body form the BodySet by name e.g. bodySet.get("scapula"), if the body exists.
I tried all these two possible methodes:
toBody = markerSet[1].getBody();
toBody = bodyset.get("scapula");
and none of them work, while I can use
bodyset[1].getName(); and markerSet[1].getOffset(), which means that I got the correct markerSet object and bodySet object, I just cannot get the body object.
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: How to change local coordinates to global coordinates
Code: Select all
const OpenSim::Ground& ground = model.getGround();
const OpenSim::Body& scapula = bodyset.get("scapula");
Re: How to change local coordinates to global coordinates
Last questionmitkof6 wrote:Code: Select all
const OpenSim::Ground& ground = model.getGround(); const OpenSim::Body& scapula = bodyset.get("scapula");
How can I transforme OpenSim::Body to SimTK::Body?
- Jason Hodges
- Posts: 1
- Joined: Fri Jun 16, 2017 12:14 pm
Re: How to change local coordinates to global coordinates
When I applied the function "_model->getSimbodyEngine().transformPosition(s, fromBody, marker_1_pos, toBody, newLoc);", it says that
> SimTKsimbody.dll!SimTK::SimbodyMatterSubsystem::getMobilizedBody(SimTK::MobilizedBodyIndex id) Ligne 90 C++
osimSimulation.dll!OpenSim::SimbodyEngine::transformPosition(const SimTK::State & s, const OpenSim::Body & aBodyFrom, const SimTK::Vec<3,double,1> & aPos, const OpenSim::Body & aBodyTo, SimTK::Vec<3,double,1> & rPos) Ligne 486 C++
Can you explain why? I followed your example but still don't http://gratisvps.net know why it doesn't work.
> SimTKsimbody.dll!SimTK::SimbodyMatterSubsystem::getMobilizedBody(SimTK::MobilizedBodyIndex id) Ligne 90 C++
osimSimulation.dll!OpenSim::SimbodyEngine::transformPosition(const SimTK::State & s, const OpenSim::Body & aBodyFrom, const SimTK::Vec<3,double,1> & aPos, const OpenSim::Body & aBodyTo, SimTK::Vec<3,double,1> & rPos) Ligne 486 C++
Can you explain why? I followed your example but still don't http://gratisvps.net know why it doesn't work.
- Thomas Uchida
- Posts: 1790
- Joined: Wed May 16, 2012 11:40 am
Re: How to change local coordinates to global coordinates
Not with the information provided. Was that the entire error message? It would help if you posted your code.Can you explain why?