Skip to content

Commit 557417a

Browse files
committed
frequency control using rate support
1 parent 297ec6c commit 557417a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

manager/manager/lint/linter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ def evaluate_code(self, code, ros_version, warnings=False, py_lint_source="pylin
6363
r'[^ ]while\s*True\s*:|'
6464
r'[^ ]while\s*1\s*:|'
6565
r'[^ ]while\s*\(\s*1\s*\)\s*:|'
66-
r'rclpy\.spin\(\s*\w+\s*\)|'
67-
r'rclpy\.spin_once\(\s*\w+\s*.*?\)'
66+
r'rclpy\.spin_once\(\s*\w+\s*.*?\)|'
67+
r'\.create_rate\(\s*[\w.]+\s*\)'
6868

6969
)
7070
loop_match = re.search(loop_regex, code)
7171

7272
if loop_match is None:
73-
return "ERROR: No event loop found. Add 'while True:', 'rclpy.spin(node)', or 'rclpy.spin_once(node)'"
73+
return "ERROR: No event loop found. Add 'while True:', 'rclpy.spin(node)', or 'rclpy.spin_once(node)' or use 'rclpy.Rate()'"
7474

75-
if "rclpy.spin" in loop_match.group() or "rclpy.spin_once" in loop_match.group():
75+
if "rclpy.spin" in loop_match.group() or "rclpy.spin_once" in loop_match.group() or ".create_rate" in loop_match.group():
7676
# Keep the code as-is; don't modify it
7777
pass
7878
else:

0 commit comments

Comments
 (0)