Gazebo | Ignition | Community
Ask Your Question
0

contact sensor compiling error related to the body forces/torques after installing updates.

asked 2013-07-26 05:03:15 -0500

Zahra gravatar image

updated 2013-07-26 10:37:21 -0500

nkoenig gravatar image

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 ‘body2torque’

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!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2013-07-26 10:41:38 -0500

nkoenig gravatar image

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()
edit flag offensive delete link more

Comments

Thanks a lot. it works!

Zahra gravatar imageZahra ( 2013-07-29 06:42:28 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-07-26 05:03:15 -0500

Seen: 1,036 times

Last updated: Jul 26 '13