0
$\begingroup$

Gazebo Answers logo

Hello,

I updated ubuntu 12.04 yesterday and I am running Gazebo standslone 1.8.6 and Ros fuerte. The problem is after installing updates the contact sensor plugin compiling error

error: ‘const class gazebo::msgs::JointWrench’ has no member named ‘body_2_torque’

before the updates the plugin was running perfectly. And this error only related to body forces and torques

for (unsigned int j = 0; j < contacts.contact(i).wrench_size(); ++j)      
    {                

      std::cout << j << " wrench between [" <<                              
        contacts.contact(i).wrench(j).body_1_name() << "] and [" <<         
        contacts.contact(i).wrench(j).body_2_name() << "]\n";               
      std::cout << "  body_1_force: "                                       
                << contacts.contact(i).wrench(j).body_1_force().x() << " "  
                << contacts.contact(i).wrench(j).body_1_force().y() << " "  
                << contacts.contact(i).wrench(j).body_1_force().z() << "\n";                                                                               
      std::cout << "  body_2_force: "                                       
                << contacts.contact(i).wrench(j).body_2_force().x() << " "  
                << contacts.contact(i).wrench(j).body_2_force().y() << " "  
                << contacts.contact(i).wrench(j).body_2_force().z() << "\n";                                                                               
      std::cout << "  body_1_torque: "                                      
                << contacts.contact(i).wrench(j).body_1_torque().x() << " "
                << contacts.contact(i).wrench(j).body_1_torque().y() << " "
                << contacts.contact(i).wrench(j).body_1_torque().z() << "\n";                                                                              
      std::cout << "  body_2_torque: "                                      
                << contacts.contact(i).wrench(j).body_2_torque().x() << " "
                << contacts.contact(i).wrench(j).body_2_torque().y() << " "
                << contacts.contact(i).wrench(j).body_2_torque().z() << "\n";                                                                              
    }         

otherwise the position , depth, normal and collision strings are working. Any suggestions are so much appreciated. Thanks in advance!


Originally posted by Zahra on Gazebo Answers with karma: 122 on 2013-07-26

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

The gazebo::msgs::JointWrench has changed.

For force:

contacts.contact(i).wrench(j).body_1_wrench().force()

and for torque:

contacts.contact(i).wrench(j).body_1_wrench().torque()

Originally posted by nkoenig with karma: 7676 on 2013-07-26

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Zahra on 2013-07-29:
Thanks a lot. it works!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.