Response.End引发异常

本文为一个简单的新浪博客转载示例,原始内容链接指向了新浪博客平台上的一个具体博客文章,并且同时给出了另一个来源链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

cartographer_ros_msgs::StatusResponse Node::FinishTrajectoryUnderLock( const int trajectory_id) { cartographer_ros_msgs::StatusResponse status_response; if (trajectories_scheduled_for_finish_.count(trajectory_id)) { status_response.message = absl::StrCat("Trajectory ", trajectory_id, " already pending to finish."); status_response.code = cartographer_ros_msgs::StatusCode::OK; LOG(INFO) << status_response.message; return status_response; } // First, check if we can actually finish the trajectory. status_response = TrajectoryStateToStatus( trajectory_id, {TrajectoryState::ACTIVE} /* valid states */); if (status_response.code != cartographer_ros_msgs::StatusCode::OK) { LOG(ERROR) << "Can't finish trajectory: " << status_response.message; return status_response; } // Shutdown the subscribers of this trajectory. // A valid case with no subscribers is e.g. if we just visualize states. if (0) { if (subscribers_.count(trajectory_id)) { for (auto& entry : subscribers_[trajectory_id]) { entry.subscriber.shutdown(); subscribed_topics_.erase(entry.topic); LOG(INFO) << "Shutdown the subscriber of [" << entry.topic << "]"; } CHECK_EQ(subscribers_.erase(trajectory_id), 1); } } else { // for debug if (subscribers_.count(trajectory_id)) { for (auto& entry : subscribers_[trajectory_id]) { try { LOG(INFO) << "Attempting to shutdown subscriber of [" << entry.topic << "]"; entry.subscriber.shutdown(); LOG(INFO) << "Successfully shutdown subscriber of [" << entry.topic << "]"; } catch (const std::exception& e) { LOG(ERROR) << "Error shutting down subscriber of [" << entry.topic << "]: " << e.what(); } try { LOG(INFO) << "Attempting to erase topic [" << entry.topic << "] from subscribed_topics_"; auto it = subscribed_topics_.find(entry.topic); if (it != subscribed_topics_.end()) { subscribed_topics_.erase(it); LOG(INFO) << "Successfully erased topic [" << entry.topic << "] from subscribed_topics_"; } else { LOG(WARNING) << "Topic [" << entry.topic << "] not found in subscribed_topics_"; } } catch (const std::exception& e) { LOG(ERROR) << "Error erasing topic [" << entry.topic << "] from subscribed_topics_: " << e.what(); } } CHECK_EQ(subscribers_.erase(trajectory_id), 1); } } map_builder_bridge_.FinishTrajectory(trajectory_id); trajectories_scheduled_for_finish_.emplace(trajectory_id); status_response.message = absl::StrCat("Finished trajectory ", trajectory_id, "."); status_response.code = cartographer_ros_msgs::StatusCode::OK; return status_response; }这个函数在shutdown这里卡死了 详细总结一下有哪些原因完成 并且如何解决
最新发布
03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值