Align MKMini Gazebo steering and world scale

This commit is contained in:
2026-08-19 09:53:09 +09:00
parent eb52af430b
commit 14580aaa88
2 changed files with 16 additions and 5 deletions
@@ -44,7 +44,18 @@ public:
"/cmd_vel", rclcpp::QoS(10),
[this](const geometry_msgs::msg::Twist::SharedPtr message) {
std::lock_guard<std::mutex> lock(mutex_);
target_angle_ = std::clamp(message->angular.z, -0.5, 0.5);
// Twist.angular.z is yaw rate, not steering angle. Convert it using
// the signed vehicle speed so reverse Reeds-Shepp segments keep the
// same physical curvature as their planned path.
if (std::abs(message->linear.x) >= 0.01) {
target_angle_ = std::clamp(
std::atan(wheelbase_ * message->angular.z / message->linear.x),
-0.5,
0.5);
} else {
// Preserve the direct angle fallback used by manual J/L steering.
target_angle_ = std::clamp(message->angular.z, -0.5, 0.5);
}
has_target_ = true;
});
update_connection_ = gazebo::event::Events::ConnectWorldUpdateBegin(