Ask Your Question

Revision history [back]

@sloretz is right, just here to add some code for better understanding, future viewers.

So if your publisher is using


Then in your python subscriber subscribe with same QOS setting, for example I subscribe to NavsatFix message with following;

import rclpy
from rclpy.node import Node
from rclpy.qos import qos_profile_sensor_data

from sensor_msgs.msg import NavSatFix

def __init__(self):

    self.subscription = self.create_subscription(
        self.listener_callback, qos_profile_sensor_data
    self.subscription  # prevent unused variable warning

def listener_callback(self, msg):
    print(msg.latitude, msg.longitude, msg.altitude)