librealsense: RealSense error calling rs2_run_on_chip_calibration_cpp(device:0x559eecacdfa0): hwmon command 0x80( 8 3 0 0 ) failed (response -7= HW not ready)


Required Info
Camera Model D435i
Firmware Version 05.12.06.00
Operating System & Version Linux Ubuntu 18.04
Kernel Version (Linux Only) 5.4.0-42-generic
Platform PC
SDK Version 2.36.0
Language C++
Segment Robotics

Hi,

I am running tests on multiple cameras (around 10) to test whether all the D435i has similar behavior coming from the factory. One thing I am comparing is the performance with factory settings and after a on chip self calibration. I am also trying out some different kinds of visual presets. The issue is that sometimes the The code I use for configuring the cameras can be seen below. The issue is that sometimes the cameras are giving the following error when running the run_on_chip_calibration command.

#include <librealsense2/rs.hpp>
#include <librealsense2/rs_advanced_mode.hpp>
#include <fstream>
#include <iostream>

void calibrateCamera(rs2::pipeline& pipe, const rs2::config& stream_cfg,float& health){
  bool previous_stream = false;
  try{
    rs2::pipeline_profile active = pipe.get_active_profile();
    pipe.stop();
    previous_stream = true;
  }
  catch (const rs2::error & e){
    std::cerr << "No active profile" << std::endl;
  } 
  
  rs2::config cfg;
  cfg.enable_stream(RS2_STREAM_DEPTH, 256, 144, RS2_FORMAT_Z16, 90);
  rs2::device dev = pipe.start(cfg).get_device();
  rs2::auto_calibrated_device cal = dev.as<rs2::auto_calibrated_device>();
  std::string calibration_file_name = "/home/daniel/catkin_ws/src/pcl_test/calibration_params.json";
  std::ifstream t(calibration_file_name);
  std::string calibration_json((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
  try{
    rs2::calibration_table res = cal.run_on_chip_calibration(calibration_json, &health, [&](const float progress){ /* On Progress */ });
    std::cout << "Health: " << health << std::endl;
    cal.set_calibration_table(res);
    //if(std::abs(health) < 0.25){
      cal.write_calibration();
    //}
  }
  catch (const rs2::error & e){
    std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n    " << e.what() << std::endl;
  } 
  
  pipe.stop();
  if(previous_stream){
    pipe.start(stream_cfg);
  }
}

void configureCamera(rs2::pipeline& pipe, const std::string& config_file_name = "/home/daniel/catkin_ws/src/pcl_test/HighResHighAccuracyPreset.json"){
  rs2::device dev = pipe.get_active_profile().get_device();
  if (dev.is<rs400::advanced_mode>()){
    auto advanced_mode_dev = dev.as<rs400::advanced_mode>();
    // Check if advanced-mode is enabled
    if (!advanced_mode_dev.is_enabled()){
      // Enable advanced-mode
      advanced_mode_dev.toggle_advanced_mode(true);          
    }
    std::ifstream t(config_file_name);
    std::string config((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
    advanced_mode_dev.load_json(config);
    std::cout << "Configuration done" << std::endl;
  }
  else{
    std::cerr << "Current device doesn't support advanced-mode!\n";
  }
}


int main(int argc, char * argv[]) try
{  
  bool calibrate = true;

  rs2::pipeline pipe;
  rs2::config cfg;
  cfg.enable_stream(RS2_STREAM_DEPTH, 256, 144, RS2_FORMAT_Z16, 90);
  rs2::device dev = pipe.start(cfg).get_device();
  if(calibrate){
    float health;
    calibrateCamera(pipe, cfg, health);
  }
  else{
    rs2::auto_calibrated_device cal = dev.as<rs2::auto_calibrated_device>();
    cal.reset_to_factory_calibration();
    std::cout << "Factory calibration set " << std::endl;
  }
  bool default_preset = false;
  if(default_preset){
    configureCamera(pipe,"/home/daniel/catkin_ws/src/pcl_test/DefaultPreset_D435.json");
  }
  else{
    configureCamera(pipe);
  }
}
catch (const rs2::error & e)
{
  std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n    " << e.what() << std::endl;
  return EXIT_FAILURE;
}
catch (const std::exception& e)
{
  std::cerr << e.what() << std::endl;
  return EXIT_FAILURE;
}

Sometimes yields

RealSense error calling rs2_run_on_chip_calibration_cpp(device:0x559eecacdfa0):
    hwmon command 0x80( 8 3 0 0 ) failed (response -7= HW not ready)

Do you know why this error occurs? Usually it works by just trying again a couple of times. From what I have noticed while working with multiple cameras is that this error seem to happen with cameras that has been used for some time, and never happens with cameras that are brand new from the supplier. But I am not sure if that has anything to do with the actual problem. Any ideas about this? Thankful for help!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 30

Most upvoted comments

I had this issue trying to do on-chip calibration through realsense_viewer on a D435. It seems to have gone away with several restarts of the application.