Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Err] [Model.cc:1108] Model[drone_1] is attempting to load a plugin, but detected an incorrect plugin type. Plugin filename [libgazebo_gps_plugin.so] name[gps_plugin] #3

Open
MUCHWAY opened this issue Apr 1, 2022 · 13 comments

Comments

@MUCHWAY
Copy link

MUCHWAY commented Apr 1, 2022

my question is:

When I run: roslaunch vswarm vswarm_gazebo.launch n:=3 ,I get an error:

[Err] [Model.cc:1108] Model[drone_1] is attempting to load a plugin, but detected an incorrect plugin type. Plugin
filename[libgazebo_gps_plugin.so] name[gps_plugin]

/opt/ros/melodic/lib/gazebo_ros/gzserver:line 41: 20946 segfault (core dumped) GAZEBO_MASTER_URI="$desired_master_uri" GAZEBO_MODEL_DATABASE_URI="$desired_model_database_uri" gzserver $final

The error is that the gps_plugin is incorrect. After investigation, I found that the problem is:

vswarm_ws/src/vswarm/models/lequad/urdf/lequad_base.xacro:line158:

<!-- Instantiate gps plugin. -->
<xacro:gps_plugin_macro
namespace="${namespace}"
gps_noise="true" >
</xacro:gps_plugin_macro>

The gps_plugin location is at vswarm_ws/models/lequad/urdf/component_snippets.xacro:line127:

<xacro:macro name="gps_plugin_macro" params="namespace gps_noise">
<gazebo>
<plugin name="gps_plugin" filename="libgazebo_gps_plugin.so">
<robotNamespace>${namespace}</robotNamespace>
<gpsNoise>${gps_noise}</gpsNoise>
</plugin>
</gazebo>
</xacro:macro>

I checked:
First, the libgazebo_gps_plugin.so file exists, and I am sure it can be accessed (here I tested it with an absolute path)
Then, I used the px4 official code to test: roslaunch px4 mavros_posix_sitl.launch, it can be used normally, no error is reported, and the same libgazebo_gps_plugin.so is also called here, so I am sure that it is no problem.

Then I checked the call to the gps_plugin in iris.sdf in px4 and found gps.sdf, So i changed the original gps_plugin to:

<xacro:macro name="gps_plugin_macro" params="namespace gps_noise">
<gazebo>
<sensor name="gps" type="gps">
<plugin name="gps_plugin" filename="libgazebo_gps_plugin.so">
<robotNamespace>${namespace}</robotNamespace>
<gpsNoise>${gps_noise}</gpsNoise>
</plugin>
</sensor>
</gazebo>
</xacro:macro>

After this run, there is no error, but the behavior is:

[ INFO] [1648804076.876074416, 28.036000000]: HP: requesting home position

this error keeps appearing,My guess is that the gps plugin is still not working correctly, I tried subscribing to the /drone_1/mavros/local_position/pose topic and nothing came up, so it is true that the gps_plugin is not working properly.
Then I tried many methods without effect, so, I want to ask for help, this problem has been bothering me for days, if anyone can help me, thank you very much.

@MUCHWAY MUCHWAY changed the title [Err] [Model.cc:1108] Model[drone_1] is attempting to load a plugin, but detected an incorrect plugin type. Plugin filename[libgazebo_gps_plugin.so] name[gps_plugin] [Err] [Model.cc:1108] Model[drone_1] is attempting to load a plugin, but detected an incorrect plugin type. Plugin filename [libgazebo_gps_plugin.so] name[gps_plugin] Apr 1, 2022
@fabianschilling
Copy link
Contributor

PX4 can be quite verbose at times and HP: requesting home position only seems to be an info message. If you can successfully switch to position control (and you are fusing GPS) then I would say everything is working correctly.

@MUCHWAY
Copy link
Author

MUCHWAY commented Apr 2, 2022

@fabianschilling

This error doesn't just happen once or happens by accident, it happens constantly, like the following:

[ INFO] [1648865071.413654700, 180.776000000]: HP: requesting home position

[ INFO] [1648865085.361642477, 190.776000000]: HP: requesting home position

[ INFO] [1648865100.227298181, 200.776000000]: HP: requesting home position

[ INFO] [1648865116.611740218, 210.776000000]: HP: requesting home position

[ INFO] [1648865131.810260525, 220.776000000]: HP: requesting home position

[ INFO] [1648865146.680186603, 230.776000000]: HP: requesting home position

I switched the aircraft's mode to position according to your suggestion, and an error occurred:

INFO [tone_alarm] notify negative

I've tried subscribing to the topic of location in mavros,such as /drone_1/mavros/local_position/pose, but got nothing, so the problem should be that the gps plugin is not working properly.

And, when relative_localization_node.launch is started at this time, an error will also occur.

My problem is described in detail in the previous article, if you can, please help me analyze it.

@fabianschilling
Copy link
Contributor

The fact that you had to wrap <plugin> with another <sensor> tag to suppress the error suggests that there is a version mismatch somewhere. Are you using these Gazebo (9.16.0) and PX4 (v1.10.2) versions? I recall that the SDF/URDF description of drones/sensors changed quite frequently between releases.
I re-read your edited question but unfortunately I can not debug the problem effectively with the limited information. If you say that roslaunch px4 mavros_posix_sitl.launch works fine, try to diff the robot descriptions of the PX4 repo and the ones I'm using and fix potential differences.

@lithiumhydride2
Copy link

any update?i met same problem

@calmelo
Copy link

calmelo commented Sep 9, 2023

@fabianschilling

This error doesn't just happen once or happens by accident, it happens constantly, like the following:

[ INFO] [1648865071.413654700, 180.776000000]: HP: requesting home position

[ INFO] [1648865085.361642477, 190.776000000]: HP: requesting home position

[ INFO] [1648865100.227298181, 200.776000000]: HP: requesting home position

[ INFO] [1648865116.611740218, 210.776000000]: HP: requesting home position

[ INFO] [1648865131.810260525, 220.776000000]: HP: requesting home position

[ INFO] [1648865146.680186603, 230.776000000]: HP: requesting home position

I switched the aircraft's mode to position according to your suggestion, and an error occurred:

INFO [tone_alarm] notify negative

I've tried subscribing to the topic of location in mavros,such as /drone_1/mavros/local_position/pose, but got nothing, so the problem should be that the gps plugin is not working properly.

And, when relative_localization_node.launch is started at this time, an error will also occur.

My problem is described in detail in the previous article, if you can, please help me analyze it.

Have you resolve the problem? I meet the problem too. However, roslaunch px4 mavros_posix_sitl.launch can launch successfully, and there are gps data.

@calmelo
Copy link

calmelo commented Sep 9, 2023

I've tried subscribing to the topic of location in mavros,such as /drone_1/mavros/local_position/pose, but got nothing, so the problem should be that the gps plugin is not working properly.

I have Gazebo9.19.0 + px4 1.10.2, I can't get gps information by running the code. However, roslaunch px4 mavros_posix_sitl.launch can obtain the gps data. How can I resolve the problem? I will appreciate it if you can help me. Thanks!

@MUCHWAY
Copy link
Author

MUCHWAY commented Sep 15, 2023

I jump this problem by changing position source form gps to mocap。

@calmelo
Copy link

calmelo commented Sep 18, 2023

I jump this problem by changing position source form gps to mocap。

However, "vswarm takeoff" rely on the gps? If you use the mocap, can you run "vswarm takeoff" successfully?

@MUCHWAY
Copy link
Author

MUCHWAY commented Sep 18, 2023

yes, the "vswarm takeoff" can't be used, so I modified the takeoff by writing a script in python to send commands to the drone and QGroundControl to send takeoff commands.

@calmelo
Copy link

calmelo commented Nov 8, 2023

yes, the "vswarm takeoff" can't be used, so I modified the takeoff by writing a script in python to send commands to the drone and QGroundControl to send takeoff commands.

Can you share me the takeoff script? Thanks!

@lithiumhydride2
Copy link

lithiumhydride2 commented Nov 24, 2023

I fix this bug by change the code block in component_snippets.xacro:

  <xacro:macro name="gps_plugin_macro" params="namespace gps_noise">
    <gazebo>
      <plugin name="gps_plugin" filename="libgazebo_gps_plugin.so">
        <robotNamespace>${namespace}</robotNamespace>
        <gpsNoise>${gps_noise}</gpsNoise>
      </plugin>
    </gazebo>
  </xacro:macro>

into some code form px4_iris:

 <xacro:macro name="gps_plugin_macro" params="namespace gps_noise">
    <gazebo>
      <model name='gps0'>
        <link name='link'>
          <pose>0 0 0 0 0 0</pose>
          <inertial>
            <pose>0 0 0 0 0 0</pose>
            <mass>0.01</mass>
            <inertia>
              <ixx>2.1733e-06</ixx>
              <ixy>0</ixy>
              <ixz>0</ixz>
              <iyy>2.1733e-06</iyy>
              <iyz>0</iyz>
              <izz>1.8e-07</izz>
            </inertia>
          </inertial>
          <visual name='visual'>
            <geometry>
              <cylinder>
                <radius>0.01</radius>
                <length>0.002</length>
              </cylinder>
            </geometry>
            <material>
              <script>
                <name>Gazebo/Black</name>
                <uri>__default__</uri>
              </script>
            </material>
          </visual>

          <sensor name="gps" type="gps">
            <pose>0 0 0 0 0 0</pose>
            <plugin name="gps_plugin" filename="libgazebo_gps_plugin.so">
              <robotNamespace>${namespace}</robotNamespace>
              <gpsNoise>${gps_noise}</gpsNoise>
              <gpsXYRandomWalk>2.0</gpsXYRandomWalk>
              <gpsZRandomWalk>4.0</gpsZRandomWalk>
              <gpsXYNoiseDensity>0.0002</gpsXYNoiseDensity>
              <gpsZNoiseDensity>0.0004</gpsZNoiseDensity>
              <gpsVXYNoiseDensity>0.2</gpsVXYNoiseDensity>
              <gpsVZNoiseDensity>0.4</gpsVZNoiseDensity>
            </plugin>
          </sensor>
        </link>
      </model>
    </gazebo>

And vswarm takeoff works fine !

@calmelo
Copy link

calmelo commented Dec 8, 2023

I fix this bug by change the code block in component_snippets.xacro:

  <xacro:macro name="gps_plugin_macro" params="namespace gps_noise">
    <gazebo>
      <plugin name="gps_plugin" filename="libgazebo_gps_plugin.so">
        <robotNamespace>${namespace}</robotNamespace>
        <gpsNoise>${gps_noise}</gpsNoise>
      </plugin>
    </gazebo>
  </xacro:macro>

into some code form px4_iris:

 <xacro:macro name="gps_plugin_macro" params="namespace gps_noise">
    <gazebo>
      <model name='gps0'>
        <link name='link'>
          <pose>0 0 0 0 0 0</pose>
          <inertial>
            <pose>0 0 0 0 0 0</pose>
            <mass>0.01</mass>
            <inertia>
              <ixx>2.1733e-06</ixx>
              <ixy>0</ixy>
              <ixz>0</ixz>
              <iyy>2.1733e-06</iyy>
              <iyz>0</iyz>
              <izz>1.8e-07</izz>
            </inertia>
          </inertial>
          <visual name='visual'>
            <geometry>
              <cylinder>
                <radius>0.01</radius>
                <length>0.002</length>
              </cylinder>
            </geometry>
            <material>
              <script>
                <name>Gazebo/Black</name>
                <uri>__default__</uri>
              </script>
            </material>
          </visual>

          <sensor name="gps" type="gps">
            <pose>0 0 0 0 0 0</pose>
            <plugin name="gps_plugin" filename="libgazebo_gps_plugin.so">
              <robotNamespace>${namespace}</robotNamespace>
              <gpsNoise>${gps_noise}</gpsNoise>
              <gpsXYRandomWalk>2.0</gpsXYRandomWalk>
              <gpsZRandomWalk>4.0</gpsZRandomWalk>
              <gpsXYNoiseDensity>0.0002</gpsXYNoiseDensity>
              <gpsZNoiseDensity>0.0004</gpsZNoiseDensity>
              <gpsVXYNoiseDensity>0.2</gpsVXYNoiseDensity>
              <gpsVZNoiseDensity>0.4</gpsVZNoiseDensity>
            </plugin>
          </sensor>
        </link>
      </model>
    </gazebo>

And vswarm takeoff works fine !

Thanks, I can takeoff successfully now!
However, when I run "vswarm offboard", the uav has no movement.
Did you run the project successfully? If you run "vswarm offboard", can the uav have movement?
I'm looking forward to your reply. Thanks!

@lithiumhydride2
Copy link

HI, I ran this project successfully, after command "vswarm offboard", drones began to flock.
Some tips for you to check:

  • check if drone's mavros/state/mode' is OFFBOARD`
  • check if flocking_node is running without any error
    Maybe we can discuss more efficient in CHINESE, I note that you from WHU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants