14
14
from rosserial_msgs import TopicInfo
15
15
import sys
16
16
import os
17
+ import logging
17
18
18
19
# for now threads are used, will be changed with asyncio in the future
19
20
if sys .platform == "esp32" :
24
25
# rosserial protocol header
25
26
header = [0xFF , 0xFE ]
26
27
28
+ logging .basicConfig (level = logging .INFO )
29
+
27
30
# class to manage publish and subscribe
28
31
# COULD BE CHANGED AFTERWARDS
29
32
class NodeHandle (object ):
@@ -87,7 +90,7 @@ def _advertise_topic(self, topic_name, msg, endpoint, buffer_size):
87
90
try :
88
91
register .buffer_size = buffer_size
89
92
except Exception as e :
90
- print ("No buffer size could be defined for topic negotiation." )
93
+ logging . info ("No buffer size could be defined for topic negotiation." )
91
94
92
95
# serialization
93
96
packet = uio .StringIO ()
@@ -164,9 +167,7 @@ def _listen(self):
164
167
# incoming object msg initialized
165
168
msgobj = self .subscribing_topics .get (inid )[0 ]
166
169
except Exception :
167
- print (
168
- "TX request was made or got message from not available subscribed topic."
169
- )
170
+ logging .info ("TX request was made or got message from not available subscribed topic." )
170
171
# object sent to callback
171
172
callback = self .subscribing_topics .get (inid )[1 ]
172
173
fdata = msgobj ()
@@ -176,7 +177,7 @@ def _listen(self):
176
177
raise ValueError ("Message plus Topic ID Checksum is wrong!" )
177
178
178
179
except Exception as e :
179
- print ("No incoming data could be read for subscribes." )
180
+ logging . info ("No incoming data could be read for subscribes." )
180
181
181
182
182
183
# functions to be used in class
0 commit comments