Skip to content

Commit

Permalink
fix: bugprone-incorrect-roundings
Browse files Browse the repository at this point in the history
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
  • Loading branch information
kobayu858 committed Nov 8, 2024
1 parent 214373a commit 96e2987
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <rosbag2_cpp/reader.hpp>
#include <rosbag2_cpp/writers/sequential_writer.hpp>

#include <cmath>
#include <regex>

namespace nebula::ros
Expand Down Expand Up @@ -175,8 +176,10 @@ Status VelodyneRosOfflineExtractBag::get_parameters(
} else {
double min_angle = fmod(fmod(view_direction + view_width / 2, 2 * M_PI) + 2 * M_PI, 2 * M_PI);
double max_angle = fmod(fmod(view_direction - view_width / 2, 2 * M_PI) + 2 * M_PI, 2 * M_PI);
sensor_configuration.cloud_min_angle = 100 * (2 * M_PI - min_angle) * 180 / M_PI + 0.5;
sensor_configuration.cloud_max_angle = 100 * (2 * M_PI - max_angle) * 180 / M_PI + 0.5;
sensor_configuration.cloud_min_angle =
static_cast<int>(std::lround(100 * (2 * M_PI - min_angle) * 180 / M_PI));
sensor_configuration.cloud_max_angle =
static_cast<int>(std::lround(100 * (2 * M_PI - max_angle) * 180 / M_PI));
if (sensor_configuration.cloud_min_angle == sensor_configuration.cloud_max_angle) {
// avoid returning empty cloud if min_angle = max_angle
sensor_configuration.cloud_min_angle = 0;
Expand Down

0 comments on commit 96e2987

Please sign in to comment.