3.7 Topics Quiz combines publisher and subscriber in single node?

I got asked:

  1. Create a Publisher that writes into the /cmd_vel Topic to move the robot.
  2. Create a Subscriber that reads from the /scan Topic. This is the Topic where the laser publishes its data.

now I have two package one for running the Publisher and the subscriber, one reads the scan and create the commands, and the send the move robot commands.

Later I got asked to have topics_quiz package with one node which do not fit what it was asked at the beginning

It is possible to have the a Publisher and a Subscriber in one single node. You have been asked to create separate nodes for these in previous exercises, so the challenge here is to integrate what you have learned earlier into a single node.

You just need to structure your code such that the publisher published to /cmd_vel based on the latest message on to /scan, fetched by the subscriber.

Please ensure you do not import anything from the other packages into the topics_quiz package - all its codes should be created from scratch.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.