openMSL / sl-1-2-reflection-based-lidar-object-model

SETLevel: OSI / FMI compliant radar or lidar sensor system model, depending on parametrization.
Mozilla Public License 2.0
15 stars 1 forks source link

Explain hardcoded values #12

Closed ClemensLinnhoff closed 1 year ago

ClemensLinnhoff commented 1 year ago

Reference to a related issue in the repository

11

Add a description

Take this checklist as orientation for yourself, if this PR is ready for Maintainer Review

github-actions[bot] commented 1 year ago

:scroll: Run clang-format on the following files


:speech_balloon: Output from clang-tidy

src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp
/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:124:22: warning: [readability-identifier-naming] > invalid case style for local variable 'signal_strength_in_dBm'

```cpp auto signal_strength_in_dBm = rendering_result.received_signal().signal_strength(); ^~~~~~~~~~~~~~~~~~~~~~ signal_strength_in_d_bm ```

/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:176:24: warning: [readability-function-cognitive-complexity] > function 'process_collected_beam_cells' has cognitive complexity of 52 (threshold 50)

```cpp void DetectionSensing::process_collected_beam_cells(LidarDetectionData* current_sensor, ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:187:15: note: nesting level increased to 1 [](const DetectionSensing::LidarBeamCellmW& first, const DetectionSensing::LidarBeamCellmW& second) { return first.dist_cell_idx < second.dist_cell_idx; }); ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:195:5: note: +1, including nesting penalty of 0, nesting level increased to 1 for (auto& lidar_cuboid_cell_of_beam : lidar_cuboid_cells_of_beam) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:197:9: note: +2, including nesting penalty of 1, nesting level increased to 2 if (lidar_cuboid_cell_of_beam.dist_cell_idx == summed_dist_cell_of_beam.dist_cell_idx) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:201:9: note: +1, nesting level increased to 2 else ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:210:5: note: +1, including nesting penalty of 0, nesting level increased to 1 if (!thresholded_summed_dist_cells.empty()) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:227:9: note: +2, including nesting penalty of 1, nesting level increased to 2 for (size_t thresholded_summed_dist_cell_dB_idx = 1; thresholded_summed_dist_cell_dB_idx < thresholded_summed_dist_cells.size(); thresholded_summed_dist_cell_dB_idx++) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:230:13: note: +3, including nesting penalty of 2, nesting level increased to 3 if ((float)thresholded_summed_dist_cells[thresholded_summed_dist_cell_dB_idx].dist_cell_idx > ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:236:17: note: +4, including nesting penalty of 3, nesting level increased to 4 if (no_of_peaks_in_beam > profile.detection_sensing_parameters.max_echos_per_beam) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:252:13: note: +1, nesting level increased to 3 else ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:258:17: note: +4, including nesting penalty of 3, nesting level increased to 4 if (thresholded_summed_dist_cells[thresholded_summed_dist_cell_dB_idx].signal_strength_in_dBm > peaks_in_beam[no_of_peaks_in_beam - 1].signal_strength_in_dBm) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:269:9: note: +2, including nesting penalty of 1, nesting level increased to 2 for (auto& current_peak : peaks_in_beam) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:275:13: note: +3, including nesting penalty of 2, nesting level increased to 3 if (profile.detection_sensing_parameters.echo_determination_mode == "peak") ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:279:13: note: +1, nesting level increased to 3 else ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:287:13: note: +3, including nesting penalty of 2, nesting level increased to 3 if ((profile.vertical_angle_clamping != "center") && (profile.beam_step_elevation > 0)) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:287:63: note: +1 if ((profile.vertical_angle_clamping != "center") && (profile.beam_step_elevation > 0)) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:289:17: note: +4, including nesting penalty of 3, nesting level increased to 4 if (profile.vertical_angle_clamping == "max_abs") ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:294:22: note: +1, nesting level increased to 4 else if (profile.vertical_angle_clamping == "top") ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:298:22: note: +1, nesting level increased to 4 else if (profile.vertical_angle_clamping == "bottom") ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:305:13: note: +3, including nesting penalty of 2, nesting level increased to 3 if (profile.detection_sensing_parameters.distance_stddev > 0.0) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:321:13: note: +3, including nesting penalty of 2, nesting level increased to 3 if (profile.detection_sensing_parameters.intensity_or_epw == 0) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:324:17: note: +4, including nesting penalty of 3, nesting level increased to 4 if (profile.detection_sensing_parameters.range_compensate_intensity) ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:335:17: note: +1, nesting level increased to 4 else ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:358:13: note: +1, nesting level increased to 3 else ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:373:17: note: +4, including nesting penalty of 3, nesting level increased to 4 while ((count < signal_strength_to_epw.size() - 1) && ^ /home/runner/work/sl-1-2-reflection-based-lidar-object-model/sl-1-2-reflection-based-lidar-object-model/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:373:68: note: +1 while ((count < signal_strength_to_epw.size() - 1) && ^ ```

/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:227:21: warning: [readability-identifier-naming] > invalid case style for local variable 'thresholded_summed_dist_cell_dB_idx'

```cpp for (size_t thresholded_summed_dist_cell_dB_idx = 1; thresholded_summed_dist_cell_dB_idx < thresholded_summed_dist_cells.size(); thresholded_summed_dist_cell_dB_idx++) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ thresholded_summed_dist_cell_d_b_idx thresholded_summed_dist_cell_d_b_idx thresholded_summed_dist_cell_d_b_idx ```

/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:326:28: warning: [readability-identifier-naming] > invalid case style for local variable 'signal_strength_in_mW'

```cpp double signal_strength_in_mW = pow(10, current_peak.signal_strength_in_dBm / 10); ^~~~~~~~~~~~~~~~~~~~~ signal_strength_in_m_w ```

/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:327:28: warning: [readability-identifier-naming] > invalid case style for local variable 'signal_strength_in_mW_range_compensated'

```cpp double signal_strength_in_mW_range_compensated = signal_strength_in_mW * (pow(detection->position().distance(), 2)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ signal_strength_in_m_w_range_compensated ```

/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:329:28: warning: [readability-identifier-naming] > invalid case style for local variable 'emitted_signal_strength_mW'

```cpp double emitted_signal_strength_mW = pow(10.0, profile.max_emitted_signal_strength_in_dBm / 10.0); ^~~~~~~~~~~~~~~~~~~~~~~~~~ emitted_signal_strength_m_w ```

/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:393:10: warning: [readability-identifier-naming] > invalid case style for local variable 'summed_signal_strength_in_dBm'

```cpp auto summed_signal_strength_in_dBm = 10 * std::log10(summed_dist_cell_of_beam_ptr->signal_strength_in_mW); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ summed_signal_strength_in_d_bm ```

/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:401:20: warning: [readability-identifier-naming] > invalid case style for local variable 'threshold_mW'

```cpp double threshold_mW = pow(10.0, threshold / 10.0) * pow(thres_distance_m, 2) / pow(range, 2); ^~~~~~~~~~~~ threshold_m_w ```

/src/model/strategies/lidar-detection-sensing-strategy/src/DetectionSensing.cpp:408:26: warning: [readability-identifier-naming] > invalid case style for local variable 'thresholded_summed_dist_cell_dBm'

```cpp LidarBeamCelldBm thresholded_summed_dist_cell_dBm; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ thresholded_summed_dist_cell_d_bm ```


src/model/strategies/lidar-environmental-effects-strategy/src/DetectionEnvironmentalEffects.cpp
/src/model/strategies/lidar-environmental-effects-strategy/src/DetectionEnvironmentalEffects.cpp:337:26: warning: [readability-identifier-naming] > invalid case style for local constant 'Gamma'

```cpp const double Gamma = existing_detection.intensity() / 100.0 * 255.0 / 100.0; //todo: calibrated to intensity values of Velodyne sensor. Change for other lidar types. ^~~~~ gamma ```

/src/model/strategies/lidar-environmental-effects-strategy/src/DetectionEnvironmentalEffects.cpp:747:20: warning: [readability-identifier-naming] > invalid case style for local variable 'emitted_signal_strength_mW'

```cpp double emitted_signal_strength_mW = pow(10.0, profile.max_emitted_signal_strength_in_dBm / 10.0); ^~~~~~~~~~~~~~~~~~~~~~~~~~ emitted_signal_strength_m_w ```

/src/model/strategies/lidar-environmental-effects-strategy/src/DetectionEnvironmentalEffects.cpp:749:20: warning: [readability-identifier-naming] > invalid case style for local variable 'attenuated_power_mW'

```cpp double attenuated_power_mW = ^~~~~~~~~~~~~~~~~~~ attenuated_power_m_w ```

/src/model/strategies/lidar-environmental-effects-strategy/src/DetectionEnvironmentalEffects.cpp:754:20: warning: [readability-identifier-naming] > invalid case style for local variable 'attenuated_power_noise_mW'

```cpp double attenuated_power_noise_mW = noise_distribution(generator); ^~~~~~~~~~~~~~~~~~~~~~~~~ attenuated_power_noise_m_w ```

/src/model/strategies/lidar-environmental-effects-strategy/src/DetectionEnvironmentalEffects.cpp:755:20: warning: [readability-identifier-naming] > invalid case style for local variable 'attenuated_power_dBm'

```cpp double attenuated_power_dBm = 10 * log10(attenuated_power_noise_mW); ^~~~~~~~~~~~~~~~~~~~ attenuated_power_d_bm ```

/src/model/strategies/lidar-environmental-effects-strategy/src/DetectionEnvironmentalEffects.cpp:762:28: warning: [readability-identifier-naming] > invalid case style for local variable 'threshold_mW'

```cpp double threshold_mW = pow(10.0, threshold / 10.0) * pow(profile.detection_sensing_parameters.thres_distance_m, 2) / pow(range, 2); ^~~~~~~~~~~~ threshold_m_w ```