Skip to content

Commit

Permalink
Merge pull request #16 from clearpathrobotics/cib/jazzy-fixes
Browse files Browse the repository at this point in the history
Apply linting fixes
  • Loading branch information
tonybaltovski authored Nov 6, 2024
2 parents ff4880c + c4577b4 commit 84136ad
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 23 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,33 @@ 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'
env: ${{matrix.env}}

clearpath_desktop_src_ci:
name: Jazzy Clearpath Source
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: jazzy
- uses: ros-tooling/[email protected]
id: action_ros_ci_step
with:
target-ros2-distro: jazzy
package-name: |
clearpath_config_live
clearpath_desktop
ckearpath_viz
vcs-repo-file-url: dependencies.repos
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

0 comments on commit 84136ad

Please sign in to comment.