Skip to content

Commit 8eb94d7

Browse files
committed
reformat code
1 parent 52bd236 commit 8eb94d7

File tree

3 files changed

+1
-11
lines changed

3 files changed

+1
-11
lines changed

infinite_sense_core/src/messenger.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Messenger::Messenger() {
66
context_.close();
77
context_ = zmq::context_t(1);
88
publisher_ = zmq::socket_t(context_, ZMQ_PUB);
9-
// 关闭时不等待未发送消息
109
publisher_.set(zmq::sockopt::linger, 0);
1110
publisher_.set(zmq::sockopt::rcvtimeo, 1000);
1211
try {
@@ -48,14 +47,11 @@ void Messenger::PubStruct(const std::string &topic, const void *data, const size
4847
}
4948
std::string Messenger::GetPubEndpoint() const { return endpoint_; }
5049

51-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5250

53-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5451
std::unordered_set<std::string> TopicMonitor::GetTopics() const {
5552
std::lock_guard lock(topics_mutex_);
56-
return topics_; // 返回副本保证线程安全
53+
return topics_;
5754
}
58-
// 启动监控线程
5955
void TopicMonitor::Start() {
6056
if (monitor_thread_.joinable()) {
6157
return;
@@ -64,7 +60,6 @@ void TopicMonitor::Start() {
6460
monitor_thread_ = std::thread(&TopicMonitor::MonitorLoop, this);
6561
}
6662

67-
// 停止监控
6863
void TopicMonitor::Stop() {
6964
if (!should_run_.load()) {
7065
return;
@@ -92,7 +87,6 @@ TopicMonitor::~TopicMonitor() {
9287
LOG(ERROR) << "[TopicMonitor] Cleanup error: " << e.what();
9388
}
9489
}
95-
// 监控线程主循环
9690
void TopicMonitor::MonitorLoop() {
9791
zmq::message_t msg;
9892

@@ -104,7 +98,6 @@ void TopicMonitor::MonitorLoop() {
10498
std::lock_guard lock(topics_mutex_);
10599
topic_frequencies_[topic]++;
106100
}
107-
// 如果是多部分消息,跳过数据部分
108101
if (subscriber_.get(zmq::sockopt::rcvmore)) {
109102
zmq::message_t dummy;
110103
subscriber_.recv(dummy);

infinite_sense_core/src/net.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ void NetManager::Receive() const {
5656
if (json_data.empty()) {
5757
continue;
5858
}
59-
// LOG(INFO) << json_data.dump();
6059
ptp_->ReceivePtpData(json_data);
6160
ProcessTriggerData(json_data);
6261
ProcessIMUData(json_data);

infinite_sense_core/src/ptp.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ void Ptp::ReceivePtpData(const nlohmann::json &data) {
2323
std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch())
2424
.count();
2525
if (updated_t1_t2_) {
26-
// 发送时间偏差到从设备
2726
int64_t delay = static_cast<int64_t>(t4 - t3 + time_t2_ - time_t1_) / 2;
2827
int64_t offset = static_cast<int64_t>(time_t2_ - time_t1_ - t4 + t3) / 2;
2928
const nlohmann::json jsons = {
@@ -39,7 +38,6 @@ void Ptp::ReceivePtpData(const nlohmann::json &data) {
3938
serial_ptr_->write(reinterpret_cast<uint8_t *>(out.data()), out.size());
4039
updated_t1_t2_ = false;
4140
}
42-
// std::cout << "delay: " << delay << " offset: " << offset << std::endl;
4341
}
4442
}
4543
}

0 commit comments

Comments
 (0)