The parent class of BushingForce is a templatized class TwoFrameLinker<Force, PhysicalFrame>. I am able to access the public functions in TwoFrameLinker to compute the deflection and get the stiffness vectors, but I am unable to access the protected function addInPhysicalForcesFromInternal. I get the following error message:
error C2248:
'OpenSim::TwoFrameLinker<OpenSim::Force,OpenSim::PhysicalFrame>::addInPhysicalForcesFromInternal':
cannot access protected member declared in class
How would I access this protected function?
Here is a snippet of code in case it is helpful:
Code: Select all
//get BushingForce component between cerv6 and cerv7 vertebral bodies
const OpenSim::BushingForce& bushingObj = m_model->getComponent<BushingForce>("./forceset/C7_C6_Bushing");
//extract stiffness and damping parameters
SimTK::Vec6 stiffness = osimVec3ToVec6(bushingObj.get_rotational_stiffness(), bushingObj.get_translational_stiffness());
SimTK::Vec6 damping = osimVec3ToVec6(bushingObj.get_rotational_damping(), bushingObj.get_translational_stiffness());
//compute state dependent deflection and deflection rate between cerv6 and cerv7 PhysicalFrames
SimTK::Vec6 deflection = bushingObj.computeDeflection(*m_state);
SimTK::Vec6 deflectionrate = bushingObj.computeDeflectionRate(*m_state);
//compute internal bushing forces
SimTK::Vec6 fk = - stiffness.elementwiseMultiply(deflection);
SimTK::Vec6 fv = - damping.elementwiseMultiply(deflectionrate);
SimTK::Vec6 bushingForces = fk + fv;
//Set up spatial vectors, F1 in ground and F2 in ground
SimTK::SpatialVec F1_G;
SimTK::SpatialVec F2_G;
//THIS PART DOESN'T WORK
bushingObj.convertInternalForceToForcesOnFrames(*m_state, bushingForces, F1_G, F2_G);
auto& frame1_mobodindex = bushingObj.getFrame1().getMobilizedBodyIndex();
auto& frame2_mobodindex = bushingObj.getFrame2().getMobilizedBodyIndex();
SimTK::Vector_<SpatialVec> F_G;
F_G[frame1_mobodindex] = F1_G;
F_G[frame2_mobodindex] = F2_G;
SimTK::Vector tau_bushings;
smss.multiplyBySystemJacobianTranspose(*m_state, F_G, tau_bushings);
Thank you for any help!
Rebecca
Northwestern University
Department of Mechanical Engineering
Department of Physical Therapy and Human Movement Sciences