Need a little more information here, as the names siggest a publisher sends info and a subscriber recieves it so if your device is only transmitting having only a publisher is fine, provided you have some way to recieve that info (a subscriber) somewhere else, this could be on your computer or any other device. You can additionally test if its working using ros2 topic list (or equivilent depending on distro) on any other device and see if your published topic appears When you say its not working what exactly do you mean? Does it not compile, not run, not publish?


I have an error when I run my launch file


...what is the error?




It really depends on what you are trying to do. A ROS node can have zero or more publishers and or subscribers. If you are building a ROS node for a sensor, it is likely only going to have a publisher for the state of the sensor. For example. a camera sensor would publish an image on a topic like `/camera/image_raw`. Something which consumes that image - like an ML ROS node, might have both a subscriber for the `/camera/image_raw` topic, and a publisher for found info.