luxonis / depthai-ros

Official ROS Driver for DepthAI Sensors.
MIT License
251 stars 185 forks source link

[BUG] Pipeline crash with std::out_of_range on a std::unordered_map #596

Open MRo47 opened 2 hours ago

MRo47 commented 2 hours ago

Don't think this issue exists, searched in issues and PR's

Version: I'm currently 1 commit behind iron branch: cf5d2aaee9117298ea1632c98ffd36a5d7d535ac Device: OAK-D pro W

Trying to run yolo object detection on stereo pipeline, on the left mono camera only.

Steps to reproduce

  1. modify depthai-ros/depthai_ros_driver/config/camera.yaml
/**:
  ros__parameters:
    camera:
      i_enable_imu: true
      i_enable_ir: true
      i_nn_type: none
      i_pipeline_type: Stereo
    left:
      i_enable_nn: true
    left_nn:
      i_nn_config_path: depthai_ros_driver/yolo
  1. Then launch using
ros2 launch depthai_ros_driver camera.launch.py use_gdb:=true

I get error

1726855536.0914462 [bash-1] terminate called after throwing an instance of 'std::out_of_range'
1726855536.0915015 [bash-1]   what():  _Map_base::at

GDB

On tracing with gdb I found the error happens at

line 75 in src/dai_nodes/sensors/sensor_helpers.cpp

return rsSocketNameMap.at(socket);

the value its currently holding, probably by default is 1869766505 which does not correspond to any of the map entries that actually are enums

const std::unordered_map<dai::CameraBoardSocket, std::string> rsSocketNameMap = {
    {dai::CameraBoardSocket::AUTO, "color"},
    {dai::CameraBoardSocket::CAM_A, "color"},
    {dai::CameraBoardSocket::CAM_B, "infra2"},
    {dai::CameraBoardSocket::CAM_C, "infra1"},
    {dai::CameraBoardSocket::CAM_D, "infra4"},
    {dai::CameraBoardSocket::CAM_E, "infra3"},
};
MRo47 commented 2 hours ago

Also this does not happen when the i_nn_config_path is set to depthai_ros_driver/mobilenet_ssd