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

Use the symbols if they are already loaded #304

Closed
wants to merge 11 commits into from

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Aug 21, 2020

This PR is part of this other PR gazebosim/gz-sensors#38 and it's related with this issue gazebosim/gz-sensors#18

The symbols for some sensors are already loaded when the ignition::gazebo::systems::Sensors is loaded (In particular Camera and ThermalCamera). Instead of creating the sensor using the Manager class (which needs to reload the library which is already loaded by the system Sensor, it's generating some issue.) I instantiated the class and add it to the Manager.

Signed-off-by: ahcorde ahcorde@gmail.com

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
this->sensorFactory.CreateSensor<
sensors::AirPressureSensor>(data);
std::make_unique<sensors::AirPressureSensor>();
sensor->Load(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at the CreateSensor function, it also makes a sensor->Init() call in addition to sensor->Load

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added init() method 3f42c00

cameraSensor->Load(_sdf);
sensorId = this->dataPtr->sensorManager.AddSensor(std::move(cameraSensor));
}
else if (_sdf.Type() == sdf::SensorType::THERMAL_CAMERA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you also need to do the same for depth and rgbd camera? or do they work with CreateSensor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depth and rgbd camera classes are not being used, we don't need to link against them, we can use createSensor. If need to modify some of the specific parameters, then we need to instanciate a class and create a specific case for them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can try sensors_demos.sdf which is creating: camera, depth_camera, gpu_lidar, rgbd_camera and thermal_camera

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is now targeting Edifice, I think lines 485 - 504 can be replaced with:

ignition::sensors::SensorId sensorId = this->dataPtr->sensorManager.CreateSensor(_sdf);

At least, this worked for me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the liberty of applying this change in 2f674e6. Feel free to revert.

Signed-off-by: ahcorde <ahcorde@gmail.com>
@chapulina chapulina added needs upstream release Blocked by a release of an upstream library beta Targeting beta release of upcoming collection labels Sep 4, 2020
@mjcarroll
Copy link
Contributor

@ahcorde This needs a bit of an update

@chapulina
Copy link
Contributor

We're retargeting the upstream PR gazebosim/gz-sensors#38 to Ign-E, and this one as well. Removing from the Dome beta.

@chapulina chapulina removed beta Targeting beta release of upcoming collection 🔮 dome Ignition Dome labels Sep 21, 2020
@chapulina chapulina changed the base branch from master to main October 3, 2020 01:29
@chapulina chapulina removed their request for review October 16, 2020 02:54
@@ -78,7 +78,11 @@ class ignition::gazebo::SystemLoaderPrivate
return false;
}

auto pluginName = *pluginNames.begin();
std::string pluginName = "";
for (auto name : pluginNames)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (auto name : pluginNames)
for (const auto &name : pluginNames)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied this change in 2f674e6

cameraSensor->Load(_sdf);
sensorId = this->dataPtr->sensorManager.AddSensor(std::move(cameraSensor));
}
else if (_sdf.Type() == sdf::SensorType::THERMAL_CAMERA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is now targeting Edifice, I think lines 485 - 504 can be replaced with:

ignition::sensors::SensorId sensorId = this->dataPtr->sensorManager.CreateSensor(_sdf);

At least, this worked for me.

Signed-off-by: Nate Koenig <nate@openrobotics.org>
@codecov
Copy link

codecov bot commented Jan 29, 2021

Codecov Report

Merging #304 (2f674e6) into main (cd78bd4) will decrease coverage by 0.03%.
The diff coverage is 47.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
- Coverage   77.38%   77.35%   -0.04%     
==========================================
  Files         213      213              
  Lines       11954    11966      +12     
==========================================
+ Hits         9251     9256       +5     
- Misses       2703     2710       +7     
Impacted Files Coverage Δ
src/systems/air_pressure/AirPressure.cc 75.00% <42.85%> (-0.76%) ⬇️
src/systems/altimeter/Altimeter.cc 75.71% <42.85%> (-0.76%) ⬇️
src/systems/imu/Imu.cc 73.07% <42.85%> (-0.61%) ⬇️
src/systems/logical_camera/LogicalCamera.cc 77.33% <42.85%> (-0.75%) ⬇️
src/systems/magnetometer/Magnetometer.cc 72.36% <42.85%> (-0.61%) ⬇️
src/SystemLoader.cc 77.77% <100.00%> (+0.72%) ⬆️
src/network/PeerInfo.cc 95.45% <0.00%> (-4.55%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd78bd4...2f674e6. Read the comment docs.

@chapulina
Copy link
Contributor

With the proposal on gazebosim/gz-plugin#35, I think this PR isn't necessary.

@chapulina chapulina added the 🏢 edifice Ignition Edifice label Feb 6, 2021
@chapulina chapulina added the beta Targeting beta release of upcoming collection label Mar 17, 2021
@chapulina
Copy link
Contributor

Removing beta label, we won't have time to wrap this up before code freeze. Let's retarget at Ignition-F.

@chapulina chapulina removed the beta Targeting beta release of upcoming collection label Mar 23, 2021
@chapulina chapulina added 🏯 fortress Ignition Fortress and removed 🏢 edifice Ignition Edifice labels Apr 1, 2021
@chapulina
Copy link
Contributor

Superseded by #617

@chapulina chapulina closed this Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🏯 fortress Ignition Fortress needs upstream release Blocked by a release of an upstream library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants