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

Add thermal sensor system for configuring thermal camera properties #614

Merged
merged 16 commits into from
Feb 10, 2021

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Feb 5, 2021

Summary

depends on

related but not necessarily needed:

Added a new thermal-camera system for setting thermal camera properties:

  • temperature linear resolution
  • min and max temperature range

This is required for simulating an 8 bit thermal camera sensor. The existing default params are suited for 16 bit image output, e.g. resolution defaults to 0.01 which is too high for an 8 bit camera, so we'll need a plugin for configuring these properties.

A better long term plan for this is to add these params to the sdf spec.

To Test

I've updated the thermal camera example world into include an 8 bit thermal camera:

ign gazebo -v 4 thermal_camera.sdf

Here is a screenshot of the ign gazebo with 16 bit and 8 bit image display side by side.

thermal_image_8_16_bit

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)

Note to maintainers: Remember to use Squash-Merge

@iche033 iche033 requested a review from adlarkin February 5, 2021 09:11
@iche033 iche033 requested a review from chapulina as a code owner February 5, 2021 09:11
@github-actions github-actions bot added the 🔮 dome Ignition Dome label Feb 5, 2021
@iche033 iche033 added enhancement New feature or request needs upstream release Blocked by a release of an upstream library labels Feb 5, 2021
@iche033 iche033 changed the title Add thermal sensor system for configuring thermal camera sensors Add thermal sensor system for configuring thermal camera properties Feb 5, 2021
@adlarkin
Copy link
Contributor

adlarkin commented Feb 5, 2021

I'm seeing slightly different results when running the example (take a look at the cell phone in my image). @iche033 can you tell me what version of the cell phone fuel model you're using? I just tried updating to the most recent model, and it looks like I am using version 6.
8_bit_temp

@adlarkin
Copy link
Contributor

adlarkin commented Feb 5, 2021

Also, it looks like gazebosim/sdformat#487 has been approved in case we'd like to make use of that PR here.

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

  /github/workspace/src/rendering/RenderUtil.cc:308:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
  /github/workspace/src/systems/thermal/ThermalSensor.cc:93:  Lines should be <= 80 characters long  [whitespace/line_length] [2]

src/systems/thermal/CMakeLists.txt Outdated Show resolved Hide resolved
src/systems/thermal/ThermalSensor.cc Show resolved Hide resolved
Copy link
Contributor

@adlarkin adlarkin left a comment

Choose a reason for hiding this comment

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

Overall, looks good to me so far. I can give this another review once we add in the remaining pieces like tests.

examples/worlds/thermal_camera.sdf Outdated Show resolved Hide resolved
src/EntityComponentManager.cc Outdated Show resolved Hide resolved
src/rendering/RenderUtil.cc Outdated Show resolved Hide resolved
src/rendering/RenderUtil.cc Outdated Show resolved Hide resolved
src/rendering/RenderUtil.cc Show resolved Hide resolved
src/systems/sensors/Sensors.cc Show resolved Hide resolved
src/rendering/RenderUtil.cc Outdated Show resolved Hide resolved
@iche033
Copy link
Contributor Author

iche033 commented Feb 6, 2021

@iche033 can you tell me what version of the cell phone fuel model you're using?

I was using a modified local copy of the phone model. I just removed then redownloaded it. Now I get the same image as yours.

I can give this another review once we add in the remaining pieces like tests.

I've added an test in ee13143. As for documentation, let's update the tutorial separately and include all the new changes we made in the past few weeks.

@iche033 iche033 requested a review from ahcorde February 6, 2021 09:25
@codecov
Copy link

codecov bot commented Feb 6, 2021

Codecov Report

Merging #614 (d56d772) into ign-gazebo4 (766bb23) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           ign-gazebo4     #614      +/-   ##
===============================================
- Coverage        77.40%   77.32%   -0.08%     
===============================================
  Files              218      216       -2     
  Lines            12254    12205      -49     
===============================================
- Hits              9485     9438      -47     
+ Misses            2769     2767       -2     
Impacted Files Coverage Δ
include/ignition/gazebo/components/Temperature.hh 100.00% <100.00%> (ø)
src/SystemLoader.cc 72.13% <0.00%> (-4.92%) ⬇️
src/systems/thermal/Thermal.hh
src/systems/thermal/Thermal.cc

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 766bb23...d56d772. Read the comment docs.

@@ -292,7 +292,7 @@
<always_on>1</always_on>
<update_rate>30</update_rate>
<visualize>true</visualize>
<topic>thermal_camera_8bit</topic>
<topic>thermal_camera_8bit/image</topic>
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency, should we modify the other thermal camera's topic to be thermal_camera/image? Right now, the 8 bit camera has topics /thermal_camera_8bit/image and /thermal_camera_8bit/camera_info, but the original thermal camera has topics /thermal_camera and /camera_info, which might confuse users. I think it would be good to make the original thermal camera use the topics /thermal_camera/image and /thermal_camera/camera_info so that there's consistency between the two thermal cameras.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't touch the existing topics in case there are users out there relying on these topics in this world.

How about we change it in Edifice?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine 👍 I'll just make sure I explicitly point out which topics are associated with which camera in the tutorial

src/rendering/RenderUtil.cc Outdated Show resolved Hide resolved
src/rendering/RenderUtil.cc Outdated Show resolved Hide resolved
src/rendering/RenderUtil.cc Outdated Show resolved Hide resolved
test/integration/thermal_system.cc Outdated Show resolved Hide resolved
test/integration/thermal_system.cc Show resolved Hide resolved
test/worlds/thermal.sdf Show resolved Hide resolved
test/worlds/thermal.sdf Outdated Show resolved Hide resolved
test/integration/thermal_system.cc Outdated Show resolved Hide resolved
@adlarkin
Copy link
Contributor

adlarkin commented Feb 9, 2021

@iche033 I noticed that it looks like we are only configuring thermal visuals in RenderUtil.cc if things have not been initialized yet: https://github.com/ignitionrobotics/ign-gazebo/blob/555a84ea54a6f92b46929eb2f1a43daa13b1fadb/src/rendering/RenderUtil.cc#L822-L877

However, I believe that we also want to add any new thermal visuals that may appear after initialization as well: https://github.com/ignitionrobotics/ign-gazebo/blob/555a84ea54a6f92b46929eb2f1a43daa13b1fadb/src/rendering/RenderUtil.cc#L1033-L1068

If you agree with me on this, should we make this update in this PR, or in a separate PR?

@iche033
Copy link
Contributor Author

iche033 commented Feb 9, 2021

@iche033 I noticed that it looks like we are only configuring thermal visuals in RenderUtil.cc if things have not been initialized yet:

good catch. I've updated it in this PR. f377905

@adlarkin adlarkin mentioned this pull request Feb 9, 2021
<plugin
filename="ignition-gazebo-thermal-system"
name="ignition::gazebo::systems::Thermal">
<temperature>600.0</temperature>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change the temperature for the sphere to be below the camera's default minimum temperature value so that we can make sure that values below the minimum are clamped to the minimum (just like how we are checking that values above the max are clamped to the max with the cylinder)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm working on adding this test case, but haven't been able to get the results I want yet. I will keep working on it.

Copy link
Contributor

@adlarkin adlarkin Feb 10, 2021

Choose a reason for hiding this comment

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

I've created some draft PRs to show the current status of what I am trying:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the issue is that ign-rendering does not accept temperature below zero thus giving it ambient temperature.

How about we clamp negative values to 0 in the thermal system (or in ign-rendering) and print out a warning? Theoretically nothing can be colder than absolute zero (0 K) so it's reasonable to do a quick sanity check.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried clamping negative to 0 in gazebosim/gz-rendering#243, but that didn't seem to work. Perhaps I am doing it too late in the pipeline. I will try this in the gazebo plugin to see if I get better results

Copy link
Contributor

Choose a reason for hiding this comment

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

The PRs above seem to successfully add in this test case now. We will merge the PRs above later since we need to merge this ASAP for an ign-gazebo release (merging these PRs would delay the release since it would require a patch release in ign-rendering).

Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Comment on lines 63 to 64
ignerr << "The thermal sensor system can only be attached to a "
<< "thermal sensor" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

is this trace right ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah. Perhaps the wording is a little confusing, but the thermal sensor system allows users to customize the configuration/parameters of the thermal sensor/camera it's attached to. Would you recommend using different wording to help minimize confusion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

test/integration/thermal_system.cc Outdated Show resolved Hide resolved
test/integration/thermal_sensor_system.cc Outdated Show resolved Hide resolved
@adlarkin adlarkin mentioned this pull request Feb 10, 2021
4 tasks
@ahcorde
Copy link
Contributor

ahcorde commented Feb 10, 2021

@adlarkin
Copy link
Contributor

Some tests are failing

I believe this is because we need some releases for ign-rendering and ign-sensors. I will check back on this once those releases are out.

Signed-off-by: Ian Chen <[email protected]>
@nkoenig nkoenig removed the needs upstream release Blocked by a release of an upstream library label Feb 10, 2021
@nkoenig
Copy link
Contributor

nkoenig commented Feb 10, 2021

Some tests are failing

I believe this is because we need some releases for ign-rendering and ign-sensors. I will check back on this once those releases are out.

The releases are now out.

@adlarkin
Copy link
Contributor

All checks are running now. I'm just waiting for the results from CI and GitHub actions.

Signed-off-by: Ian Chen <[email protected]>
@adlarkin adlarkin dismissed ahcorde’s stale review February 10, 2021 22:14

Comments have been addressed, and we need to merge this for an ign-gazebo release.

@adlarkin adlarkin merged commit e647570 into ign-gazebo4 Feb 10, 2021
@adlarkin adlarkin deleted the thermal_sensor_system branch February 10, 2021 22:59
This was referenced Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔮 dome Ignition Dome enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants