From fefa24e0440fac82666f0de475bfc351167586f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Tue, 20 Sep 2022 08:30:27 +0200 Subject: [PATCH] Improved thermal camera tutorial (#270) Signed-off-by: ahcorde --- tutorials/thermal_camera.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tutorials/thermal_camera.md b/tutorials/thermal_camera.md index a7ebdcca..37097981 100644 --- a/tutorials/thermal_camera.md +++ b/tutorials/thermal_camera.md @@ -299,7 +299,7 @@ Here's an example 16-bit thermal camera subscriber that performs this conversion ```c #include -#include +#include #include // used to set the proper resolution of the camera's output (10mK) @@ -346,6 +346,21 @@ int main(int argc, char **argv) } ``` +Save the above code to a file named `main.cpp` and use this `CMakeLists.txt` to build it. + +```cmake +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) +project(image-listener) + +# Find the Gazebo Libraries used directly by the example +find_package(gz-msgs9 REQUIRED) +find_package(gz-transport12 REQUIRED) + +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC gz-msgs9 gz-transport12) +target_include_directories(${PROJECT_NAME} PUBLIC ${gz_msgs9_INCLUDE_DIRS}) +``` + Although most of the code above is described in the comments, let's go over the key points again: * The image published by the camera is represented as serialized bytes. In order to read the actual temperature data that's stored in the image, we need to convert the data in the image to unsigned 16-bit integers.