debug-2
This commit is contained in:
parent
ed22f2575d
commit
97372f1d89
@ -68,9 +68,9 @@ class RtkAsensingNode : public rclcpp::Node
|
|||||||
read_count++;
|
read_count++;
|
||||||
|
|
||||||
// 打印读取的原始数据(仅前20字节)
|
// 打印读取的原始数据(仅前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;
|
int print_len = (num < 20) ? num : 20;
|
||||||
std::string hex_str;
|
std::string hex_str;
|
||||||
for (int i = 0; i < print_len; i++)
|
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]);
|
snprintf(hex, sizeof(hex), "%02X ", (uint8_t)serial_buf[i]);
|
||||||
hex_str += hex;
|
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)
|
if (result == 1)
|
||||||
{
|
{
|
||||||
parse_count++;
|
parse_count++;
|
||||||
LOG_DEBUG("[DEBUG] 解析成功! 累计解析帧数: %d", parse_count);
|
LOG_INFO("[DEBUG] 解析成功! 累计解析帧数: %d", parse_count);
|
||||||
|
|
||||||
// 成功解析一帧数据,发布ROS消息
|
// 成功解析一帧数据,发布ROS消息
|
||||||
publishData();
|
publishData();
|
||||||
publish_count++;
|
publish_count++;
|
||||||
|
|
||||||
if (publish_count % 50 == 1)
|
|
||||||
{
|
|
||||||
LOG_DEBUG("[DEBUG] 累计发布次数: %d", publish_count);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user