in sensor_fusion_pkg/src/sensor_fusion_node.cpp [253:275]
void cameraCB(const deepracer_interfaces_pkg::msg::CameraMsg::SharedPtr msg) {
try {
lastCameraMsgRecievedTime = std::chrono::steady_clock::now();
cameraImageCount_ = msg->images.size();
auto sensorMsg = deepracer_interfaces_pkg::msg::EvoSensorMsg();
sensorMsg.images = msg->images;
// Update the LiDAR data with sector LiDAR data based on preprocessing configuration
if(sensorConfiguration_[LIDAR_KEY][LIDAR_CONFIG_PREPROCESS_TYPE_KEY] == sector){
std::lock_guard<std::mutex> guard(lidarMutex_);
size_t blockSize = lidarData_.size()/sensorConfiguration_[LIDAR_KEY][LIDAR_CONFIG_NUM_LIDAR_SECTORS_KEY];
auto sectorLidarData = binarySectorizeLidarData(lidarData_, blockSize, maxLiDARDist_);
sensorMsg.lidar_data = sectorLidarData;
} else {
std::lock_guard<std::mutex> guard(lidarMutex_);
// Set LiDAR data by default
sensorMsg.lidar_data = lidarData_;
}
this->sensorMsgPub_->publish(sensorMsg); // Publish it along.
}
catch (const std::exception &ex) {
RCLCPP_ERROR(this->get_logger(), "Camera callback failed: %s", ex.what());
}
}