Skip to content

Read device temperature #866

@Panepo

Description

@Panepo
Required Info
Camera Model D410
Firmware Version 05.06.09.00
Operating System & Version Win10 (Build 16299)
Kernel Version (Linux Only)

Hi there,
I am trying to read both ASIC and projector temperature by following:

import pyrealsense2 as rs
import numpy as np
import cv2

pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)

cfg = pipeline.start(config)
dev = cfg.get_device()
depth_sensor = dev.first_depth_sensor()

try:
    while True:

        # Wait for a coherent pair of frames: depth and color
        frames = pipeline.wait_for_frames()
        depth_frame = frames.get_depth_frame()
        color_frame = frames.get_color_frame()
        
        # Convert images to numpy arrays
        depth_image = np.asanyarray(depth_frame.get_data())
        color_image = np.asanyarray(color_frame.get_data())

        # Apply colormap on depth image (image must be converted to 8-bit per pixel first)
        depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, None, 0.5, 0), cv2.COLORMAP_JET)

        # Stack both images horizontally
        images = np.hstack((color_image, depth_colormap))
        
        # Get device temperature
        tempProj = depth_sensor.get_option(rs.option.projector_temperature)
        print("tempProj: " + str(tempProj))
        tempAsic = depth_sensor.get_option(rs.option.asic_temperature)
        print("tempAsic: " + str(tempAsic ))

        # Show images
        cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)
        cv2.imshow('RealSense', images)
        cv2.waitKey(1)

finally:

    # Stop streaming
    pipeline.stop()

But the temperature outputs are the same while I streaming, the outputs only change while I restart the program. How to read the device temperature dynamically?
Thanks

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions