„src/simulator/simulator/sim.py“ ändern

expose leading vehicles velocity
This commit is contained in:
PythonGame 2024-07-03 10:06:01 +00:00
parent 06e3c8e461
commit b7bd60756c

View File

@ -243,6 +243,7 @@ class Sim(Node):
super().__init__('sim') super().__init__('sim')
self.publisher_ = self.create_publisher(Float64, 'distance', 10) self.publisher_ = self.create_publisher(Float64, 'distance', 10)
self.velopub = self.create_publisher(Float64, 'velocity', 10) self.velopub = self.create_publisher(Float64, 'velocity', 10)
self.velopub2 = self.create_publisher(Float64, 'lead_velocity', 10)
self.clear = self.create_publisher(Float64, 'clearCenter', 10) self.clear = self.create_publisher(Float64, 'clearCenter', 10)
self.timer = self.create_timer(0.05, self.callback) self.timer = self.create_timer(0.05, self.callback)
self.subscription = self.create_subscription(Float64,'inputPower', self.call, 10) self.subscription = self.create_subscription(Float64,'inputPower', self.call, 10)
@ -263,6 +264,10 @@ class Sim(Node):
msg.data = followingVelocityMpS * 1.00 msg.data = followingVelocityMpS * 1.00
self.velopub.publish(msg) self.velopub.publish(msg)
msg = Float64()
msg.data = leadingVelocityMpS * 1.00
self.velopub2.publish(msg)
msg = Float64() msg = Float64()
msg.data = clearZoneCenter * 1.00 msg.data = clearZoneCenter * 1.00
self.clear.publish(msg) self.clear.publish(msg)