valentinbarral / gazebosensorplugins

Some Gazebo plugins to simulate UWB and magnetic sensors.
MIT License
54 stars 21 forks source link

How to implement the plugin into Ros and Gazebo #2

Open Giaco94 opened 4 years ago

Giaco94 commented 4 years ago

I'm sorry but i have some trouble implementing your plugin on my gazebo simulation. The plugin has to be write into an .sdf file as

<?xml version="1.0" ?>

25 0.25 1.5 tag_0 uwb_anchor false 0

or i need to write something more inside my sdf file?

Moreover the following code <?xml version="1.0" ?>

0 0 1.5 0 0 0 1 0.2 0.2 0.2 i have to write inside the same .sdf file where i have write the plugin or inside the .world file? Can you provide a simple example of it? Thank you for your help!
plumewind commented 4 years ago

me, too

and I got a problem: In the model type plugin(UwbPlugin.cpp), I check the links like this:

std::vector<physics::LinkPtr> links = _model->GetLinks(); for (int i = 0; i < links.size(); ++i) { ROS_INFO("Link[%d]: %s", i, links[i]->GetName().c_str()); } but no uwb_tag_link(which I want , and is writen in urdf.xacro), so the link->getWorldPose is wrong, what should i do?

plumewind commented 4 years ago

I fixed it !

true
wangshanpao1991 commented 4 years ago

I fixed it ! true

Hello, I have met the same wrong with you. Could you tell me how to fix it? Thank you very much.

wangshanpao1991 commented 4 years ago

I'm sorry but i have some trouble implementing your plugin on my gazebo simulation. The plugin has to be write into an .sdf file as

 <sdf version="1.5">
      <plugin name='libgtec_uwb_plugin' filename='libgtec_uwb_plugin.so'>
          <update_rate>25</update_rate>
          <nlosSoftWallWidth>0.25</nlosSoftWallWidth>
          <tag_z_offset>1.5</tag_z_offset>
          <tag_link>tag_0</tag_link>
          <anchor_prefix>uwb_anchor</anchor_prefix>
          <all_los>false</all_los>
          <tag_id>0</tag_id>
       </plugin>
   </sdf>

or i need to write something more inside my sdf file?

Moreover the following code

 <sdf version="1.5">
 <model name="uwb_anchor0">
     <pose>0 0 1.5 0 0 0</pose>
     <static>1</static>
     <link name="link">
         <visual name="visual">
             <geometry>
               <box>
                   <size>0.2 0.2 0.2</size>
               </box>
             </geometry>
         </visual>
      </link>
</model>

i have to write inside the same .sdf file where i have write the plugin or inside the .world file?

Can you provide a simple example of it?

Thank you for your help!

Hello , the plugin should be added in the .sdf file with 'link_uwb' . And the model "UWB_anchor*" should be added in .world file.

gennscar commented 3 years ago

When I try to open the gazebo world with the plugin, after succesfully compiling the workspace, I receive this error

"A ROS node for Gazebo has not been initialized, unable to load plugin. Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)".

This is the world I have created:

<?xml` version="1.0" ?>

model://sun model://ground_plane 0 0 -9.8066 quick 10 1.3 0 0 0.2 100 0.001 0.004 1 250 6.0e-6 2.3e-5 -4.2e-5 0 0 1.5 0 0 0 1 0.2 0.2 0.2 25 0.25 1.5 tag_0 uwb_anchor false 0 1.5 0 0 0 0 0 1 0.2 0.2 0.2 25 0.25 0.0 tag_1 uwb_anchor false 1

Do you know how to solve this?