-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgetDog_odom_probe.py
More file actions
executable file
·32 lines (28 loc) · 1.03 KB
/
getDog_odom_probe.py
File metadata and controls
executable file
·32 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
import rclpy
from rclpy.node import Node
from rclpy.qos import QoSProfile, ReliabilityPolicy, DurabilityPolicy, HistoryPolicy
from nav_msgs.msg import Odometry
class OdomProbe(Node):
def __init__(self):
super().__init__("getDog_odom_probe")
topic = self.declare_parameter("topic", "/dog_odom").value
qos = QoSProfile(
reliability=ReliabilityPolicy.RELIABLE,
durability=DurabilityPolicy.VOLATILE,
history=HistoryPolicy.KEEP_LAST,
depth=1,
)
self.sub = self.create_subscription(Odometry, topic, self.cb, qos)
self.get_logger().info(f"Waiting for one Odometry on {topic} ...")
def cb(self, msg: Odometry):
self.get_logger().info(f"header.frame_id='{msg.header.frame_id}', child_frame_id='{msg.child_frame_id}'")
rclpy.shutdown()
def main():
rclpy.init()
rclpy.spin(OdomProbe())
if __name__ == "__main__":
main()
#RUN
# export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# python3 getDog_odom_probe.py