This commit is contained in:
Alvin-lyq 2026-04-29 10:20:55 +08:00
parent ed22f2575d
commit 97372f1d89

View File

@ -68,9 +68,9 @@ class RtkAsensingNode : public rclcpp::Node
read_count++;
// 打印读取的原始数据仅前20字节
if (read_count % 50 == 1) // 每50次打印一次避免刷屏
if (read_count % 100 == 1) // 每100次打印一次避免刷屏
{
LOG_DEBUG("[DEBUG] 串口读取 %d 字节:", num);
LOG_INFO("[DEBUG] 串口读取 %d 字节:", num);
int print_len = (num < 20) ? num : 20;
std::string hex_str;
for (int i = 0; i < print_len; i++)
@ -79,7 +79,7 @@ class RtkAsensingNode : public rclcpp::Node
snprintf(hex, sizeof(hex), "%02X ", (uint8_t)serial_buf[i]);
hex_str += hex;
}
LOG_DEBUG("[DEBUG] 前%d字节 HEX: %s", print_len, hex_str.c_str());
LOG_INFO("[DEBUG] 前%d字节 HEX: %s", print_len, hex_str.c_str());
}
// 将数据送入协议解析器
@ -88,16 +88,11 @@ class RtkAsensingNode : public rclcpp::Node
if (result == 1)
{
parse_count++;
LOG_DEBUG("[DEBUG] 解析成功! 累计解析帧数: %d", parse_count);
LOG_INFO("[DEBUG] 解析成功! 累计解析帧数: %d", parse_count);
// 成功解析一帧数据发布ROS消息
publishData();
publish_count++;
if (publish_count % 50 == 1)
{
LOG_DEBUG("[DEBUG] 累计发布次数: %d", publish_count);
}
}
}
catch (const std::exception& e)