Skip to content

Commit

Permalink
Fix TopicInfo deprecation warnings in Harmonic (#1922)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <ichen@openrobotics.org>
  • Loading branch information
iche033 authored Mar 10, 2023
1 parent cf07b19 commit d839caf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/SimulationRunner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@ bool SimulationRunner::Run(const uint64_t _iterations)
{
// Check for the existence of other publishers on `/stats`
std::vector<transport::MessagePublisher> publishers;
this->node->TopicInfo("/stats", publishers);
std::vector<transport::MessagePublisher> subscribers;
this->node->TopicInfo("/stats", publishers, subscribers);

if (!publishers.empty())
{
Expand Down Expand Up @@ -707,7 +708,8 @@ bool SimulationRunner::Run(const uint64_t _iterations)
{
// Check for the existence of other publishers on `/clock`
std::vector<transport::MessagePublisher> publishers;
this->node->TopicInfo("/clock", publishers);
std::vector<transport::MessagePublisher> subscribers;
this->node->TopicInfo("/clock", publishers, subscribers);

if (!publishers.empty())
{
Expand Down
3 changes: 2 additions & 1 deletion src/gui/plugins/visualize_lidar/VisualizeLidar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ void VisualizeLidar::OnRefresh()
for (auto topic : allTopics)
{
std::vector<transport::MessagePublisher> publishers;
this->dataPtr->node.TopicInfo(topic, publishers);
std::vector<transport::MessagePublisher> subscribers;
this->dataPtr->node.TopicInfo(topic, publishers, subscribers);
for (auto pub : publishers)
{
if (pub.MsgTypeName() == "gz.msgs.LaserScan")
Expand Down
6 changes: 4 additions & 2 deletions test/integration/sensors_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,15 @@ void testDefaultTopics()
};

std::vector<transport::MessagePublisher> publishers;
std::vector<transport::MessagePublisher> subscribers;
transport::Node node;

// Sensors are created in a separate thread, so we sleep here to give them
// time
int sleep{0};
int maxSleep{30};
for (; sleep < maxSleep && !node.TopicInfo(topics.front(), publishers);
for (; sleep < maxSleep &&
!node.TopicInfo(topics.front(), publishers, subscribers);
++sleep)
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
Expand All @@ -148,7 +150,7 @@ void testDefaultTopics()

for (const std::string &topic : topics)
{
bool result = node.TopicInfo(topic, publishers);
bool result = node.TopicInfo(topic, publishers, subscribers);

EXPECT_TRUE(result) << "Could not get topic info for " << topic;
EXPECT_EQ(1u, publishers.size());
Expand Down

0 comments on commit d839caf

Please sign in to comment.