Skip to content

Commit c8d1b49

Browse files
committed
Style cleanups.
Signed-off-by: Chris Lalancette <[email protected]>
1 parent 75ec783 commit c8d1b49

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

image_tools_py/cam2image_py.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@
2020
import cv2
2121

2222
import rclpy
23-
from rclpy.qos import qos_profile_system_default, qos_profile_sensor_data
23+
from rclpy.qos import qos_profile_sensor_data, qos_profile_system_default
2424
import sensor_msgs.msg
2525
import std_msgs.msg
2626

2727

2828
def mat2encoding(frame):
29-
'''
29+
"""
30+
Convert an OpenCV matrix encoding type to a string format.
31+
3032
Convert an OpenCV matrix encoding type to a string format recognized by
31-
sensor_msgs::msg::Image
32-
'''
33+
sensor_msgs::msg::Image.
34+
"""
3335
encoding = ''
3436

3537
encodings = {1: 'mono', 3: 'bgr', 4: 'rgba'}
@@ -52,9 +54,7 @@ def mat2encoding(frame):
5254

5355

5456
def convert_frame_to_message(frame, frame_id, msg):
55-
'''
56-
Convert an OpenCV matrix to a ROS Image message.
57-
'''
57+
"""Convert an OpenCV matrix to a ROS Image message."""
5858
msg.height = frame.shape[0]
5959
msg.width = frame.shape[1]
6060
msg.encoding = mat2encoding(frame)
@@ -73,14 +73,14 @@ def main(args=None):
7373
'-b', '--burger', dest='burger_mode', action='store_true', default=False,
7474
help='Produce images of burgers rather than connecting to a camera')
7575
parser.add_argument(
76-
'-d', '--depth', dest='depth', action='store', default=int(qos_profile_system_default.depth), type=int,
77-
help='Queue depth')
76+
'-d', '--depth', dest='depth', action='store',
77+
default=int(qos_profile_system_default.depth), type=int, help='Queue depth')
7878
parser.add_argument(
7979
'-f', '--frequency', dest='frequency', action='store', default=30, type=int,
8080
help='Publish frequency in Hz')
8181
parser.add_argument(
82-
'-k', '--keep', dest='history_policy', action='store', default=int(qos_profile_system_default.history),
83-
type=int, choices=[0, 1],
82+
'-k', '--keep', dest='history_policy', action='store',
83+
default=int(qos_profile_system_default.history), type=int, choices=[0, 1],
8484
help='History QoS setting, 0 - keep last sample, 1 - keep all the samples')
8585
parser.add_argument(
8686
'-r', '--reliability', dest='reliability_policy', action='store',

image_tools_py/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="2">
44
<name>image_tools_py</name>
5-
<version>0.0.0</version>
5+
<version>0.1.0</version>
66
<description>Python tools to capture/play back images to/from DDS subscriptions/publications.</description>
77
<maintainer email="[email protected]">Chris Lalancette</maintainer>
88
<license>Apache License 2.0</license>

image_tools_py/showimage_py.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ def main(args=None):
4848
# Parse the command-line options.
4949
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
5050
parser.add_argument(
51-
'-d', '--depth', dest='depth', action='store', default=int(qos_profile_system_default.depth), type=int,
52-
help='Queue depth')
51+
'-d', '--depth', dest='depth', action='store',
52+
default=int(qos_profile_system_default.depth), type=int, help='Queue depth')
5353
parser.add_argument(
54-
'-k', '--keep', dest='history_policy', action='store', default=int(qos_profile_system_default.history),
55-
type=int, choices=[0, 1],
54+
'-k', '--keep', dest='history_policy', action='store',
55+
default=int(qos_profile_system_default.history), type=int, choices=[0, 1],
5656
help='History QoS setting, 0 - keep last sample, 1 - keep all the samples')
5757
parser.add_argument(
5858
'-r', '--reliability', dest='reliability_policy', action='store',

0 commit comments

Comments
 (0)