I want to use weight functions to fit gaps in marker data. How can I construct this in the model. If I use
ConstructWeightFunUsingResidualOnOff = Off; i will get this error:
ERROR(OBJ1) : H:/J.H…ers/C…d/A…n/E…s/G…b/ModelSetup.any : C3DFileData.Points.Markers.LTIB.Weight.Ts : The values in Ts must be monotomically increasing
This error means that the T values of you interpolation function does not increase so in your T data you may have something like this T={0,1,2,1} this would give you this error.
By the way i assume that the ConstructWeightFunUsingResidualOnOff is set to On when you get this error?
It is a bit strange the T vector should in this case automatically be constructed from the same T vector that is used for the markers, so if these data looks ok with this setting set to “Off” it is strange.
Would it possible to upload the C3D so we can have a look at it?
Sorry for keeping you waiting, we have not had time yet to debug it.
Until the problem gets resolved there is actually a way to construct these weight functions manually.
If you set the setting to off the model will load
ConstructWeightFunUsingResidualOnOff =Off
Then you can see the residual values in the C3D file structure for each marker.
Then a weight function can be constructed using the time vector from the markers and the
AnyFunSquareWaveThreshold function which takes in a time vector, a data vector and a threshold value then it creates a smooth wave function for this data that can be used as the weight function. If the setting ConstructWeightFunUsingResidualOnOff had been working on this data set this is exactly what the would have been done automatically.
I have filled it in now but I do not see any difference in the analysis. It still did not change the weight functions. Do I miss anything?
This is what I have now:
The Values menber is set to make a transition to 1 like the InitialValues, so it may not change the value of the function as you expect. I guess you want it to become zero in the Ts interval and back again to 1 after that. Try this:
Values = {{0.0,1.0},{0.0,1.0},{0.0,1.0}};
Also don’t forget to appliy this function as the weight of the driver in the CreateMarkerClass in replacement of the default one.
In the gait models of the repository there is a class which creates the markers and drivers for them see for example the file toolbox/mocap/CreareMarkerClassTD (for TLEM leg markers)
In this file you will find a similar AnyKinDriverMarker object but it has a weight function which has a constant value for the x,y and z directions.
To make use of your weight function in this context(GiatLowerExctremityModel) you will need to modify this constant weigth function and multiply your weight function onto this.
So the best way would be to construct the weight function for all your markers and then point at them in the CreateMakerTDClass
Thank you for your explanation but I still did not know how to start in the marker klass. Do you mean that I should make separate weight functions for each separate marker. And What should I construct in the createmarkerclass TD?
This is the current construction in the markerclass:
As you can see the code in the CreateMarkerClassTD is generic and is applied to all markers. It is better to keep it this way. The weight function you have to change is the following:
This points at the weight defined individualy for each marker in the ModelSetup file. So the square wave weight funtion should be be defined individualy for each marker as well. I suggest you to do the following. In the CreateMarkerClassTD change the WeightFun to this:
But I receive this errormessage: [SIZE=1]ERROR(SCR.PRS2)[/SIZE] : [SIZE=1]H:/J.H…ers/C…d/A…n/E…s/G…b/ModelSetup.any[/SIZE] : ‘SW3’ : Object already auto declared by owner : [SIZE=1]Main.Studies.KinematicStudyForParameterIdentification.ModelEnvironmentConnection.Drivers.RTH.Driver [/SIZE]
What did i do wrong?
Well i guess something is still wrong in the code. Regarding to the previous error you should have replaced this line:
AnyFunConst WeightFun ={Value = {WeightX,WeightY,WeightZ};};
by this one:
AnyParamFun &WeightFun = Main.ModelSetup.MarkerName.SW3;
The constant function should be completly removed. Is that what you did?