0
$\begingroup$

Gazebo Answers logo

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.

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

  2. 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


Originally posted by lugd1229 on Gazebo Answers with karma: 75 on 2013-02-01

Post score: 0


Original comments

Comment by hsu on 2013-02-06:
please post your code in your question. thanks.

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

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.


Originally posted by hsu with karma: 1873 on 2013-02-03

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by lugd1229 on 2013-02-06:
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.

Comment by lugd1229 on 2013-02-06:
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?

Comment by hsu on 2013-02-06:
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)

Comment by lugd1229 on 2013-02-11:
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?

Comment by nkoenig on 2013-02-13:
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.

$\endgroup$

Your Answer

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