Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bluetooth cutoff publications #147

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import rclpy
from rclpy.node import Node
from rclpy.qos import qos_profile_default
from rcl_interfaces.srv import GetParameters
from std_msgs.msg import Bool, Int32

Expand All @@ -52,8 +53,8 @@ def __init__(self):
self.quality_cutoff = self.get_parameter('quality_cutoff').value

# Create our publishers
self.stop_pub = self.create_publisher(Bool, 'bt_quality_stop', 10)
self.quality_pub = self.create_publisher(Int32, 'quality', 10)
self.stop_pub = self.create_publisher(Bool, 'bt_quality_stop', qos_profile_default)
self.quality_pub = self.create_publisher(Int32, 'quality', qos_profile_default)

# Get the 'dev' parameter from the joy_node to determine what device we're using
self.get_logger().info('Waiting for joy_node parameter service...')
Expand All @@ -72,11 +73,13 @@ def __init__(self):

self.mac_addr = self.get_mac()

# run the timer at 5Hz
# originally this was 10Hz, but that resulted in missed deadlines
if self.mac_addr is not None:
self.quality_timer = self.create_timer(0.1, self.check_quality)
self.quality_timer = self.create_timer(0.2, self.check_quality)
else:
self.get_logger().info(f'Assuming {self.joy_device} is wired; quality check will be bypassed') # noqa: E501
self.quality_timer = self.create_timer(0.1, self.fake_quality)
self.quality_timer = self.create_timer(0.2, self.fake_quality)

def get_mac(self):
if self.joy_device is None:
Expand Down