Home | Tutorials | Wiki | Issues
Ask Your Question
0

contact sensor: how to get the force information

asked 2013-02-01 13:36:46 -0600

lugd1229 gravatar image

updated 2013-02-05 14:48:56 -0600

hsu gravatar image

Hi, All, I am working on add a contact sensor on a link, and I want to get the torque of the joint of this link, now I meet some question:

  1. msgs::contacts contacts, the order, I cannot find the member function 'contacts' of msgs, where can find the definition of msgs::contacts, and what type Variable is the contacts ? and how can I use its member function or events?

  2. when I use the

    function:unsigned int c = parentSensor->GetCollisionContactCount(const string&test_collision3)
    

    an error will appear:

    ContactPlugin.cc:56:57: error: expected primary-expression before ‘const’
    

    how to solved it? and other function including const appear this error too.

  3. I want to input the data of sensor in a .txt file, how can I do it?

  4. where can the document define the relationship between the sensor plugin.so and the plugin.cc, in CMakelist.txt or in the .world file? because I want to add 3 contact sensors to 3 links, so the plugins must be Distinguished.

thanks a lot

best gdlu

edit retag flag offensive close merge delete

Comments

please post your code in your question. thanks.

hsu gravatar imagehsu ( 2013-02-06 16:40:13 -0600 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2013-02-03 12:11:59 -0600

hsu gravatar image

updated 2013-02-05 14:53:18 -0600

Here's another example of how the information from a force torque sensor is simulated in drcsim:

Alternatively, there is a ticket to implement a ForceTorqueSensor class, which may simplify this process.

edit flag offensive delete link more

Comments

thank you, but how to solve the question 2: function:unsigned int c = parentSensor->GetCollisionContactCount(const string&test_collision3)

an error will appear:

ContactPlugin.cc:56:57: error: expected primary-expression before ‘const’

how to solved it? and other function including const appear this error too.

lugd1229 gravatar imagelugd1229 ( 2013-02-06 15:11:28 -0600 )edit

and I set the updatetime is 1 second , then there are 58 groups(contacts size)* 14 groups (position size) data, what difference between the contacts and the positions data?

lugd1229 gravatar imagelugd1229 ( 2013-02-06 15:17:14 -0600 )edit

A message may contain contact from multiple time steps, in this case, you have 58 groups, or 58 simulation time steps has occurred before the last contact message. Within each contact group, the number of contact joints actually generated by collision detection and solved by the physics engine is reflected by its position_size (14 in your example)

hsu gravatar imagehsu ( 2013-02-06 16:26:51 -0600 )edit

if I want to obtain the realtime data and draw the figure of the link's torque along the time, how can I deal with the data?

lugd1229 gravatar imagelugd1229 ( 2013-02-11 16:10:31 -0600 )edit

It's easiest to handle realtime data through a plugin. You can write a sensor or model plugin that process contact sensor data every iteration.

nkoenig gravatar imagenkoenig ( 2013-02-13 12:46:22 -0600 )edit
0

answered 2013-02-03 05:45:02 -0600

These links will clear your questions about contact and contacts messages.

contatcs

contact

Take a deep look in the Contact sensor tutorial. If you need a specific plugin for each contact sensor you can add something like this: (note it is added between <model> and </model>)

<sensor name='my_contact' type='contact'>    
    <plugin name="my_plugin" filename="libcontact.so"/>
    <contact>
        <collision>box_collision</collision>
    </contact>
</sensor>

I think the tutorial can help you.

Best reagards

edit flag offensive delete link more

Comments

thank you, I have learned the tutorial for many times, but some function I still cannot understand .

lugd1229 gravatar imagelugd1229 ( 2013-02-06 15:14:37 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-02-01 13:36:46 -0600

Seen: 725 times

Last updated: Feb 05 '13