调整打印信息

This commit is contained in:
lyq 2026-01-12 11:24:27 +08:00
parent d5b01517a0
commit d69cc29ec9
2 changed files with 14 additions and 8 deletions

View File

@ -133,11 +133,13 @@ private:
if (!isCollecting)
{
cout << "等待采集...." << endl;
// cout << "等待采集...." << endl;
RCLCPP_INFO(this->get_logger(), "等待采集.....");
}
else
{
cout << "平台采集中" << endl;
// cout << "平台采集中" << endl;
RCLCPP_INFO(this->get_logger(), "平台采集中.....");
}
}
void sub_callback(const sweeper_interfaces::msg::Sub::SharedPtr msg)
@ -146,21 +148,25 @@ private:
{
std::lock_guard<std::mutex> lock(collect_mutex); // 加锁
isCollecting = true;
cout << "平台开始采集" << endl;
// cout << "平台开始采集" << endl;
RCLCPP_INFO(this->get_logger(), "平台开始采集");
pthread_create(&route_thread_t, NULL, route_thread, NULL);
}
else if (!msg->get_route && isCollecting)
{
isCollecting = false;
cout << "平台结束采集" << endl;
// cout << "平台结束采集" << endl;
RCLCPP_INFO(this->get_logger(), "平台结束采集");
pthread_cancel(route_thread_t);
if (upload_file(filename))
{
cout << "上传成功" << endl;
// cout << "上传成功" << endl;
RCLCPP_INFO(this->get_logger(), "上传成功");
}
else
{
cout << "上传失败" << endl;
// cout << "上传失败" << endl;
RCLCPP_INFO(this->get_logger(), "上传失败");
}
}
}

View File

@ -179,8 +179,8 @@ void *mqtt_pub_gps(void *arg)
&token_d_m);
if (rc == MQTTCLIENT_SUCCESS)
{
std::cout << "[MQTT] Published to topic: " << g_conf.pub_gps_topic
<< "\n msg: " << json_string << std::endl;
// std::cout << "[MQTT] Published to topic: " << g_conf.pub_gps_topic
// << "\n msg: " << json_string << std::endl;
MQTTClient_waitForCompletion(client, token_d_m, g_conf.timeout_ms);
}
else