Skip to content

Recorder discovery does not restart after being stopped #1893

@oysstu

Description

@oysstu

The discovery is currently not restarted properly in record() when previously stopped through stop(). This implies that no new topics are subscribed to on subsequent calls to resume and no topics at all when simulation time is used due to how these topics are initialized.

The cause is the following comparison, which needs to be inverted:

void RecorderImpl::start_discovery()
{
std::lock_guard<std::mutex> state_lock(discovery_mutex_);
if (stop_discovery_.exchange(false)) {
RCLCPP_DEBUG(node->get_logger(), "Recorder topic discovery is already running.");
} else {
discovery_future_ =
std::async(std::launch::async, std::bind(&RecorderImpl::topics_discovery, this));
}
}

The stop_discovery_ atomic should then also be initialized to true in order for the first start_discovery call to succeed.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions