Skip to content

Commit

Permalink
fix qos
Browse files Browse the repository at this point in the history
  • Loading branch information
eyr1n committed Sep 29, 2023
1 parent 0cad723 commit e14d00b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/signage/src/signage/announce_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from PyQt5.QtMultimedia import QSound
from rclpy.duration import Duration
from rclpy.qos import QoSProfile, DurabilityPolicy
from ament_index_python.packages import get_package_share_directory
from pulsectl import Pulse

Check warning on line 8 in src/signage/src/signage/announce_controller.py

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (pulsectl)

Expand Down Expand Up @@ -44,15 +43,10 @@ def __init__(self, node, autoware_interface, parameter_interface):
self._pulse = Pulse()
# Get default sink at startup
self._sink = self._pulse.get_sink_by_name(self._pulse.server_info().default_sink_name)
self._get_volume_pub = self._node.create_publisher(
Float32,
"~/get/volume",
QoSProfile(depth=1, durability=DurabilityPolicy.TRANSIENT_LOCAL),
)
self._get_volume_pub = self._node.create_publisher(Float32, "~/get/volume", 1)
self._node.create_timer(1.0, self.publish_volume_callback)
self._node.create_service(SetVolume, "~/set/volume", self.set_volume)

self._get_volume_pub.publish(Float32(data=self._sink.volume.value_flat))

def process_pending_announce(self):
try:
for play_sound in self._pending_announce_list:
Expand Down Expand Up @@ -120,10 +114,12 @@ def announce_going_to_depart_and_arrive(self, message):
self.send_announce(message)
self._prev_depart_and_arrive_type = message

def publish_volume_callback(self):
self._get_volume_pub.publish(Float32(data=self._sink.volume.value_flat))

def set_volume(self, request, response):
try:
self._pulse.volume_set_all_chans(self._sink, request.volume)

Check warning on line 122 in src/signage/src/signage/announce_controller.py

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (chans)
self._get_volume_pub.publish(Float32(data=self._sink.volume.value_flat))
response.status.code = ResponseStatus.SUCCESS
except Exception:
response.status.code = ResponseStatus.ERROR
Expand Down

0 comments on commit e14d00b

Please sign in to comment.