Skip to content

Commit 3826fb1

Browse files
committed
fix except
1 parent bbfb1b4 commit 3826fb1

File tree

1 file changed

+13
-6
lines changed
  • formant_ros2_adapter/scripts

1 file changed

+13
-6
lines changed

formant_ros2_adapter/scripts/main.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
# Seconds
146146
SERVICE_CALL_TIMEOUT = 5
147147

148-
BASE_REFERENCE_FRAME = os.getenv("FORMANT_BASE_REFERENCE_FRAME","base_link")
148+
BASE_REFERENCE_FRAME = os.getenv("FORMANT_BASE_REFERENCE_FRAME", "base_link")
149149

150150

151151
class ROS2Adapter:
@@ -1047,15 +1047,15 @@ def handle_ros2_message(self, msg, subscriber_config):
10471047
try:
10481048
formant_point_cloud = None
10491049
if msg_type == LaserScan:
1050-
formant_point_cloud = FPointCloud.from_ros_laserscan(
1051-
msg
1052-
)
1050+
formant_point_cloud = FPointCloud.from_ros_laserscan(msg)
10531051
if msg_type == PointCloud2:
10541052
formant_point_cloud = FPointCloud.from_ros(msg)
10551053

10561054
if formant_point_cloud is None:
1057-
raise Exception("%s not PointCloud2 or LaserScan" % msg_type)
1058-
1055+
raise Exception(
1056+
"%s not PointCloud2 or LaserScan" % msg_type
1057+
)
1058+
10591059
formant_point_cloud.transform_to_world = self.lookup_transform(
10601060
msg, BASE_REFERENCE_FRAME
10611061
)
@@ -1067,6 +1067,13 @@ def handle_ros2_message(self, msg, subscriber_config):
10671067
timestamp=msg_timestamp,
10681068
)
10691069
)
1070+
except grpc.RpcError as e:
1071+
return
1072+
except Exception as e:
1073+
print(
1074+
"ERROR: Could not ingest " + formant_stream + ": " + str(e)
1075+
)
1076+
return
10701077
else:
10711078
# Ingest any messages without a direct mapping to a Formant type as JSON
10721079
self.fclient.post_json(

0 commit comments

Comments
 (0)