From 83cbd55c0072801e73bd692e31809a52f8d3a269 Mon Sep 17 00:00:00 2001 From: lyq Date: Tue, 4 Nov 2025 16:09:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=80=9F=E5=BA=A6=E5=92=8C?= =?UTF-8?q?=E6=A1=A3=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fu/src/fu_node.cpp | 20 +++++++++++--------- src/radio_ctrl/config/config.json | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/fu/src/fu_node.cpp b/src/fu/src/fu_node.cpp index 75d514f..e6012e6 100644 --- a/src/fu/src/fu_node.cpp +++ b/src/fu/src/fu_node.cpp @@ -256,8 +256,8 @@ private: int reliability = 0; // RTK信号质量 1行 0不行 // 发布消息的参数 - int publish_speed = 0; // 转速占空比 0-100 - int publish_angle = 0; // [-66.0,66.0],负数表示左转,正数表示右转 + int publish_speed = 0; // 转速占空比 0-1500 + int publish_angle = 0; // [-40.0,40.0],负数表示左转,正数表示右转 // 车体矩形边界(栅格坐标) int vehicle_min_x_; // 车体最小行坐标(顶部) @@ -790,7 +790,9 @@ private: // 发布控制指令 sweeper_interfaces::msg::McCtrl message; - message.sweep = true; + message.sweep = false; + message.brake = 1; // 0开;1关 + message.gear = 2; // 0空挡;1后退;2前进 if (reliability == 1) message.rpm = publish_speed; @@ -849,7 +851,7 @@ private: float target_angle = calculate_the_angle(x, y); // 初始化控制参数 - publish_speed = 30; + publish_speed = 800; publish_angle = static_cast(target_angle); // 安全检查:未检测到车体位置 @@ -986,7 +988,7 @@ private: else { // 距离足够,可以减速接近 - publish_speed = std::max(10, publish_speed / 2); + publish_speed = std::max(600, publish_speed / 2); RCLCPP_INFO(this->get_logger(), "障碍物较宽,减速接近中,距离=%d格", obstacle_analysis_.obstacle_distance); } @@ -1203,7 +1205,7 @@ private: } // 速度控制:横向偏移时限速 - publish_speed = 15; + publish_speed = 600; // 角度控制:保持较大角度进行横向偏移 int shift_angle = calculateLateralShiftAngle(); @@ -1482,7 +1484,7 @@ private: } // 速度控制:平行前进时可以适当提速 - publish_speed = 20; + publish_speed = 700; // 角度控制:回正,保持直行 publish_angle = 0; @@ -1625,7 +1627,7 @@ private: { // 回正完成 publish_angle = target_angle_int; - publish_speed = speed; + publish_speed = 800; avoid_ctx_.reset(); RCLCPP_INFO(this->get_logger(), @@ -1644,7 +1646,7 @@ private: publish_angle -= std::min(RETURN_RATE, -angle_diff); } - publish_speed = 20; // 回正时保持低速 + publish_speed = 700; // 回正时保持低速 if (avoid_ctx_.counter % 10 == 0) { diff --git a/src/radio_ctrl/config/config.json b/src/radio_ctrl/config/config.json index 1111955..dd49777 100644 --- a/src/radio_ctrl/config/config.json +++ b/src/radio_ctrl/config/config.json @@ -2,7 +2,7 @@ "serial_port": "/dev/uartPort", "baudrate": 100000, "rmoctl_para": { - "mcu_rpm_max": 3000, + "mcu_rpm_max": 1500, "eps_angle_max": 40.0 } } \ No newline at end of file