Home | Tutorials | Wiki | Issues
Ask Your Question
0

Contact sensor: 6 axis force/torque sensing

asked 2012-12-22 22:00:06 -0500

cga gravatar image

It would be nice to extend the contact sensing tutorial to show how to add up all contact forces on a body to get an aggregate JointWrench (3 forces and 3 torques). This would allow the contact sensor to simulate a six axis force/torque sensor on the foot or wrist.

Even if the DRCSIM robot does not have such a sensor, this simulated sensor would be useful for debugging.

Thanks, Chris

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
1

answered 2013-01-15 11:34:24 -0500

hsu gravatar image

See example in drcsim for summing up contact forces.

edit flag offensive delete link more

Comments

nkoenig gravatar imagenkoenig ( 2013-07-23 17:27:38 -0500 )edit
1

answered 2013-01-15 09:47:30 -0500

nkoenig gravatar image

For you timing question:

I think you should also print out the names of the objects that are colliding. Multiple objects may collide, and in turn produce multiple contacts during a single step.

edit flag offensive delete link more
0

answered 2012-12-24 11:10:54 -0500

cga gravatar image

updated 2012-12-24 12:51:12 -0500

Here is the code to print out the force and torque information:

      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";                                                                              
        }                                                                       

These numbers are similar to gztopic echo /gazebo/default/box/link/my_contact

But the numbers are very noisy.

6.967 body_1_f/t: 1.88961 -0.588002 2.94002 1.176 0.525202 -0.650803
6.967 body_1_f/t: -1.88961 -0.588002 2.94002 1.176 -0.525202 0.650803
6.968 body_1_f/t: 0.423902 1.37199 6.85998 -2.74398 3.21804 -0.474047
6.968 body_1_f/t: -0.423902 1.37199 6.85998 -2.74398 -3.21804 0.474047

The first number is time. We get two non-zero body1force/body1torque readings per simulation step. As you can see, the readings on the same time step often cancel each other.

Averaging the readings from the start of the simulation, I get results like:

1.823: average:    -4.21216e-13 0.00652219 9.7963 -0.0130444 -8.42498e-13 4.81264e-17
...
13.947: average:    2.28457e-14 -0.000353792 9.79939 0.000707584 4.56434e-14 5.26419e-17
...
54.692: average:    6.79372e-14 -0.00105193 9.80068 0.00210386 1.35823e-13 4.91202e-17
...
64.643: average:    3.22536e-14 -0.000499399 9.79989 0.000998798 6.44554e-14 4.85676e-17

I suppose this helps us understand why ODE is such an "approximate" simulator. The "weight" of the box appears to be around 9.8 Newtons (G = 9.8), but with substantial error. The Y force and X torque are also troubling.

Is there any way to average contact forces and torques during a simulation step to at least reduce the noise?

Thanks,
Chris

*** Update ********

The timing of information is strange. Printing out:

      std::cout << count << " " << i << " " <<
        contacts.contact_size() << " " <<
        contacts.contact(i).time().sec() << " " <<
        contacts.contact(i).time().nsec() << "\n";

where count is a count of calls to void ContactPlugin::OnUpdate(), and i is from

  for (unsigned int i = 0; i < contacts.contact_size(); ++i)

generates:

19 0 16 0 1000000
19 1 16 0 2000000
19 2 16 0 3000000
19 3 16 0 4000000
19 4 16 0 5000000
19 5 16 0 6000000
19 6 16 0 7000000
19 7 16 0 8000000
19 8 16 0 9000000
19 9 16 0 10000000
19 10 16 0 11000000 ...
(more)
edit flag offensive delete link more

Comments

Chris, it would be better to include this as part of the question rather than as an answer.

asomerville gravatar imageasomerville ( 2013-01-15 16:41:05 -0500 )edit
0

answered 2013-01-15 12:24:31 -0500

Daehyung Park gravatar image
6.967 body_1_f/t: 1.88961 -0.588002 2.94002 1.176 0.525202 -0.650803
6.967 body_1_f/t: -1.88961 -0.588002 2.94002 1.176 -0.525202 0.650803
6.968 body_1_f/t: 0.423902 1.37199 6.85998 -2.74398 3.21804 -0.474047
6.968 body_1_f/t: -0.423902 1.37199 6.85998 -2.74398 -3.21804 0.474047

Could you print 'contacts.contact(i).collision1()' string together with above? I am also just started to use Gazebo and contact sensor, but in my case, I've never seen cancelling things. I guess two opposite forces from two colliding objects printed out.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2012-12-22 22:00:06 -0500

Seen: 2,425 times

Last updated: Jan 15 '13