def METHOD_NAME(self, msg):
    # Estimate commands frequency; we do continuously as it can be very different depending on the
    # publisher type, and we don't want to impose extra constraints to keep this package flexible
    if len(self.period_record) < self.PERIOD_RECORD_SIZE:
        self.period_record.append((rospy.Time.now() - self.last_update).to_sec())
    else:
        self.period_record[self.pr_next] = (rospy.Time.now() - self.last_update).to_sec()
    self.pr_next += 1
    self.pr_next %= len(self.period_record)
    self.last_update = rospy.Time.now()
    if len(self.period_record) <= self.PERIOD_RECORD_SIZE / 2:
        # wait until we have some values; make a reasonable assumption (10 Hz) meanwhile
        self.cb_avg_time = 0.1
    else:
        # enough; recalculate with the latest input
        self.cb_avg_time = np.median(self.period_record)
    # now set the max voltage bag size
    self.voltage_bag_maxlen = int(self.VOLTAGE_COLLECTION_TIME / self.cb_avg_time)
    voltage_raw = None
    current_raw = None
    for i in range(0, len(msg.uri)):
        if msg.uri[i] == "voltage":
            voltage_raw = msg.value[i]
        if msg.uri[i] == "current":
            current_raw = msg.value[i]
    if voltage_raw != None:
        # Calculation of real voltage
        voltage = self.voltage_divider_factor * voltage_raw / self.PHIDGET_MAX_VALUE
        voltage = round(voltage, 3)
        self.append_voltage_bag(voltage)
    if current_raw != None:
        # Calculation of real current
        self.current = self.current_min + (self.current_max - self.current_min) * (current_raw -
                                                                                   self.PHIDGET_MIN_VALUE) / (self.PHIDGET_MAX_VALUE - self.PHIDGET_MIN_VALUE)
        self.current = round(self.current, 3)
        if self.current > 0:
            self.charging = True
        else:
            self.charging = False