调整打印信息
This commit is contained in:
parent
d5b01517a0
commit
d69cc29ec9
@ -133,11 +133,13 @@ private:
|
|||||||
|
|
||||||
if (!isCollecting)
|
if (!isCollecting)
|
||||||
{
|
{
|
||||||
cout << "等待采集...." << endl;
|
// cout << "等待采集...." << endl;
|
||||||
|
RCLCPP_INFO(this->get_logger(), "等待采集.....");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout << "平台采集中" << endl;
|
// cout << "平台采集中" << endl;
|
||||||
|
RCLCPP_INFO(this->get_logger(), "平台采集中.....");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void sub_callback(const sweeper_interfaces::msg::Sub::SharedPtr msg)
|
void sub_callback(const sweeper_interfaces::msg::Sub::SharedPtr msg)
|
||||||
@ -146,21 +148,25 @@ private:
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(collect_mutex); // 加锁
|
std::lock_guard<std::mutex> lock(collect_mutex); // 加锁
|
||||||
isCollecting = true;
|
isCollecting = true;
|
||||||
cout << "平台开始采集" << endl;
|
// cout << "平台开始采集" << endl;
|
||||||
|
RCLCPP_INFO(this->get_logger(), "平台开始采集");
|
||||||
pthread_create(&route_thread_t, NULL, route_thread, NULL);
|
pthread_create(&route_thread_t, NULL, route_thread, NULL);
|
||||||
}
|
}
|
||||||
else if (!msg->get_route && isCollecting)
|
else if (!msg->get_route && isCollecting)
|
||||||
{
|
{
|
||||||
isCollecting = false;
|
isCollecting = false;
|
||||||
cout << "平台结束采集" << endl;
|
// cout << "平台结束采集" << endl;
|
||||||
|
RCLCPP_INFO(this->get_logger(), "平台结束采集");
|
||||||
pthread_cancel(route_thread_t);
|
pthread_cancel(route_thread_t);
|
||||||
if (upload_file(filename))
|
if (upload_file(filename))
|
||||||
{
|
{
|
||||||
cout << "上传成功" << endl;
|
// cout << "上传成功" << endl;
|
||||||
|
RCLCPP_INFO(this->get_logger(), "上传成功");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout << "上传失败" << endl;
|
// cout << "上传失败" << endl;
|
||||||
|
RCLCPP_INFO(this->get_logger(), "上传失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,8 +179,8 @@ void *mqtt_pub_gps(void *arg)
|
|||||||
&token_d_m);
|
&token_d_m);
|
||||||
if (rc == MQTTCLIENT_SUCCESS)
|
if (rc == MQTTCLIENT_SUCCESS)
|
||||||
{
|
{
|
||||||
std::cout << "[MQTT] Published to topic: " << g_conf.pub_gps_topic
|
// std::cout << "[MQTT] Published to topic: " << g_conf.pub_gps_topic
|
||||||
<< "\n msg: " << json_string << std::endl;
|
// << "\n msg: " << json_string << std::endl;
|
||||||
MQTTClient_waitForCompletion(client, token_d_m, g_conf.timeout_ms);
|
MQTTClient_waitForCompletion(client, token_d_m, g_conf.timeout_ms);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user