Skip to content

Commit

Permalink
Improved thermal camera tutorial (#270)
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <[email protected]>
  • Loading branch information
ahcorde authored Sep 20, 2022
1 parent 85f20cb commit fefa24e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tutorials/thermal_camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Here's an example 16-bit thermal camera subscriber that performs this conversion
```c
#include <cstdint>

#include <gz/msgs.hh>
#include <gz/msgs/image.pb.h>
#include <gz/transport.hh>

// used to set the proper resolution of the camera's output (10mK)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit fefa24e

Please sign in to comment.