@@ -48,26 +48,31 @@ def setup_with_config(
48
48
self ._logger .info ("Set up Formant Control" )
49
49
50
50
def _handle_teleop (self , msg ):
51
- stream_name = msg .stream
52
- self ._logger .info ("Teleop message received: %s" % stream_name )
53
- if stream_name == "Buttons" :
54
- stream_name = msg .bitset .bits [0 ].key
55
- self ._publisher_coodinator .generic_publisher .publish (stream_name , msg )
56
-
57
- if stream_name == self ._localization_stream :
58
- try :
59
- self ._publisher_coodinator .localization_publisher .publish_goal (msg .pose )
60
- except Exception as e :
61
- self ._logger .warn ("Error publishing goal: %s" % e )
62
-
63
- service_param = None
64
- if msg .HasField ("bitset" ):
65
- if msg .bitset .bits [0 ].value is True :
66
- service_param = "True"
67
- elif msg .HasField ("numeric" ):
68
- service_param = msg .numeric .value
69
- if service_param is not None :
70
- self ._service_coordinator .call_service (stream_name , service_param )
51
+ try :
52
+ stream_name = msg .stream
53
+ self ._logger .info ("Teleop message received: %s" % stream_name )
54
+ if stream_name == "Buttons" :
55
+ stream_name = msg .bitset .bits [0 ].key
56
+ self ._publisher_coodinator .generic_publisher .publish (stream_name , msg )
57
+
58
+ if stream_name == self ._localization_stream :
59
+ try :
60
+ self ._publisher_coodinator .localization_publisher .publish_goal (
61
+ msg .pose
62
+ )
63
+ except Exception as e :
64
+ self ._logger .warn ("Error publishing goal: %s" % e )
65
+
66
+ service_param = None
67
+ if msg .HasField ("bitset" ):
68
+ if msg .bitset .bits [0 ].value is True :
69
+ service_param = "True"
70
+ elif msg .HasField ("numeric" ):
71
+ service_param = msg .numeric .value
72
+ if service_param is not None :
73
+ self ._service_coordinator .call_service (stream_name , service_param )
74
+ except Exception as e :
75
+ self ._logger .warn ("Error in teleop callback: %s" % str (e ))
71
76
72
77
def _handle_command (self , msg ):
73
78
self ._logger .info ("Command received %s" % str (msg ))
0 commit comments