调整一些打印
This commit is contained in:
parent
9e7ae8f7fd
commit
e798a7c15f
@ -214,10 +214,10 @@ void PL_ProcThread()
|
|||||||
des_pos = Road_Planning_Find_Aim_Point(road_pos, 3); // 找到当前点后第 3 个点,作为目标点
|
des_pos = Road_Planning_Find_Aim_Point(road_pos, 3); // 找到当前点后第 3 个点,作为目标点
|
||||||
direction_pos = Road_Planning_Find_Aim_Point(road_pos, 6); // 找到当前点后第 6 个点,判断直行/转弯
|
direction_pos = Road_Planning_Find_Aim_Point(road_pos, 6); // 找到当前点后第 6 个点,判断直行/转弯
|
||||||
|
|
||||||
printf("当前位置: %d\n", road_pos);
|
// printf("当前位置: %d\n", road_pos);
|
||||||
printf("目标位置: %d\n", des_pos);
|
// printf("目标位置: %d\n", des_pos);
|
||||||
// printf("direction_pos: %d\n", direction_pos);
|
// printf("direction_pos: %d\n", direction_pos);
|
||||||
printf("\n");
|
// printf("\n");
|
||||||
|
|
||||||
drive_mode = straight_or_turn(g_rtk.direction, GPSPointQueue[direction_pos].Heading, 12);
|
drive_mode = straight_or_turn(g_rtk.direction, GPSPointQueue[direction_pos].Heading, 12);
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ static int sock = -1;
|
|||||||
// 新增:全局变量记录最后接收RTK数据的时间戳
|
// 新增:全局变量记录最后接收RTK数据的时间戳
|
||||||
system_clock::time_point last_rtk_time;
|
system_clock::time_point last_rtk_time;
|
||||||
// 新增:超时阈值(0.5秒)
|
// 新增:超时阈值(0.5秒)
|
||||||
const duration<double> rtk_timeout = duration<double>(0.2);
|
const duration<double> rtk_timeout = duration<double>(0.5);
|
||||||
|
|
||||||
class pl_node : public rclcpp::Node
|
class pl_node : public rclcpp::Node
|
||||||
{
|
{
|
||||||
|
|||||||
@ -142,32 +142,32 @@ private:
|
|||||||
pub_->publish(msg);
|
pub_->publish(msg);
|
||||||
|
|
||||||
// 降低打印频率:每 PRINT_INTERVAL 次回调打印一次
|
// 降低打印频率:每 PRINT_INTERVAL 次回调打印一次
|
||||||
if (++print_counter >= PRINT_INTERVAL)
|
// if (++print_counter >= PRINT_INTERVAL)
|
||||||
{
|
// {
|
||||||
std::cout << "\n====================================="
|
// std::cout << "\n====================================="
|
||||||
<< "\n 刹车: " << (msg.brake ? "已刹车" : "未刹车")
|
// << "\n 刹车: " << (msg.brake ? "已刹车" : "未刹车")
|
||||||
<< "\n 挡位: ";
|
// << "\n 挡位: ";
|
||||||
switch (msg.gear)
|
// switch (msg.gear)
|
||||||
{
|
// {
|
||||||
case 0:
|
// case 0:
|
||||||
std::cout << "空挡";
|
// std::cout << "空挡";
|
||||||
break;
|
// break;
|
||||||
case 2:
|
// case 2:
|
||||||
std::cout << "前进挡";
|
// std::cout << "前进挡";
|
||||||
break;
|
// break;
|
||||||
case 1:
|
// case 1:
|
||||||
std::cout << "后退挡";
|
// std::cout << "后退挡";
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
std::cout << "未知挡位(" << static_cast<int>(msg.gear) << ")";
|
// std::cout << "未知挡位(" << static_cast<int>(msg.gear) << ")";
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
std::cout << "\n 行走电机转速: " << static_cast<int>(msg.rpm) << " RPM"
|
// std::cout << "\n 行走电机转速: " << static_cast<int>(msg.rpm) << " RPM"
|
||||||
<< "\n 轮端转向角度: " << msg.angle << "°"
|
// << "\n 轮端转向角度: " << msg.angle << "°"
|
||||||
<< "\n 清扫状态: " << (msg.sweep ? "正在清扫" : "未清扫")
|
// << "\n 清扫状态: " << (msg.sweep ? "正在清扫" : "未清扫")
|
||||||
<< "\n=====================================" << std::endl;
|
// << "\n=====================================" << std::endl;
|
||||||
print_counter = 0; // 重置计数器
|
// print_counter = 0; // 重置计数器
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user