Using SetForce and GetJoint() Function
I'm trying to use the SetForce() function on my sdf model using a plugin, on a particular joint using the following commands:
std::string joint1 = this->model->GetName() + "::" + "rearleftwheel_joint";
physics::JointPtr rearleftwheel_joint=this->model->GetJoint(joint1);
rearleftwheel_joint->SetForce(0,20.0);
While running this plugin on my sdf model, I keep getting this error:
gzserver: /usr/include/boost/smartptr/sharedptr.hpp:648: typename boost::detail::spmemberaccess
I couldn't find much documentation for this error online; could someone please help me with this?
Running gazebo 7.14 and ubuntu 16.04
Plugin code:
Asked by rmv24 on 2019-04-14 22:51:04 UTC
Comments
@kumpakri could you have a look at this? Turns out I was running the wrong plugin when I said it worked
Asked by rmv24 on 2019-04-14 22:52:51 UTC
C:\fakepath\throttle_plugin2.cc - plugin code
Asked by rmv24 on 2019-04-15 09:23:12 UTC
Can you update this question with your SDF model? That might help with diagnosing the problem.
Asked by josephcoombe on 2019-04-15 14:18:55 UTC
@josephcoombe, I'm using the Polaris Ranger XP900 file from the model database: https://bitbucket.org/osrf/gazebo_models/src/e6d645674e8a99cb7955ce3b9a1fbe26c58c41f2/polaris_ranger_xp900/?at=default
Asked by rmv24 on 2019-04-15 18:29:12 UTC
Your plugin has this line
std::string joint = this->model->GetName()+ "polaris_ranger_xp900" + "rear_left_wheel_joint" ;
The"polaris_ranger_xp900"
substring is what cases the plugin not to find the joint (There forAssertion px != 0 failed.
) The name of the model is already provided by thethis->model->GetName()
and you need to devide the model name and the joint name with::
sign. Just as in you question description.Asked by kumpakri on 2019-04-17 03:12:29 UTC
@kumpakri, I'd already tried doing what you have suggested, but the same error showed up.
Asked by rmv24 on 2019-04-17 09:20:31 UTC