示例#1
0
 def send_read_recursively(_map, path):
     for key in _map:
         if type(_map[key]) is dict:
             send_read_recursively(_map[key], (path + "/" + key) if path != "" else key)
         else:
             subscribe_topic = f"storage/read/balance/{path}/{key}"
             print(f"Subscribing to {subscribe_topic}")
             pyros.publish(subscribe_topic, "")
示例#2
0
        def write_value(map_place, name, _path, value):
            map_place[name] = value

            if abs(value > 0.1):
                s = "{0:.2f}".format(value)
            elif abs(value > 0.01):
                s = "{0:.3f}".format(value)
            elif abs(value > 0.001):
                s = "{0:.4f}".format(value)
            elif abs(value > 0.0001):
                s = "{0:.5f}".format(value)
            else:
                s = "{0:.6f}".format(value)

            pyros.publish("storage/write/balance/" + _path, s)
示例#3
0
 def calibrate(*_args):
     pyros.publish("balancing/calibrate", "all")
示例#4
0
 def manual(self, *_args):
     pyros.publish("manual", "{0:.2f}".format(self.values_panel.manual))
     if pyros.is_connected():
         self.start_stop_balancing_panel.components[0].set_visible(False)
         self.start_stop_balancing_panel.components[1].set_visible(True)
示例#5
0
 def stop_balancing(self, *_args):
     pyros.publish("balancing/stop", "")
     if pyros.is_connected():
         self.start_stop_balancing_panel.components[0].set_visible(True)
         self.start_stop_balancing_panel.components[1].set_visible(False)