Replace ign common plugin loader with ign-plugin#38
Conversation
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
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 <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
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 <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
waiting this PR #46 that fix the Github actions |
chapulina
left a comment
There was a problem hiding this comment.
It looks like plugins are not being loaded correctly on CI
| #include <ignition/common/Profiler.hh> | ||
| #include <ignition/transport/Node.hh> | ||
|
|
||
| #include <ignition/plugin/Register.hh> |
There was a problem hiding this comment.
Is this include needed at every sensor? Shouldn't SensorFactory.hh be enough?
There was a problem hiding this comment.
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.
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.
@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.
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.
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.
@chapulina I can remove IGN_SENSORS_REGISTER_SENSOR and make use of `IGNITION_ADD_PLUGIN.
There was a problem hiding this comment.
|
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. |
chapulina
left a comment
There was a problem hiding this comment.
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 <ahcorde@gmail.com>
|
@chapulina, regarding the failures in https://build.osrfoundation.org I have done some test inside a docker container and at least for Ubuntu I needed to add |
Signed-off-by: ahcorde <ahcorde@gmail.com>
bbaeaac to
b69410c
Compare
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
chapulina
left a comment
There was a problem hiding this comment.
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.
| #include <sdf/sdf.hh> | ||
|
|
||
| #include <ignition/common/PluginMacros.hh> | ||
| #include <ignition/plugin/RegisterMore.hh> |
There was a problem hiding this comment.
No other plugins have RegisterMore on their headers, can it be removed here?
| accelNoise, gyroNoise, always_on, visualize); | ||
|
|
||
| // Create an ImuSensor | ||
| auto sensor = mgr.CreateSensor<ignition::sensors::ImuSensor>(imuSDF); |
There was a problem hiding this comment.
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 <louise@openrobotics.org>
|
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-sensors4everything look good. Then problem is insideign-gazebocode, 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-gazebocode: 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 ahcorde@gmail.com