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
Prescribing acceleration of a coordinate
- Shelby Walford
- Posts: 7
- Joined: Tue Sep 04, 2018 12:05 pm
- Colin Smith
- Posts: 53
- Joined: Fri Feb 24, 2012 11:50 am
Re: Prescribing acceleration of a coordinate
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.
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.