Gazebo | Ignition | Community
Ask Your Question
0

Problem with plugin referencing to a joint.

asked 2016-04-26 11:23:22 -0500

gabri89 gravatar image

Hi,

I made a gazebo plugin which simulates a particular motor. To do this I created this plugin which inherits from a ModelPlugin, and I take the joint from a model class. If there is a single joint it's ok, but if there are two or more joints, I need to give a reference to the plugin. As this link suggests I used the reference name of the joint in the gazebo tag.

<joint name="joint1" type="revolute">
<parent link="link1"/>
<child link="link2"/>
<origin xyz="0 ${width} ${height1 - axel_offset}" rpy="0 ${PI} 0"/> 
<limit lower="${-1.5*PI}" upper="${1.5*PI}" velocity="${2*PI}" effort="220"/> 
<axis xyz="0 1 0"/>
<dynamics damping="0.7"/>
<spring_stiffness>2300</spring_stiffness>
</joint>

<gazebo reference="joint1">
<plugin name="motor_spring" filename="/home/gabriele/gazebo_plugin_tutorial/build/libmotor_spring_plugin.so">
    <alwaysOn>true</alwaysOn>
</plugin>
</gazebo>

The compilation is ok, but when I try to start gazebo I see this warning:

Warning [parser.cc:713] XML Element[plugin], child of element[joint] not defined in SDF. Ignoring[plugin]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.

Do I wrong in positioning the gazebo tag in my xacro file? Do I wrong to use a ModelPlugin type? If there are more joint that uses the plugin, there is another way to do it?

Thank you!

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2016-04-26 19:15:05 -0500

scpeters gravatar image

updated 2016-04-26 19:29:52 -0500

A ModelPlugin can't be attached to a <joint>; it must be attached to the <model>. Perhaps you can add a parameter to your <plugin> that takes the name of the joint to use for the motor?

I realize that the tutorial you referenced is wrong. I've created an issue about fixing the tutorial.

edit flag offensive delete link more
0

answered 2016-04-30 10:33:36 -0500

gabri89 gravatar image

Hi, screpeters.

Ok, but I'm not able to obtain more than a joint name from xacro file. I made this in my xacro file :

<gazebo>
    <plugin name="motor_spring" filename="/home/gabriele/gazebo_plugin_tutorial/build/libmotor_spring_plugin.so"> 
    <alwaysOn>true</alwaysOn>
    <NumJoint> 2 <NumJoint>
    <JointName>joint1 , joint2</JointName>
</plugin>

</gazebo>

But I can't obtain a vector of string in my plugin. How I can get a list of joints name? I used std::vector<std::string>, but it's not true. Thank you!

edit flag offensive delete link more

Comments

1

I don't think it will work to parse as `std::vector<std::string>`, but you could parse it as a string and then manually split the string at the comma using `boost::split` ([example](https://bitbucket.org/osrf/gazebo/src/b3f5de12b2fa8695affd9ee2fc67dbb3d9c81b6e/gazebo/math/SignalStats.cc?fileviewer=file-view-default#SignalStats.cc-220))

scpeters gravatar imagescpeters ( 2016-05-01 01:12:37 -0500 )edit

Thank you, I solved the problem with your help! So I have a std::vector<std::string> containing all the joints name.

gabri89 gravatar imagegabri89 ( 2016-05-02 10:52:34 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-04-26 11:23:22 -0500

Seen: 2,720 times

Last updated: Apr 30 '16