From 2297e66a9d4417b3ff27e3165650f99acd2a4bf7 Mon Sep 17 00:00:00 2001 From: Erkki Eilonen Date: Sun, 12 Oct 2025 19:36:25 +0300 Subject: [PATCH] gazebo: fix implicit conversion errors ([-Wdouble-promotion]) --- src/modules/simulation/gz_bridge/GZGimbal.cpp | 2 +- src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp | 4 ++-- .../moving_platform_controller/MovingPlatformController.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/simulation/gz_bridge/GZGimbal.cpp b/src/modules/simulation/gz_bridge/GZGimbal.cpp index 4fbccc316f..da017f28a0 100644 --- a/src/modules/simulation/gz_bridge/GZGimbal.cpp +++ b/src/modules/simulation/gz_bridge/GZGimbal.cpp @@ -228,7 +228,7 @@ void GZGimbal::publishDeviceAttitude() void GZGimbal::publishJointCommand(gz::transport::Node::Publisher &publisher, const float att_stp, const float rate_stp, float &last_stp, const float min_stp, const float max_stp, const float dt) { - gz::msgs::Double msg; + gz::msgs::Float msg; float new_stp = computeJointSetpoint(att_stp, rate_stp, last_stp, dt); new_stp = math::constrain(new_stp, min_stp, max_stp); diff --git a/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp b/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp index ae53bb637a..38c1c1dfde 100644 --- a/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp +++ b/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp @@ -117,8 +117,8 @@ bool GZMixingInterfaceServo::init(const std::string &model_name) return false; } - double min_val = get_servo_angle_min(i); - double max_val = get_servo_angle_max(i); + double min_val = (double)get_servo_angle_min(i); + double max_val = (double)get_servo_angle_max(i); _angle_min_rad.push_back(min_val); _angular_range_rad.push_back(max_val - min_val); } diff --git a/src/modules/simulation/gz_plugins/moving_platform_controller/MovingPlatformController.cpp b/src/modules/simulation/gz_plugins/moving_platform_controller/MovingPlatformController.cpp index f8f1ab26e2..80568aaf84 100644 --- a/src/modules/simulation/gz_plugins/moving_platform_controller/MovingPlatformController.cpp +++ b/src/modules/simulation/gz_plugins/moving_platform_controller/MovingPlatformController.cpp @@ -240,7 +240,7 @@ void MovingPlatformController::updateWrenchCommand( if (accel_xy > max_accel) { const float scaling = max_accel / accel_xy; - _force += feedback_force * gz::math::Vector3d(scaling, scaling, 1.); + _force += feedback_force * gz::math::Vector3d((double)scaling, (double)scaling, 1.); } else { _force += feedback_force;