-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from rogy-AquaLab/ruff
- Loading branch information
Showing
25 changed files
with
248 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
line-length = 90 | ||
indent-width = 4 | ||
target-version = "py310" | ||
|
||
[lint] | ||
# https://docs.astral.sh/ruff/rules/ | ||
# F: Pyflakes | ||
# E, W: pycodestyle | ||
# I: isort | ||
# A: flake8-builtins | ||
# COM: flake8-commas | ||
# SLF, flake8-self | ||
# SIM: flake8-simplify | ||
# RUF: Ruff-specific rules | ||
select = ["F", "E", "W", "I", "A", "COM", "SLF", "SIM", "RUF"] | ||
ignore = [] | ||
|
||
fixable = ["ALL"] | ||
|
||
[format] | ||
quote-style = "double" | ||
indent-style = "space" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
import cv2 | ||
import rclpy | ||
from cv_bridge import CvBridge | ||
from rclpy.node import Node | ||
from sensor_msgs.msg import Image | ||
from cv_bridge import CvBridge | ||
import cv2 | ||
|
||
|
||
class Imshow(Node): | ||
def __init__(self): | ||
super().__init__('imshow') | ||
self.subscription=self.create_subscription(Image, 'camera_image', self.listener_callback, 10) | ||
self.bridge=CvBridge() | ||
|
||
super().__init__("imshow") | ||
self.subscription = self.create_subscription( | ||
Image, "camera_image", self.listener_callback, 10, | ||
) | ||
self.bridge = CvBridge() | ||
|
||
def listener_callback(self, msg): | ||
frame=self.bridge.imgmsg_to_cv2(msg, "bgr8") | ||
cv2.imshow('Camera', frame) | ||
frame = self.bridge.imgmsg_to_cv2(msg, "bgr8") | ||
cv2.imshow("Camera", frame) | ||
cv2.waitKey(1) | ||
|
||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
imshow=Imshow() | ||
imshow = Imshow() | ||
rclpy.spin(imshow) | ||
imshow.destroy_node() | ||
rclpy.shutdown() | ||
|
||
if __name__=='__main__': | ||
main() | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
import os | ||
from glob import glob | ||
|
||
from setuptools import find_packages, setup | ||
from setuptools import setup | ||
|
||
package_name = 'imshow' | ||
package_name = "imshow" | ||
|
||
setup( | ||
name=package_name, | ||
version='0.0.0', | ||
version="0.0.0", | ||
packages=[package_name], | ||
data_files=[ | ||
('share/ament_index/resource_index/packages',['resource/' + package_name]), | ||
('share/' + package_name,['package.xml']), | ||
(os.path.join('share',package_name,'launch'),glob(os.path.join('launch','*'))) | ||
("share/ament_index/resource_index/packages", ["resource/" + package_name]), | ||
("share/" + package_name, ["package.xml"]), | ||
( | ||
os.path.join("share", package_name, "launch"), | ||
glob(os.path.join("launch", "*")), | ||
), | ||
], | ||
install_requires=['setuptools'], | ||
install_requires=["setuptools"], | ||
zip_safe=True, | ||
maintainer='hiro', | ||
maintainer_email='[email protected]', | ||
description='Image display for ROS2', | ||
license='MIT License', | ||
maintainer="hiro", | ||
maintainer_email="[email protected]", | ||
description="Image display for ROS2", | ||
license="MIT License", | ||
tests_require=[], | ||
entry_points={ | ||
'console_scripts': [ | ||
'imshow = imshow.imshow:main', | ||
"console_scripts": [ | ||
"imshow = imshow.imshow:main", | ||
], | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
import cv2 | ||
import rclpy | ||
from cv_bridge import CvBridge | ||
from rclpy.node import Node | ||
from sensor_msgs.msg import Image | ||
import cv2 | ||
from cv_bridge import CvBridge | ||
|
||
|
||
class Camera(Node): | ||
def __init__(self): | ||
super().__init__('camera') | ||
self.publisher_=self.create_publisher(Image, 'camera_image', 10) | ||
self.timer=self.create_timer(0.1, self.timer_callback) | ||
self.cap=cv2.VideoCapture(0) | ||
self.bridge=CvBridge() | ||
super().__init__("camera") | ||
self.publisher_ = self.create_publisher(Image, "camera_image", 10) | ||
self.timer = self.create_timer(0.1, self.timer_callback) | ||
self.cap = cv2.VideoCapture(0) | ||
self.bridge = CvBridge() | ||
if not self.cap.isOpened(): | ||
self.get_logger().error('Failed to open camera') | ||
self.get_logger().error("Failed to open camera") | ||
rclpy.shutdown() | ||
|
||
def timer_callback(self): | ||
ret,frame=self.cap.read() | ||
ret, frame = self.cap.read() | ||
if ret: | ||
msg=self.bridge.cv2_to_imgmsg(frame, "bgr8") | ||
msg = self.bridge.cv2_to_imgmsg(frame, "bgr8") | ||
self.publisher_.publish(msg) | ||
else: | ||
self.get_logger().error('Failed to capture image') | ||
self.get_logger().error("Failed to capture image") | ||
|
||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
camera=Camera() | ||
camera = Camera() | ||
rclpy.spin(camera) | ||
camera.destroy_node() | ||
rclpy.shutdown() | ||
|
||
if __name__=="__main__": | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
import os | ||
from glob import glob | ||
|
||
from setuptools import find_packages, setup | ||
from setuptools import setup | ||
|
||
package_name = 'camera_reader' | ||
package_name = "camera_reader" | ||
|
||
setup( | ||
name=package_name, | ||
version='0.0.0', | ||
version="0.0.0", | ||
packages=[package_name], | ||
data_files=[ | ||
('share/ament_index/resource_index/packages',['resource/' + package_name]), | ||
('share/' + package_name,['package.xml']), | ||
(os.path.join('share','package_name','launch'),glob(os.path.join('launch','*'))) | ||
("share/ament_index/resource_index/packages", ["resource/" + package_name]), | ||
("share/" + package_name, ["package.xml"]), | ||
( | ||
os.path.join("share", "package_name", "launch"), | ||
glob(os.path.join("launch", "*")), | ||
), | ||
], | ||
install_requires=['setuptools'], | ||
install_requires=["setuptools"], | ||
zip_safe=True, | ||
maintainer='hiro', | ||
maintainer_email='[email protected]', | ||
description='Camera for ROS2', | ||
license='MIT license', | ||
maintainer="hiro", | ||
maintainer_email="[email protected]", | ||
description="Camera for ROS2", | ||
license="MIT license", | ||
tests_require=[], | ||
entry_points={ | ||
'console_scripts': [ | ||
'camera=camera_reader.camera:main', | ||
"console_scripts": [ | ||
"camera=camera_reader.camera:main", | ||
], | ||
}, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,28 +3,30 @@ | |
|
||
from setuptools import find_packages, setup | ||
|
||
package_name = 'joystick' | ||
package_name = "joystick" | ||
|
||
setup( | ||
name=package_name, | ||
version='0.1.0', | ||
packages=find_packages(exclude=['test']), | ||
version="0.1.0", | ||
packages=find_packages(exclude=["test"]), | ||
data_files=[ | ||
('share/ament_index/resource_index/packages', | ||
['resource/' + package_name]), | ||
('share/' + package_name, ['package.xml']), | ||
(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*'))) | ||
("share/ament_index/resource_index/packages", ["resource/" + package_name]), | ||
("share/" + package_name, ["package.xml"]), | ||
( | ||
os.path.join("share", package_name, "launch"), | ||
glob(os.path.join("launch", "*")), | ||
), | ||
], | ||
install_requires=['setuptools'], | ||
install_requires=["setuptools"], | ||
zip_safe=True, | ||
maintainer='h1rono', | ||
maintainer_email='[email protected]', | ||
description='ゲームコントローラー', | ||
license='MIT', | ||
maintainer="h1rono", | ||
maintainer_email="[email protected]", | ||
description="ゲームコントローラー", | ||
license="MIT", | ||
tests_require=[], | ||
entry_points={ | ||
'console_scripts': [ | ||
"joystick = joystick.joystick:main" | ||
"console_scripts": [ | ||
"joystick = joystick.joystick:main", | ||
], | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.