Page 1 of 1

Prescribing acceleration of a coordinate

Posted: Mon Feb 08, 2021 3:09 pm
by shelbywalford
Hi All,

I am trying to simulate an arm motion with the MoBL arms model, and so I am prescribing trunk motion. I am simulating three cycles but only analyzing the third in order to simulate steady state motion. For my trunk coordinate, I prescribe the position for the full cycle time (with start and end points the same) in my model file. Then, after simulating the first cycle using the Manager, I change the time of this final state back to zero and simulate the next cycle. However, I am finding that even though my start and end position of the trunk coordinate is the same, the start and end points of the velocity and acceleration of the trunk motion are not equal, and therefore the other coordinates at the shoulder have discontinuous motion at the start and end of each cycle.

In SIMM it was possible to prescribe the position, velocity and acceleration of a coordinate. Is there a way to prescribe the velocity and acceleration of a coordinate in OpenSim so that I can make this coordinate steady-state? Thanks in advance!

Shelby

Re: Prescribing acceleration of a coordinate

Posted: Thu Feb 18, 2021 9:45 am
by clnsmith
I haven't looked in detail at the implementation of Prescribed Coordinates, so I am not sure... but as far as I know you can only prescribe position.

I think you might be able to solve your issue by resetting the speeds of your prescribed coordinates in the state at the beginning of each cycle. Right now, I am guessing the PrescribedCoordinate resets the coordinate value in the state at the beginning of each cycle when you reset the time, but the coordinate speed is left unchanged. So at the start of the first cycle the initial speed is zero, but at the start of the second cycle the initial speed is the final speed from the first cycle

I grabbed some C++ code, but the function calls will be similar in MATLAB

state.setTime(_time); % here you reset time

Coordinate& coord = _model.updComponent<Coordinate>(prescribed_coord_path); %get the prescribed coordinate
coord.setValue(state, start_value); %You don't need to do this, since the position is prescribed...
coord.setSpeedValue(state, start_speed); %here you could reset speed to 0, or a constant.