Skip to content
Snippets Groups Projects
Commit 7a7d0641 authored by Tomas Cernik's avatar Tomas Cernik
Browse files

bridge fixed not to fall when ros msg cannot be created

parent 5bc2e87a
No related branches found
No related tags found
No related merge requests found
...@@ -112,9 +112,12 @@ class MqttToRosBridge(Bridge): ...@@ -112,9 +112,12 @@ class MqttToRosBridge(Bridge):
now = rospy.get_time() now = rospy.get_time()
if self._interval is None or now - self._last_published >= self._interval: if self._interval is None or now - self._last_published >= self._interval:
ros_msg = self._create_ros_message(mqtt_msg) try:
self._publisher.publish(ros_msg) ros_msg = self._create_ros_message(mqtt_msg)
self._last_published = now self._publisher.publish(ros_msg)
self._last_published = now
except Exception as e:
rospy.logerr(e)
def _create_ros_message(self, mqtt_msg): def _create_ros_message(self, mqtt_msg):
u""" create ROS message from MQTT payload u""" create ROS message from MQTT payload
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment