ROS 2 and rclpy
The Robot Operating System 2 — middleware for nodes, topics, services and actions — with its Python client rclpy.
Advanced
import rclpy
from rclpy.node import Node
from std_msgs.msg import String
class Talker(Node):
def __init__(self):
super().__init__("talker")
self.pub = self.create_publisher(String, "chatter", 10)
self.create_timer(1.0, lambda: self.pub.publish(String(data="hello")))
rclpy.init(); rclpy.spin(Talker())
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.