Skip to content

Commit e6a7dcd

Browse files
Merge ROS2dev
2 parents 4aec495 + 248e564 commit e6a7dcd

12 files changed

+15
-160
lines changed

ros_tcp_endpoint/exceptions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515

1616
class RosTcpEndpointError(Exception):
1717
"""Base class for this package's custom exceptions"""
18-
1918
pass
2019

2120

2221
class TopicOrServiceNameDoesNotExistError(RosTcpEndpointError):
2322
"""The topic or service name passed does not exist in the source destination dictionary."""
24-
2523
pass

ros_tcp_endpoint/server.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, node_name, buffer_size=1024, connections=10, tcp_ip=None, tcp
5050

5151
self.declare_parameter("ROS_IP", "0.0.0.0")
5252
self.declare_parameter("ROS_TCP_PORT", 10000)
53-
53+
5454
if tcp_ip:
5555
self.loginfo("Using ROS_IP override from constructor: {}".format(tcp_ip))
5656
self.tcp_ip = tcp_ip
@@ -134,7 +134,7 @@ def logwarn(self, text):
134134

135135
def logerr(self, text):
136136
self.get_logger().error(text)
137-
137+
138138
def setup_executor(self):
139139
"""
140140
Since rclpy.spin() is a blocking call the server needed a way
@@ -143,7 +143,13 @@ def setup_executor(self):
143143
MultiThreadedExecutor allows us to set the number of threads
144144
needed as well as the nodes that need to be spun.
145145
"""
146-
num_threads = len(self.publishers_table.keys()) + len(self.subscribers_table.keys()) + len(self.ros_services_table.keys()) + len(self.unity_services_table.keys()) + 1
146+
num_threads = (
147+
len(self.publishers_table.keys())
148+
+ len(self.subscribers_table.keys())
149+
+ len(self.ros_services_table.keys())
150+
+ len(self.unity_services_table.keys())
151+
+ 1
152+
)
147153
executor = MultiThreadedExecutor(num_threads)
148154

149155
executor.add_node(self)

ros_tcp_endpoint/tcp_sender.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,11 @@ def send_topic_list(self):
138138
topic_list.topics = [item[0] for item in topics_and_types]
139139
for i in topics_and_types:
140140
node = self.get_registered_topic(i[0])
141-
if (len(i[1]) > 1):
142-
if (node is not None):
141+
if len(i[1]) > 1:
142+
if node is not None:
143143
self.tcp_server.get_logger().warning(
144144
"Only one message type per topic is supported, but found multiple types for topic {}; maintaining {} as the subscribed type.".format(
145-
i[0],
146-
self.parse_message_name(node.msg),
145+
i[0], self.parse_message_name(node.msg)
147146
)
148147
)
149148
topic_list.types = [

ros_tcp_endpoint/thread_pauser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import threading
22

3-
43
class ThreadPauser:
54
def __init__(self):
65
self.condition = threading.Condition()
76
self.result = None
8-
7+
98
def sleep_until_resumed(self):
109
with self.condition:
1110
self.condition.wait()

ros_tcp_endpoint/unity_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def __init__(self, topic, service_class, tcp_server, queue_size=10):
3333
service_class: The message class in catkin workspace
3434
queue_size: Max number of entries to maintain in an outgoing queue
3535
"""
36-
strippedTopic = re.sub('[^A-Za-z0-9_]+', '', topic)
37-
node_name = f'{strippedTopic}_service'
36+
strippedTopic = re.sub("[^A-Za-z0-9_]+", "", topic)
37+
node_name = f"{strippedTopic}_service"
3838
RosReceiver.__init__(self, node_name)
3939

4040
self.topic = topic

test/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/test_client.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

test/test_publisher.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/test_ros_service.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/test_subscriber.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)