-
Notifications
You must be signed in to change notification settings - Fork 58
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
Replace ign common plugin loader with ign-plugin #38
Conversation
Signed-off-by: ahcorde <[email protected]>
Off the top of my head, I can't think of why no plugins are showing up for |
I try to explain what I think it's happening here:
The Macro I have create a simple demo to reproduce this here. The right example to hace a look is The |
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
I think I found a solution. If the symbols are already loaded, why we need to reload it again? There is no need to do it. I added in the The I will use this class in |
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
waiting this PR #46 that fix the Github actions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like plugins are not being loaded correctly on CI
@@ -19,6 +19,8 @@ | |||
#include <ignition/common/Profiler.hh> | |||
#include <ignition/transport/Node.hh> | |||
|
|||
#include <ignition/plugin/Register.hh> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this include needed at every sensor? Shouldn't SensorFactory.hh
be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According with the migration guide https://github.com/ignitionrobotics/ign-plugin/blob/94482af3e9b2cc1cbb7c2dbeb2c7846f8283f0f6/MIGRATION.md#registering-a-plugin
I added this header for registering plugins. All sensors are individual components that why I need to use ignition/plugin/Register.hh
in the cc
file. I tried to include this header (or #include <ignition/plugin/RegisterMore.hh>
) in the SensorFactory.hh
but I was not able to compile the code because an undefined reference:
``/usr/bin/ld: ../lib/libignition-sensors4-imu.so.4.0.0~pre1: undefined reference `IgnitionPluginHook'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According with the migration guide
I see. I mean, we'd still be including that header, just indirectly. The way ign-sensors
is exposing the plugin functionality is through SensorFactory
. So technically each sensor doesn't need to know about ign-plugins
, they just know they need to use the IGN_SENSORS_REGISTER_SENSOR
macro from the SensorFactory.hh
header.
I tried to include this header (or #include <ignition/plugin/RegisterMore.hh>) in the SensorFactory.hh but I was not able to compile the code because an undefined reference:
SensorFactory.hh
uses the IGNITION_ADD_PLUGIN
macro from ignition/plugin/Register.hh
, so I believe it should include that header. Otherwise, that header is not usable on its own.
And it probably needs to link against ignition-plugin${IGN_PLUGIN_VER}::register
to fix the undefined reference. I believe that if you link to it publicly, then each individual sensor won't need to also link against register
, only against ign-sensors
's core library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chapulina, I was trying your suggestion but I'm not able to compile the code. I was having a look to other packages that make use of ignition-plugin and the approach it's similar to the one that I used here. For example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's similar to the one that I used here
I think the key difference here is that the IGNITION_ADD_PLUGIN
macro is used in SensorFactory
, not in each plugin. All the examples you gave use that macro directly on the plugin files.
Does SensorFactory.hh
work if you don't include Register.hh
above it? If it doesn't, that sounds like an architecture flaw. A header should work when included by itself, without the need for extra includes above it, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All plugin are using the MACRO but it's hidden under this other one IGN_SENSORS_REGISTER_SENSOR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chapulina I can remove IGN_SENSORS_REGISTER_SENSOR
and make use of `IGNITION_ADD_PLUGIN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the CI is not able to run the tests. But I'm not able to reproduce it in my machine. I will try on a docker container. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the CI is not able to run the tests. But I'm not able to reproduce it in my machine.
I'm seeing the same failures locally, i.e.
$ ./build/ignition-sensors4/bin/INTEGRATION_imu_plugin
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from ImuSensorTest
[ RUN ] ImuSensorTest.CreateImu
[Err] [SensorFactory.cc:81] Unable to load sensor plugin file for [/home/chapulina/dome_ws/install/lib/libignition-sensors4-imu.so]
[Err] [SensorFactory.cc:166] Unable to instantiate sensor plugin for [ignition-sensors4-imu]
[Err] [SensorFactory.hh:133] Failed to create sensor of type[imu]
/home/chapulina/dome_ws/src/ign-sensors/test/integration/imu_plugin.cc:85: Failure
Value of: sensor != nullptr
Actual: false
Expected: true
Segmentation fault (core dumped)
It looks like the shared library is generated and installed, but it doesn't have the correct symbols inside it.
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple more comments.
And great work cleaning up the Windows warnings! Those could even be pushed to a separate PR so they can get merged faster.
@@ -23,12 +23,20 @@ | |||
|
|||
#include <sdf/sdf.hh> | |||
|
|||
#include <ignition/common/PluginMacros.hh> | |||
#include <ignition/plugin/RegisterMore.hh> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No other plugins have RegisterMore
on their headers, can it be removed here?
@@ -191,19 +195,14 @@ TEST(ImuSensor_TEST, CreateImuSensor) | |||
sdf::ElementPtr imuSDF = ImuSensorToSDF(name, update_rate, topic, | |||
accelNoise, gyroNoise, always_on, visualize); | |||
|
|||
// Create an ImuSensor | |||
auto sensor = mgr.CreateSensor<ignition::sensors::ImuSensor>(imuSDF); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't remove the CreateSensor
tests, that function is still supported, right?
Instead, we should add separate tests for the Load
functionality that you're using below.
Just talked to @ahcorde , we'll save this for Ign-E so we have more time to try and test the new approach. Removing it from the Dome beta. |
This PR is outdated, it would be nice to sync it with the current |
Signed-off-by: Louise Poubel <[email protected]>
Removing beta label, we won't have time to wrap this up before code freeze. Let's retarget at Ignition-F. |
The plugin interface was completely removed on #90. |
This PR is related with this issue #18
I have some issue. When I run the tests for
ign-sensors4
everything look good. Then problem is insideign-gazebo
code, when the library is loaded for some plugins is not able to find the pluginNames.For example:
Camera
LoadLib()
returns that the loaded plugin isN8ignition7sensors2v416SensorTypePluginINS1_12CameraSensorEEE
-> ignition::sensors::v4::SensorTypePluginignition::sensors::v4::CameraSensorign-gazebo
code: theLoadLib()
returns a empty structure. (No loaded plugins)Depth Camera or GPU lidar are working properly.
Maybe @mxgrey or @scpeters can add some light here.
Signed-off-by: ahcorde [email protected]