Skip to content

Sheilasr12/thermal_camera

 
 

Repository files navigation

ROS Noetic package for TeraRanger EVO 33

This package allows to use teraranger nodes for ROS Noetic (python 3) on a Raspberry Pi Model 3B, and send the information to a ROS2 foxy node.

Requirements

Installation

Libraries

This package depends on this serial library. To get it, execute the following command:

sudo apt-get install ros-noetic-serial

ROS

  1. Donwload the repository by running:
git clone [email protected]:roboticslab-uc3m/thermal_camera.git

- ROS1

  1. Open a terminal and create a ROS1 workspace:
source /opt/ros/noetic/setup.bash

mkdir -p /catkin_ws/src

cd /catkin_ws/src
  1. Get the teraranger package for ROS Noetic by copying on src folder the include/teraranger package.

  2. On the workspace folder run:

catkin_make && source devel/setup.bash

We already have the nodes to get the teraranager image with ROS1. Now we are going to install the ROS2 package to receive this information.

- ROS 2

  1. Open a terminal and create a ROS2 workspace:
source /opt/ros/foxy/setup.bash

mkdir -p /ros2_ws/src

cd /ros2_ws/src
  1. Get the teraranger package for ROS2 Foxy by copying on src folder the ROS_sub_pub package.

  2. On the workspace folder run:

colcon build && source install/setup.bash

Then we are ready to run the ROS2 node. However, we also need to set up the communication with ROS1 nodes. For that we use ROS Bridge.

- ROS Bridge

  1. Open a new terminal and donwload the ros1_bridge repository
git clone https://github.com/ros2/ros1_bridge.git

Follow the instructions to build the package

Use

The include/teraranger package, contains the necessary nodes to get the image and the information that the termal camera captures.

A publisher is a ROS node which is able to publish a message with a specific type called topic. A subscriber node is able to subscribe to a topic to receive a message each time it is published.

evo_thermal.py is a node that publishes three topics:

  • /teraranger_evo_thermal/rgb_image: a color mapped RGB image based on thermal data
  • /teraranger_evo_thermal/raw_temp_array: an array of 1024 raw thermal data
  • /teraranger_evo_thermal/ptat: internal temperature of the sensor

The ros1_bridge is a ROS package that allows to transform the ROS1 topics to ROS2 topics. It receives all the topics from ROS1 nodes and sents all these topics to ROS2 subscriber nodes.

The ROS2_sub_pub contains the node that receives the ROS2 topics from the ros1_bridge and republishes them as ROS2 topics.

It is a subsciber/publisher that receives and sends the three topics:

  • /teraranger_evo_thermal/rgb_image: a color mapped RGB image based on thermal data
  • /teraranger_evo_thermal/raw_temp_array: an array of 1024 raw thermal data
  • /teraranger_evo_thermal/ptat: internal temperature of the sensor

Examples

On this example we are going to execute the ROS1 node on Raspberry Pi, to get the termal camera image and information. Then we are going to execute the ROS2 nodes on a PC to transform the image and the information to ROS2 topics.

On the Raspberry Pi

  1. Open a terminal at carkin_ws folder and setup the enviroment variables
source /opt/ros/noetic/setup.bash
source devel/setup.bash
  1. Run on ROS Noetic the TeraRanger Evo Thermal 33 node on Raspberry Pi

After your workspace is built and sourced:

rosrun teraranger evo_thermal.py _portname:=/dev/ttyACM0

Now, we will have the ROS1 node publishing the three topics.

On the PC

  1. Open a terminal at catkin_ros1_bridge folder. Then setup the environment variables of ros noetic
source /opt/ros/noetic/setup.bash
  1. Setup the comunication with Raspberry Pi nodes
export ROS_MASTER_URI=http://<raspberry_ip>:11311
export ROS_IP=<pc_ip>

3.Setup the environment variables of ros2 foxy

source /opt/ros/foxy/setup.bash
  1. Set the bridge between ros1 noetic and ros2 foxy topics
ros2 run ros1_bridge dynamic_bridge

Now we will have set up the ros1 bridge.


Possible issue:

  • The command rostopic list returns the topic's name correctly
  • The command rostopic echo doesn't returns the topic's values

Solution: At /etc/hosts file add <raspberry_ip> raspberrypi



  1. Open another terminal at dev_ws folder. Then setup the environment variables of ros2 foxy
source /opt/ros/foxy/setup.bash
  1. Run the ros2 node to republish the topics on ros2.
ros2 run thermal_camera camera_sub_pub

Now, we will have the topics published on ROS2


ROSbag

To finish the example we are going to save all the ROS2 published nodes in order to reproduce them when it's necessary.

In the ROS2_sub_pub folder, is possible to find the bag_recorder_nodes package that save the raw_temp_array topic values on a rosbag file to replay them when it is necessary. It is called "simple_bag_recorder.cpp"

Moreover, on the thermal_camera folder, there is a launch file to run the camera_sub_pub node and the simple_bag_recorder node. To use it, you can run:

ros2 launch thermal_camera camera_launch.py data_name:=<bag_file_name>

This command will store the raw_temp_array topic on the folder data_saved/<bag_file_name>

About

Ros nodes for single TeraRanger sensors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 68.3%
  • C++ 28.0%
  • CMake 3.7%