added velocity

This commit is contained in:
Nicolas Kuhl 2023-06-29 05:48:40 +02:00
parent 0ee065f899
commit 42a4589732

View File

@ -242,6 +242,7 @@ class Sim(Node):
def __init__(self):
super().__init__('sim')
self.publisher_ = self.create_publisher(Float64, 'distance', 10)
self.velopub = self.create_publisher(Float64, 'velocity', 10)
self.timer = self.create_timer(0.05, self.callback)
self.subscription = self.create_subscription(Float64,'inputPower', self.call, 10)
@ -254,6 +255,10 @@ class Sim(Node):
msg.data = (leadingPosMeter - followingPosMeter) * 1.00
self.publisher_.publish(msg)
msg = Float64()
msg.data = followingVelocityMpS * 1.00
self.velopub.publish(msg)
def main(args=None):
rclpy.init(args=args)