Skip to content

Commit 1ab4a0f

Browse files
author
David Conner
committed
Flake8 cleanup and CI badge update
1 parent 1810f67 commit 1ab4a0f

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ Please refer to the FlexBE Homepage ([flexbe.github.io](http://flexbe.github.io)
1313

1414
You may also want to check out the quick start tutorial demonstrations at [FlexBE Turtlesim Demo](https://github.com/FlexBE/flexbe_turtlesim_demo).
1515

16-
![FlexBE CI](https://github.com/FlexBE/flexbe_behavior_engine/workflows/FlexBE%20CI/badge.svg?branch=ros2-devel)
16+
[![FlexBE CI](https://github.com/FlexBE/flexbe_behavior_engine/actions/workflows/flexbe_ci.yml/badge.svg)](https://github.com/FlexBE/flexbe_behavior_engine/actions/workflows/flexbe_ci.yml)
1717

18-
Jazzy ![ROS Build Farm](https://build.ros2.org/job/Jdev__flexbe_behavior_engine__ubuntu_noble_amd64/badge/icon)
18+
Jazzy [![Jazzy ROS Build Status](https://build.ros2.org/buildStatus/icon?job=Jdev__flexbe_behavior_engine__ubuntu_noble_amd64)](https://build.ros2.org/job/Jdev__flexbe_behavior_engine__ubuntu_noble_amd64/)
1919

20-
Rolling ![ROS Build Farm](https://build.ros2.org/job/Rdev__flexbe_behavior_engine__ubuntu_noble_amd64/badge/icon)
20+
Kilted [![Kilted ROS Build Status](https://build.ros2.org/buildStatus/icon?job=Kdev__flexbe_behavior_engine__ubuntu_noble_amd64)](https://build.ros2.org/job/Kdev__flexbe_behavior_engine__ubuntu_noble_amd64/)
21+
22+
Rolling [![Rolling ROS Build Status](https://build.ros2.org/buildStatus/icon?job=Rdev__flexbe_behavior_engine__ubuntu_noble_amd64)](https://build.ros2.org/job/Rdev__flexbe_behavior_engine__ubuntu_noble_amd64/)
2123

2224
> Note: This version 4+ breaks compatibility with the FlexBE App. You must use the FlexBE WebUI [flexbe_webui](https://github.com/FlexBE/flexbe_webui.git) now.
2325

flexbe_core/flexbe_core/state_logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def initialize(be_name=None):
110110

111111
StateLogger._serialize_impl = StateLogger._log_serialize.get_parameter_value().string_value
112112

113-
if StateLogger._log_config.get_parameter_value().string_value != "":
113+
if StateLogger._log_config.get_parameter_value().string_value != '':
114114
yaml_extra_params = yaml.safe_load(StateLogger._log_config.get_parameter_value().string_value)
115115
else:
116116
yaml_extra_params = {}
117-
117+
118118
logger_config = dict({
119119
'version': 1,
120120
'disable_existing_loggers': False,

flexbe_testing/flexbe_testing/test_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def __init__(self, node, launch_config, wait_cond='True'):
172172
self._launchrunner = None
173173
self._wait_cond = None
174174
self._valid = False
175-
raise NotImplementedError(f"Not implemented for ROS 2 - TODO!\n {launchpath}\n {launchcontent}\n{10*'='}")
175+
raise NotImplementedError(f"Not implemented for ROS 2 - TODO!\n {launchpath}\n {launchcontent}\n{10 * '='}")
176176
# def store(process_name, exit_code):
177177
# self._exit_codes[process_name] = exit_code
178178
# self._launchrunner.add_process_listener(Callback(store))

flexbe_widget/flexbe_widget/behavior_action_server.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import difflib
3535
import os
36+
import time
3637
import zlib
3738

3839
from flexbe_core import BehaviorLibrary
@@ -41,18 +42,17 @@
4142
from flexbe_msgs.action import BehaviorExecution
4243
from flexbe_msgs.msg import BEStatus, BehaviorModification, BehaviorSelection
4344

45+
import rclpy
4446
from rclpy.action import ActionServer
4547
from rclpy.action.server import ServerGoalHandle
48+
from rclpy.callback_groups import MutuallyExclusiveCallbackGroup
4649

4750
from rosidl_runtime_py import get_interface_path
4851

4952
from std_msgs.msg import Empty, Int32
5053

5154
import yaml
5255

53-
import rclpy
54-
import time
55-
from rclpy.callback_groups import MutuallyExclusiveCallbackGroup
5656

5757
class BehaviorActionServer:
5858
"""Behavior action server."""
@@ -72,8 +72,10 @@ def __init__(self, node):
7272
self._pub = self._node.create_publisher(BehaviorSelection, Topics._START_BEHAVIOR_TOPIC, 100)
7373
self._preempt_pub = self._node.create_publisher(Empty, Topics._CMD_PREEMPT_TOPIC, 100)
7474

75-
self._status_pub = self._node.create_subscription(BEStatus, Topics._ONBOARD_STATUS_TOPIC, self._status_cb, 100, callback_group = self.topic_group)
76-
self._state_pub = self._node.create_subscription(Int32, Topics._BEHAVIOR_UPDATE_TOPIC, self._state_cb, 100, callback_group = self.topic_group)
75+
self._status_pub = self._node.create_subscription(BEStatus, Topics._ONBOARD_STATUS_TOPIC, self._status_cb,
76+
100, callback_group=self.topic_group)
77+
self._state_pub = self._node.create_subscription(Int32, Topics._BEHAVIOR_UPDATE_TOPIC, self._state_cb,
78+
100, callback_group=self.topic_group)
7779

7880
self._as = ActionServer(self._node, BehaviorExecution,
7981
Topics._EXECUTE_BEHAVIOR_ACTION,
@@ -87,8 +89,7 @@ def __init__(self, node):
8789
self._node.get_logger().info('%d behaviors available, ready for start request.' % self._behavior_lib.count_behaviors())
8890
self.running = False
8991

90-
91-
def _goal_cb(self, goal_handle : ServerGoalHandle):
92+
def _goal_cb(self, goal_handle: ServerGoalHandle):
9293
self._current_goal = goal_handle
9394
goal = goal_handle.request
9495

@@ -179,6 +180,7 @@ def _preempt_cb(self, goal_handle):
179180
self._node.get_logger().info('Behavior execution preempt requested!')
180181

181182
def clean_me(self):
183+
"""Clean up flags."""
182184
self.running = False
183185
self._current_state = None
184186
self._behavior_started = False
@@ -189,18 +191,18 @@ def _execute_cb(self, goal_handle):
189191

190192
while rclpy.ok() and self.running:
191193
time.sleep(0.01)
192-
print("End execution")
194+
print('End execution')
193195
self.clean_me()
194196
result = BehaviorExecution.Result()
195197
result.outcome = self.outcome
196-
self.outcome = ""
198+
self.outcome = ''
197199
return result
198200

199201
def _status_cb(self, msg):
200202
if msg.code == BEStatus.ERROR:
201203
self._node.get_logger().error('Failed to run behavior! Check onboard terminal for further infos.')
202204
self._current_goal.abort()
203-
self.outcome = "error"
205+
self.outcome = 'error'
204206
self.clean_me()
205207
return
206208

@@ -225,16 +227,16 @@ def _status_cb(self, msg):
225227
self._node.get_logger().info("Finished behavior execution with result '%s'!" % result)
226228
if result == 'preempted':
227229
self._current_goal.succeed() # .canceled()
228-
self.outcome = "preempted"
230+
self.outcome = 'preempted'
229231
self.clean_me()
230232
else:
231233
self._current_goal.succeed()
232-
self.outcome = "success"
234+
self.outcome = 'success'
233235
self.clean_me()
234236
elif msg.code == BEStatus.FAILED:
235237
self._node.get_logger().error("Behavior execution failed in state '%s'!" % str(self._current_state))
236238
self._current_goal.abort()
237-
self.outcome = "failed"
239+
self.outcome = 'failed'
238240
self.clean_me()
239241

240242
def _state_cb(self, msg):

0 commit comments

Comments
 (0)