moteus 0.3.83__py3-none-any.whl → 0.3.85__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
@@ -546,16 +546,25 @@ class FirmwareUpgrade:
546
546
  print(f"Upgraded servo.derate_temperature to servo.temperature_margin={temperature_margin}")
547
547
  items[b'servo.temperature_margin'] = str(temperature_margin).encode('utf8')
548
548
 
549
+ def float_or_none(val):
550
+ if val is None:
551
+ return None
552
+ return float(val)
549
553
 
550
- motor_derate_temperature = float(items.pop(b'servo.motor_derate_temperature'))
551
- motor_fault_temperature = float(items[b'servo.motor_fault_temperature'])
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)))
552
558
 
553
- motor_temperature_margin = (
554
- (motor_fault_temperature - motor_derate_temperature)
555
- if math.isfinite(motor_fault_temperature) else
556
- 20)
557
- print(f"Upgraded servo.motor_derate_temperature to servo.motor_temperature_margin={motor_temperature_margin}")
558
- items[b'servo.motor_temperature_margin'] = str(motor_temperature_margin).encode('utf8')
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')
559
568
 
560
569
  lines = [key + b' ' + value for key, value in items.items()]
561
570
  return b'\n'.join(lines)
@@ -1180,7 +1189,8 @@ class Stream:
1180
1189
  await self.check_for_fault()
1181
1190
 
1182
1191
  cal_result = await self.calibrate_encoder_mapping(
1183
- input_V, winding_resistance, current_noise)
1192
+ input_V, winding_resistance, current_noise,
1193
+ unwrapped_position_scale)
1184
1194
  await self.check_for_fault()
1185
1195
 
1186
1196
  motor_kv = await self.calibrate_kv_rating(
@@ -1271,7 +1281,7 @@ class Stream:
1271
1281
  math.sqrt((self.args.cal_motor_power / 1.5) *
1272
1282
  winding_resistance))
1273
1283
 
1274
- 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):
1275
1285
  # Figure out what voltage to use for encoder calibration.
1276
1286
  encoder_cal_voltage = \
1277
1287
  await self.find_encoder_cal_voltage(input_V, winding_resistance)
@@ -1312,7 +1322,8 @@ class Stream:
1312
1322
  "servo.voltage_mode_control")
1313
1323
 
1314
1324
  return await self.calibrate_encoder_mapping_absolute(
1315
- encoder_cal_voltage, encoder_cal_current, current_noise)
1325
+ encoder_cal_voltage, encoder_cal_current, current_noise,
1326
+ unwrapped_position_scale)
1316
1327
  finally:
1317
1328
  # At least try to stop.
1318
1329
  await self.command("d stop")
@@ -1415,9 +1426,8 @@ class Stream:
1415
1426
  await self.find_index(encoder_cal_voltage)
1416
1427
 
1417
1428
  async def calibrate_encoder_mapping_absolute(
1418
- self, encoder_cal_voltage, encoder_cal_current, current_noise):
1419
- await self.ensure_valid_theta(encoder_cal_voltage)
1420
-
1429
+ self, encoder_cal_voltage, encoder_cal_current, current_noise,
1430
+ unwrapped_position_scale):
1421
1431
  current_quality_factor = encoder_cal_current / current_noise
1422
1432
  use_current_for_quality = (
1423
1433
  current_quality_factor > CURRENT_QUALITY_MIN or
@@ -1425,23 +1435,30 @@ class Stream:
1425
1435
  use_current_for_firmware_version = self.firmware.version >= 0x010a
1426
1436
 
1427
1437
  use_current_calibration = (
1428
- use_current_for_quality and use_current_for_firmware_version)
1438
+ not self.args.cal_never_encoder_current_mode and (
1439
+ use_current_for_quality and use_current_for_firmware_version))
1429
1440
 
1430
1441
  if use_current_for_firmware_version and not use_current_for_quality:
1431
1442
  print(f"Using voltage mode calibration, current quality factor {current_quality_factor:.1f} < {CURRENT_QUALITY_MIN:.1f}")
1432
1443
 
1433
-
1434
1444
  old_motor_poles = None
1435
1445
 
1436
1446
  if use_current_calibration:
1437
1447
  old_motor_poles = await self.read_config_int("motor.poles")
1438
1448
  await self.command("conf set motor.poles 2")
1449
+
1450
+ # We have to check for a valid there here, because setting
1451
+ # the motor pole count will invalidate it.
1452
+ await self.ensure_valid_theta(encoder_cal_voltage)
1453
+
1439
1454
  await self.command(f"d pos nan 0 nan c{encoder_cal_current} b1")
1440
1455
  await asyncio.sleep(3.0)
1441
1456
 
1442
1457
  await self.write_message(
1443
- (f"d cali i{encoder_cal_current} s{self.args.cal_ll_encoder_speed}"))
1458
+ (f"d cali i{encoder_cal_current} s{self.args.cal_ll_encoder_speed * unwrapped_position_scale}"))
1444
1459
  else:
1460
+ await self.ensure_valid_theta(encoder_cal_voltage)
1461
+
1445
1462
  await self.command(f"d pwm 0 {encoder_cal_voltage}")
1446
1463
  await asyncio.sleep(3.0)
1447
1464
 
@@ -1705,6 +1722,10 @@ class Stream:
1705
1722
  # current on low resistance / low inductance motors.
1706
1723
  break
1707
1724
  await self.command("d stop")
1725
+
1726
+ # Give a little bit of wait in case we had an error that
1727
+ # the above stop should clear.
1728
+ await asyncio.sleep(0.1)
1708
1729
  except moteus.CommandError as e:
1709
1730
  # It is possible this is an old firmware that does not
1710
1731
  # support inductance measurement.
@@ -2326,6 +2347,8 @@ async def async_main():
2326
2347
  help='write raw calibration data')
2327
2348
  parser.add_argument('--cal-force-encoder-current-mode', action='store_true',
2328
2349
  help='always use encoder current mode calibration if supported')
2350
+ parser.add_argument('--cal-never-encoder-current-mode', action='store_true',
2351
+ help='never use current mode calibration')
2329
2352
 
2330
2353
  args = parser.parse_args()
2331
2354
 
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.83"
15
+ VERSION="0.3.85"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moteus
3
- Version: 0.3.83
3
+ Version: 0.3.85
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=Y3yc84JLsxviX8xKSsQs4vgiQDao3HrTZDWY4Nl4C9w,96721
9
+ moteus/moteus_tool.py,sha256=kIKE7bp9iR6CF16plAymZwYDurA8w4Diw6V1oPln9QQ,97796
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=7Jp_Mv1z0v2vl9MnwL1_tj1x0iFjbf5TbzFIT97SAR4,627
17
+ moteus/version.py,sha256=zZmPsYWAk-TzbzPFCbJiIizP_0N6OWfve42dp65rxmU,627
18
18
  moteus/win32_aioserial.py,sha256=culdl-vYxBKD5n2s5LkIMGyUaHyCcEc8BL5-DWEaxX8,2025
19
- moteus-0.3.83.dist-info/METADATA,sha256=ii1jDDBkGADmZV_RnNXW7N_nIAGS9i_UkqHqWTykcvc,3441
20
- moteus-0.3.83.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
21
- moteus-0.3.83.dist-info/entry_points.txt,sha256=accRcwir_K8wCf7i3qHb5R6CPh5SiSgd5a1A92ibb9E,56
22
- moteus-0.3.83.dist-info/top_level.txt,sha256=aZzmI_yecTaDrdSp29pTJuowaSQ9dlIZheQpshGg4YQ,7
23
- moteus-0.3.83.dist-info/RECORD,,
19
+ moteus-0.3.85.dist-info/METADATA,sha256=AVQrOY-x3zjIEDGKb0G4rZxPQj73iIE3nKTpswZmWSY,3441
20
+ moteus-0.3.85.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
21
+ moteus-0.3.85.dist-info/entry_points.txt,sha256=accRcwir_K8wCf7i3qHb5R6CPh5SiSgd5a1A92ibb9E,56
22
+ moteus-0.3.85.dist-info/top_level.txt,sha256=aZzmI_yecTaDrdSp29pTJuowaSQ9dlIZheQpshGg4YQ,7
23
+ moteus-0.3.85.dist-info/RECORD,,