Resolving issue#1007 Visualizing dynamically created joints. Create a callback function.
I want to start contribute to Gazebo development by starting with this issue : Visualizing dynamically created joints
I have some (silly) doubts. If I add this in the test created for this issue
// Create dynamic joint std::string name = "dynamic_joint_unique"; physics::JointPtr joint; joint = physics->CreateJoint("revolute", model); joint->Load(parent, child, math::Pose(0, 0, 0.5, 0, 0, 0)); joint->Attach(parent, child); joint->SetModel(model); joint->Init(); joint->SetName(name); //Reinitialize model model->Init(); //Subscribe to the ~/joints topic. transport::SubscriberPtr sub = node->Subscribe("~/joints", ?? )
What method to call (as a parameter for the subscriber)?
The SubscriberPtr, which is a pointer to Subscriber object (3) has member functions "getcallbackid", "view topic", etc. It doesn't seem to be useful. How to use the info obtained by the subscriber and transfer it to Model?
Or I am wrong in my concepts. As far as I understood, the ~/joints topic will contain info about the new, dynamically created joint after reinitializing the model, which is publishing a msg of type Joint. We subscribe to it. Model->GetJoints is returning the vector model::joints.
I also was going through this pull request for some help in creating the callback function https://bitbucket.org/osrf/gazebo/pull-request/1413/allow-multiple-contact-sensors-per-link/diff#chg-test/integration/contact_sensor.cc