I have sort of implemented the member function, constraintfunc() with contents similar to objectivefunc(). Now I really want help with setting this constraint equation,
Equation I need : CoordinateB(finaltime) = CoordinateB (value=360deg)
Objective: The simulation shouldn't end before the set final time of integration, and when coordinate reaches final time the value should be around 360 (deg )in radians or vice versa.
This is how I tried,
LHS: I couldnt find any code which I can relate the coordinate & final time ?
RHS: I plan to set the value to 6 radians but dont know if its the right approach.
Code: Select all
Coordinate& codB = _model.getCoordinateSet().get("coordinateB");
int re = 6; // 360 deg approx radian
int tf = osimState.getTime();
if (tf=finalTime){
constraints[0] = codB.getValue(s) -[codB.setValue( s,re, true)];
OR
constraints[0] = codB.getValue(s) -6;
}
else
{
// Problem if simulation finish before final time if condition doesn't happen
};
regards,
Nithin