This commit is contained in:
lyq 2026-01-29 17:06:08 +08:00
parent 02f0b42d36
commit d7ae466462
7 changed files with 7100 additions and 247 deletions

File diff suppressed because it is too large Load Diff

View File

View File

@ -0,0 +1,8 @@
32.0308500220
120.91511424200
0.000000
0.000000
0.0000000000
0.00000000000
0.000000
0.000000

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
32.0937184760
120.79454789700
84.724998
0.000000

File diff suppressed because it is too large Load Diff

View File

@ -97,7 +97,7 @@ class SBUSNode : public rclcpp::Node
}
// 油门 / 刹车逻辑
if (speed < 0)
if (speed <= 0)
{
msg.brake = 1;
msg.rpm = 0;
@ -138,33 +138,34 @@ class SBUSNode : public rclcpp::Node
// 发布控制消息
pub_->publish(msg);
// 降低打印频率:每 PRINT_INTERVAL 次回调打印一次
// if (++print_counter >= PRINT_INTERVAL)
// {
// LOG_INFO("\n=====================================")
// << "\n 刹车: " << (msg.brake ? "已刹车" : "未刹车")
// << "\n 挡位: ";
// switch (msg.gear)
// {
// case 0:
// LOG_INFO("空挡");
// break;
// case 2:
// LOG_INFO("前进挡");
// break;
// case 1:
// LOG_INFO("后退挡");
// break;
// default:
// LOG_INFO("未知挡位(%d)", static_cast<int>(msg.gear));
// break;
// }
// LOG_INFO("\n 行走电机转速: %d RPM", static_cast<int>(msg.rpm));
// << "\n 轮端转向角度: " << msg.angle << "°"
// << "\n 清扫状态: " << (msg.sweep ? "正在清扫" : "未清扫")
// << "\n=====================================" << std::endl;
// print_counter = 0; // 重置计数器
// }
if (++print_counter >= PRINT_INTERVAL)
{
LOG_INFO(
"=====================================\n"
" 刹车: %s\n"
" 挡位: %s\n"
" 行走电机转速: %d RPM\n"
" 轮端转向角度: %.1f °\n"
" 清扫状态: %s\n"
"=====================================",
msg.brake ? "已刹车" : "未刹车",
[&]()
{
switch (msg.gear)
{
case 0:
return "空挡";
case 1:
return "后退挡";
case 2:
return "前进挡";
default:
return "未知挡位";
}
}(),
static_cast<int>(msg.rpm), msg.angle, msg.sweep ? "正在清扫" : "未清扫");
print_counter = 0; // 重置计数器
}
}
else
{