This project demonstrates a simple ROS 2 node written in Python using rclpy.
The node publishes a geometry_msgs/Vector3 message and simultaneously subscribes to the same topic to receive its own messages.
- The node creates:
- A publisher on the topic
vector_topic(geometry_msgs/msg/Vector3). - A subscriber on the same topic to listen for incoming messages.
- A timer that publishes a new
Vector3message every second.
- A publisher on the topic
- The message has fixed coordinates:
x = -1.5y = 2.5z = 7.0
- Every published message is also received back by the subscriber, and both sending and receiving are logged in the console.
GeometryNode
The main ROS 2 node that initializes the publisher, subscriber, and timer.timer_callback
Publishes a newVector3message once per second.listener_callback
Receives and logs the message from the topic.