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

Apply linting fixes #16

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ on:

jobs:
build_and_test:
name: humble
name: jazzy
strategy:
matrix:
env:
- {ROS_DISTRO: humble, ROS_REPO: testing}
- {ROS_DISTRO: humble, ROS_REPO: main}
- {ROS_DISTRO: jazzy, ROS_REPO: testing}
- {ROS_DISTRO: jazzy, ROS_REPO: main}
fail-fast: false
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: 'ros-industrial/industrial_ci@master'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from rclpy.task import Future
from watchdog.events import EVENT_TYPE_MODIFIED
from watchdog.events import FileSystemEventHandler

from clearpath_config_live.clearpath_config_watcher import (
ClearpathConfigWatcher
)
from clearpath_config_live.robot_description_client import (
RobotDescriptionClient
)
from rclpy.task import Future
from watchdog.events import EVENT_TYPE_MODIFIED
from watchdog.events import FileSystemEventHandler


class ClearpathConfigHandler(FileSystemEventHandler):
Expand All @@ -48,5 +47,5 @@ def on_modified(self, event):
)
except Exception as ex:
self.future = Future()
self.logger.error("Updater failed to regenerate config:")
self.logger.error('Updater failed to regenerate config:')
self.logger.error(str(ex))
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ from clearpath_config_live.robot_description_client import (
def main():
# Node
rclpy.init()
node = rclpy.create_node("clearpath_config_live")
node.declare_parameter("setup_path", "/etc/clearpath")
logger = rclpy.logging.get_logger("clearpath_config_live")
node = rclpy.create_node('clearpath_config_live')
node.declare_parameter('setup_path', '/etc/clearpath')
logger = rclpy.logging.get_logger('clearpath_config_live')

# Get File
setup_path_param = node.get_parameter("setup_path")
setup_path_param = node.get_parameter('setup_path')
setup_path = setup_path_param.get_parameter_value().string_value

# Watcher, Handler, and Client
client = RobotDescriptionClient(
node,
"robot_state_publisher",
"robot_description"
'robot_state_publisher',
'robot_description'
)
watcher = ClearpathConfigWatcher(setup_path, logger)
handler = ClearpathConfigHandler(watcher, client, logger)
Expand All @@ -53,17 +53,17 @@ def main():
try:
watcher.start(handler)
except Exception as ex:
logger.error("Live updater failed: \n")
logger.error('Live updater failed: \n')
logger.error(ex.args)

# Spin
try:
rclpy.spin(node)
except KeyboardInterrupt:
logger.info("Live updater exited with keyboard interrupt.")
logger.info('Live updater exited with keyboard interrupt.')
finally:
watcher.stop()


if __name__ == "__main__":
if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
# limitations under the License.

import os
import xacro

from clearpath_generator_common.description.generator import (
DescriptionGenerator
)
import xacro


class ClearpathConfigUpdater:
Expand All @@ -34,7 +35,7 @@ def __init__(

def get_robot_description(self):
"""Get Robot Description Parameter."""
return self.doc.toprettyxml(indent=" ")
return self.doc.toprettyxml(indent=' ')

def is_file(self, path: str) -> bool:
"""Check if File is the Same."""
Expand All @@ -49,5 +50,5 @@ def update(self) -> None:
dg.generate()
# Re-load Description
self.doc = xacro.process_file(
os.path.join(self.setup_path, "robot.urdf.xacro")
os.path.join(self.setup_path, 'robot.urdf.xacro')
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Set

from clearpath_config_live.clearpath_config_updater import (
ClearpathConfigUpdater
)
from typing import Set
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer

Expand Down Expand Up @@ -46,7 +47,7 @@ def update_watched(self, event_handler: FileSystemEventHandler) -> None:
"""Update Directories being Watched."""
self.observer.unschedule_all()
for path in self.updater.paths:
self.logger.info("Watching directory: %s" % dir)
self.logger.info('Watching directory: %s' % dir)
self.observer.schedule(event_handler, path=path, recursive=False)

def update(self, event_handler: FileSystemEventHandler) -> None:
Expand Down
Loading