moteus 0.3.82__py3-none-any.whl → 0.3.84__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
moteus/moteus_tool.py CHANGED
@@ -78,7 +78,7 @@ def stddev(data):
78
78
  mean = sum(data) / len(data)
79
79
  return math.sqrt(sum((x - mean) ** 2 for x in data) / len(data))
80
80
 
81
- SUPPORTED_ABI_VERSION = 0x010a
81
+ SUPPORTED_ABI_VERSION = 0x010b
82
82
 
83
83
  # Old firmwares used a slightly incorrect definition of Kv/v_per_hz
84
84
  # that didn't match with vendors or oscilloscope tests.
@@ -105,6 +105,34 @@ class FirmwareUpgrade:
105
105
  lines = old_config.split(b'\n')
106
106
  items = dict([line.split(b' ') for line in lines if b' ' in line])
107
107
 
108
+ if self.new <= 0x010a and self.old >= 0x010b:
109
+ flux_brake_margin_voltage = float(items.pop(b'servo.flux_brake_margin_voltage'))
110
+ max_voltage = float(items[b'servo.max_voltage'])
111
+
112
+ flux_brake_min_voltage = max_voltage - flux_brake_margin_voltage
113
+
114
+ print(f"Downgrading servo.flux_brake_margin_voltage to servo.flux_brake_min_voltage={flux_brake_min_voltage}")
115
+
116
+ items[b'servo.flux_brake_min_voltage'] = str(flux_brake_min_voltage).encode('utf8')
117
+
118
+ temperature_margin = float(items.pop(b'servo.temperature_margin'))
119
+ fault_temperature = float(items[b'servo.fault_temperature'])
120
+
121
+ derate_temperature = fault_temperature - temperature_margin
122
+
123
+ print(f"Downgrading servo.temperature_margin to servo.derate_temperature={derate_temperature}")
124
+ items[b'servo.derate_temperature'] = str(derate_temperature).encode('utf8')
125
+
126
+ motor_temperature_margin = float(items.pop(b'servo.motor_temperature_margin'))
127
+ motor_fault_temperature = float(items[b'servo.motor_fault_temperature'])
128
+ motor_derate_temperature = (
129
+ (motor_fault_temperature - motor_temperature_margin)
130
+ if math.isfinite(motor_fault_temperature) else
131
+ 50)
132
+
133
+ print(f"Downgrading servo.motor_temperature_margin to servo.motor_derate_temperature={motor_derate_temperature}")
134
+ items[b'servo.motor_derate_temperature'] = str(motor_derate_temperature).encode('utf8')
135
+
108
136
  if self.new <= 0x0109 and self.old >= 0x010a:
109
137
  kv = float(items.pop(b'motor.Kv'))
110
138
 
@@ -500,6 +528,44 @@ class FirmwareUpgrade:
500
528
  items[b'servo.max_power_W'] = str(old_max_power * (pwm_rate / 40000)).encode('utf8')
501
529
  print(f"Upgraded servo.max_power_W to {items[b'servo.max_power_W'].decode('utf8')} for 0x010a")
502
530
 
531
+ if self.new >= 0x010b and self.old <= 0x010a:
532
+ flux_brake_min_voltage = float(items.pop(b'servo.flux_brake_min_voltage'))
533
+ max_voltage = float(items[b'servo.max_voltage'])
534
+
535
+ flux_brake_margin_voltage = max(0, max_voltage - flux_brake_min_voltage)
536
+
537
+ print(f"Upgraded servo.flux_brake_min_voltage to servo.flux_brake_margin_voltage={flux_brake_margin_voltage}")
538
+ items[b'servo.flux_brake_margin_voltage'] = str(flux_brake_margin_voltage).encode('utf8')
539
+
540
+
541
+ derate_temperature = float(items.pop(b'servo.derate_temperature'))
542
+ fault_temperature = float(items[b'servo.fault_temperature'])
543
+
544
+ temperature_margin = fault_temperature - derate_temperature
545
+
546
+ print(f"Upgraded servo.derate_temperature to servo.temperature_margin={temperature_margin}")
547
+ items[b'servo.temperature_margin'] = str(temperature_margin).encode('utf8')
548
+
549
+ def float_or_none(val):
550
+ if val is None:
551
+ return None
552
+ return float(val)
553
+
554
+ motor_derate_temperature = (
555
+ float_or_none(items.pop(b'servo.motor_derate_temperature', None)))
556
+ motor_fault_temperature = (
557
+ float_or_none(items.get(b'servo.motor_fault_temperature', None)))
558
+
559
+ if (motor_derate_temperature is not None and
560
+ motor_fault_temperature is not None):
561
+
562
+ motor_temperature_margin = (
563
+ (motor_fault_temperature - motor_derate_temperature)
564
+ if math.isfinite(motor_fault_temperature) else
565
+ 20)
566
+ print(f"Upgraded servo.motor_derate_temperature to servo.motor_temperature_margin={motor_temperature_margin}")
567
+ items[b'servo.motor_temperature_margin'] = str(motor_temperature_margin).encode('utf8')
568
+
503
569
  lines = [key + b' ' + value for key, value in items.items()]
504
570
  return b'\n'.join(lines)
505
571
 
@@ -1123,7 +1189,8 @@ class Stream:
1123
1189
  await self.check_for_fault()
1124
1190
 
1125
1191
  cal_result = await self.calibrate_encoder_mapping(
1126
- input_V, winding_resistance, current_noise)
1192
+ input_V, winding_resistance, current_noise,
1193
+ unwrapped_position_scale)
1127
1194
  await self.check_for_fault()
1128
1195
 
1129
1196
  motor_kv = await self.calibrate_kv_rating(
@@ -1214,7 +1281,7 @@ class Stream:
1214
1281
  math.sqrt((self.args.cal_motor_power / 1.5) *
1215
1282
  winding_resistance))
1216
1283
 
1217
- async def calibrate_encoder_mapping(self, input_V, winding_resistance, current_noise):
1284
+ async def calibrate_encoder_mapping(self, input_V, winding_resistance, current_noise, unwrapped_position_scale):
1218
1285
  # Figure out what voltage to use for encoder calibration.
1219
1286
  encoder_cal_voltage = \
1220
1287
  await self.find_encoder_cal_voltage(input_V, winding_resistance)
@@ -1255,7 +1322,8 @@ class Stream:
1255
1322
  "servo.voltage_mode_control")
1256
1323
 
1257
1324
  return await self.calibrate_encoder_mapping_absolute(
1258
- encoder_cal_voltage, encoder_cal_current, current_noise)
1325
+ encoder_cal_voltage, encoder_cal_current, current_noise,
1326
+ unwrapped_position_scale)
1259
1327
  finally:
1260
1328
  # At least try to stop.
1261
1329
  await self.command("d stop")
@@ -1358,7 +1426,8 @@ class Stream:
1358
1426
  await self.find_index(encoder_cal_voltage)
1359
1427
 
1360
1428
  async def calibrate_encoder_mapping_absolute(
1361
- self, encoder_cal_voltage, encoder_cal_current, current_noise):
1429
+ self, encoder_cal_voltage, encoder_cal_current, current_noise,
1430
+ unwrapped_position_scale):
1362
1431
  await self.ensure_valid_theta(encoder_cal_voltage)
1363
1432
 
1364
1433
  current_quality_factor = encoder_cal_current / current_noise
@@ -1383,7 +1452,7 @@ class Stream:
1383
1452
  await asyncio.sleep(3.0)
1384
1453
 
1385
1454
  await self.write_message(
1386
- (f"d cali i{encoder_cal_current} s{self.args.cal_ll_encoder_speed}"))
1455
+ (f"d cali i{encoder_cal_current} s{self.args.cal_ll_encoder_speed * unwrapped_position_scale}"))
1387
1456
  else:
1388
1457
  await self.command(f"d pwm 0 {encoder_cal_voltage}")
1389
1458
  await asyncio.sleep(3.0)
moteus/version.py CHANGED
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- VERSION="0.3.82"
15
+ VERSION="0.3.84"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moteus
3
- Version: 0.3.82
3
+ Version: 0.3.84
4
4
  Summary: moteus brushless controller library and tools
5
5
  Home-page: https://github.com/mjbots/moteus
6
6
  Author: mjbots Robotic Systems
@@ -6,7 +6,7 @@ moteus/command.py,sha256=UkOsbtkso6Oyex8CfbpAKpBNriik519ymxL86EZGkRs,1169
6
6
  moteus/export.py,sha256=XitBUuf4MDRIneXQSUptizIhZi2BdHyFO2Vo_2d2CFI,1742
7
7
  moteus/fdcanusb.py,sha256=7PrQiCTROY96gdT2zSZYU1bOCriw-I7H6NspaZpiEx4,7431
8
8
  moteus/moteus.py,sha256=vImSRBn6VEmoijD6hvrSRVxuv1_xVaEJU3F_3Wi6GiE,52498
9
- moteus/moteus_tool.py,sha256=toUr5Rv0XoNZ1soZc3IusAMAoQYsZBVOwkc3DtcSniY,93662
9
+ moteus/moteus_tool.py,sha256=ocKUSl7qc_O1DOwoj5UFx1Kaw5HkRPEhU_e-tftfmk4,97236
10
10
  moteus/multiplex.py,sha256=2tdNX5JSh21TOjN6N9LKribLQtVYyyYbXjzwXB64sfA,12119
11
11
  moteus/posix_aioserial.py,sha256=2oDrw8TBEwuEQjY41g9rHeuFeffcPHqMwNS3nf5NVq8,3137
12
12
  moteus/pythoncan.py,sha256=M5Qba3aCzO_GyXcIsLJxjw3NrPgUk4CUnHOQIhQeIb0,4786
@@ -14,10 +14,10 @@ moteus/reader.py,sha256=9i1-h4aGd4syfqtWJcpg70Bl-bmunkGU4FmXmOLyRt8,12121
14
14
  moteus/regression.py,sha256=M5gjDBYJQ64iBXIrvBhMkD8TYhtlnQ85x8U4py0niGA,1196
15
15
  moteus/router.py,sha256=501W5GZ12rFoc1lmcH3S7IYsoc-Q_-FJ4B3i37RzE3Q,2061
16
16
  moteus/transport.py,sha256=WhkW2G9i25lkOlO55eI5_oXmU0PhDmxTeJ75Sg_7nTI,1021
17
- moteus/version.py,sha256=yUotycLixsbSHt_TAvTu3KUAH5Gwscdtw-jVRomcksk,627
17
+ moteus/version.py,sha256=SIOoh1lHjcFFVldtp79E9rmBXUk63cDry1gjgxqOQ14,627
18
18
  moteus/win32_aioserial.py,sha256=culdl-vYxBKD5n2s5LkIMGyUaHyCcEc8BL5-DWEaxX8,2025
19
- moteus-0.3.82.dist-info/METADATA,sha256=cWJhVsMf0_eWavJcomnA46-CYEK8QXnXpLz6zo_l0R0,3441
20
- moteus-0.3.82.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
21
- moteus-0.3.82.dist-info/entry_points.txt,sha256=accRcwir_K8wCf7i3qHb5R6CPh5SiSgd5a1A92ibb9E,56
22
- moteus-0.3.82.dist-info/top_level.txt,sha256=aZzmI_yecTaDrdSp29pTJuowaSQ9dlIZheQpshGg4YQ,7
23
- moteus-0.3.82.dist-info/RECORD,,
19
+ moteus-0.3.84.dist-info/METADATA,sha256=okhSG2P2nrnQPSoq_F4-4t79_4KVrRCOZat5etq3gAg,3441
20
+ moteus-0.3.84.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
21
+ moteus-0.3.84.dist-info/entry_points.txt,sha256=accRcwir_K8wCf7i3qHb5R6CPh5SiSgd5a1A92ibb9E,56
22
+ moteus-0.3.84.dist-info/top_level.txt,sha256=aZzmI_yecTaDrdSp29pTJuowaSQ9dlIZheQpshGg4YQ,7
23
+ moteus-0.3.84.dist-info/RECORD,,