Skip to content

Commit

Permalink
[PerceptionModuleRosSyncBase] reinit function to change topics
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthou committed Sep 20, 2024
1 parent 184c246 commit ad44f34
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/overworld/Perception/Modules/PerceptionModuleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,19 @@ namespace owds {
{}
virtual ~PerceptionModuleRosSyncBase() = default;

void reinitialize(const std::string& first_topic_name,
const std::string& second_topic_name)
{
first_topic_name_ = first_topic_name;
second_topic_name_ = second_topic_name;

sub_0_.subscribe(*(this->n_), first_topic_name_, 1);
sub_1_.subscribe(*(this->n_), second_topic_name_, 1);
sync_.reset(new Sync(SyncPolicy(10), sub_0_, sub_1_));
sync_->registerCallback(&PerceptionModuleRosSyncBase::privatePerceptionCallback, this);
ShellDisplay::info("[" + this->module_name_ + "] subscribed to " + first_topic_name_ + " and " + second_topic_name_);
}

virtual void initialize(const std::string& module_name,
ros::NodeHandle* n,
BulletClient* bullet_client,
Expand Down

0 comments on commit ad44f34

Please sign in to comment.