moteus 0.3.69__tar.gz → 0.3.71__tar.gz

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.
Files changed (28) hide show
  1. {moteus-0.3.69 → moteus-0.3.71}/PKG-INFO +5 -5
  2. {moteus-0.3.69 → moteus-0.3.71}/README.md +4 -4
  3. {moteus-0.3.69 → moteus-0.3.71}/moteus/moteus.py +22 -0
  4. {moteus-0.3.69 → moteus-0.3.71}/moteus/moteus_tool.py +34 -3
  5. {moteus-0.3.69 → moteus-0.3.71}/moteus/version.py +1 -1
  6. {moteus-0.3.69 → moteus-0.3.71}/moteus.egg-info/PKG-INFO +5 -5
  7. {moteus-0.3.69 → moteus-0.3.71}/setup.py +1 -1
  8. {moteus-0.3.69 → moteus-0.3.71}/moteus/__init__.py +0 -0
  9. {moteus-0.3.69 → moteus-0.3.71}/moteus/aioserial.py +0 -0
  10. {moteus-0.3.69 → moteus-0.3.71}/moteus/aiostream.py +0 -0
  11. {moteus-0.3.69 → moteus-0.3.71}/moteus/calibrate_encoder.py +0 -0
  12. {moteus-0.3.69 → moteus-0.3.71}/moteus/command.py +0 -0
  13. {moteus-0.3.69 → moteus-0.3.71}/moteus/export.py +0 -0
  14. {moteus-0.3.69 → moteus-0.3.71}/moteus/fdcanusb.py +0 -0
  15. {moteus-0.3.69 → moteus-0.3.71}/moteus/multiplex.py +0 -0
  16. {moteus-0.3.69 → moteus-0.3.71}/moteus/posix_aioserial.py +0 -0
  17. {moteus-0.3.69 → moteus-0.3.71}/moteus/pythoncan.py +0 -0
  18. {moteus-0.3.69 → moteus-0.3.71}/moteus/reader.py +0 -0
  19. {moteus-0.3.69 → moteus-0.3.71}/moteus/regression.py +0 -0
  20. {moteus-0.3.69 → moteus-0.3.71}/moteus/router.py +0 -0
  21. {moteus-0.3.69 → moteus-0.3.71}/moteus/transport.py +0 -0
  22. {moteus-0.3.69 → moteus-0.3.71}/moteus/win32_aioserial.py +0 -0
  23. {moteus-0.3.69 → moteus-0.3.71}/moteus.egg-info/SOURCES.txt +0 -0
  24. {moteus-0.3.69 → moteus-0.3.71}/moteus.egg-info/dependency_links.txt +0 -0
  25. {moteus-0.3.69 → moteus-0.3.71}/moteus.egg-info/entry_points.txt +0 -0
  26. {moteus-0.3.69 → moteus-0.3.71}/moteus.egg-info/requires.txt +0 -0
  27. {moteus-0.3.69 → moteus-0.3.71}/moteus.egg-info/top_level.txt +0 -0
  28. {moteus-0.3.69 → moteus-0.3.71}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moteus
3
- Version: 0.3.69
3
+ Version: 0.3.71
4
4
  Summary: moteus brushless controller library and tools
5
5
  Home-page: https://github.com/mjbots/moteus
6
6
  Author: mjbots Robotic Systems
@@ -110,10 +110,10 @@ pr.kp_scale = moteus.F32
110
110
  pr.kd_scale = moteus.F32
111
111
 
112
112
  qr = moteus.QueryResolution()
113
- qr.mode = mp.INT8
114
- qr.position = mp.F32
115
- qr.velocity = mp.F32
116
- qr.torque = mp.F32
113
+ qr.mode = moteus.INT8
114
+ qr.position = moteus.F32
115
+ qr.velocity = moteus.F32
116
+ qr.torque = moteus.F32
117
117
 
118
118
  c = moteus.Controller(position_resolution=pr, query_resolution=qr)
119
119
  ```
@@ -90,10 +90,10 @@ pr.kp_scale = moteus.F32
90
90
  pr.kd_scale = moteus.F32
91
91
 
92
92
  qr = moteus.QueryResolution()
93
- qr.mode = mp.INT8
94
- qr.position = mp.F32
95
- qr.velocity = mp.F32
96
- qr.torque = mp.F32
93
+ qr.mode = moteus.INT8
94
+ qr.position = moteus.F32
95
+ qr.velocity = moteus.F32
96
+ qr.torque = moteus.F32
97
97
 
98
98
  c = moteus.Controller(position_resolution=pr, query_resolution=qr)
99
99
  ```
@@ -162,6 +162,7 @@ class Register(enum.IntEnum):
162
162
  Q_CURRENT = 0x004
163
163
  D_CURRENT = 0x005
164
164
  ABS_POSITION = 0x006
165
+ POWER = 0x007
165
166
  MOTOR_TEMPERATURE = 0x00a
166
167
  TRAJECTORY_COMPLETE = 0x00b
167
168
  REZERO_STATE = 0x00c
@@ -199,6 +200,7 @@ class Register(enum.IntEnum):
199
200
  COMMAND_VELOCITY_LIMIT = 0x028
200
201
  COMMAND_ACCEL_LIMIT = 0x029
201
202
  COMMAND_FIXED_VOLTAGE_OVERRIDE = 0x02a
203
+ COMMAND_ILIMIT_SCALE = 0x02b
202
204
 
203
205
  POSITION_KP = 0x030
204
206
  POSITION_KI = 0x031
@@ -220,6 +222,7 @@ class Register(enum.IntEnum):
220
222
  COMMAND_WITHIN_KD_SCALE = 0x044
221
223
  COMMAND_WITHIN_MAX_TORQUE = 0x045
222
224
  COMMAND_WITHIN_TIMEOUT = 0x046
225
+ COMMAND_WITHIN_ILIMIT_SCALE = 0x047
223
226
 
224
227
  ENCODER_0_POSITION = 0x050
225
228
  ENCODER_0_VELOCITY = 0x051
@@ -299,6 +302,7 @@ class QueryResolution:
299
302
  q_current = mp.IGNORE
300
303
  d_current = mp.IGNORE
301
304
  abs_position = mp.IGNORE
305
+ power = mp.IGNORE
302
306
  motor_temperature = mp.IGNORE
303
307
  trajectory_complete = mp.IGNORE
304
308
  rezero_state = mp.IGNORE
@@ -329,6 +333,7 @@ class PositionResolution:
329
333
  velocity_limit = mp.F32
330
334
  accel_limit = mp.F32
331
335
  fixed_voltage_override = mp.F32
336
+ ilimit_scale = mp.F32
332
337
 
333
338
 
334
339
  class VFOCResolution:
@@ -371,6 +376,9 @@ class Parser(mp.RegisterParser):
371
376
  def read_current(self, resolution):
372
377
  return self.read_mapped(resolution, 1.0, 0.1, 0.001)
373
378
 
379
+ def read_power(self, resolution):
380
+ return self.read_mapped(resolution, 10.0, 0.05, 0.0001)
381
+
374
382
  def ignore(self, resolution):
375
383
  self._offset += mp.resolution_size(resolution)
376
384
 
@@ -407,6 +415,9 @@ class Writer(mp.WriteFrame):
407
415
  def write_current(self, value, resolution):
408
416
  self.write_mapped(value, 1.0, 0.1, 0.001, resolution)
409
417
 
418
+ def write_power(self, value, resolution):
419
+ self.write_mapped(value, 10.0, 0.05, 0.0001, resolution)
420
+
410
421
 
411
422
  def parse_register(parser, register, resolution):
412
423
  if register == Register.MODE:
@@ -423,6 +434,8 @@ def parse_register(parser, register, resolution):
423
434
  return parser.read_current(resolution)
424
435
  elif register == Register.ABS_POSITION:
425
436
  return parser.read_position(resolution)
437
+ elif register == Register.POWER:
438
+ return parser.read_power(resolution)
426
439
  elif register == Register.TRAJECTORY_COMPLETE:
427
440
  return parser.read_int(resolution)
428
441
  elif register == Register.HOME_STATE or register == Register.REZERO_STATE:
@@ -642,6 +655,7 @@ class Controller:
642
655
  qr.q_current,
643
656
  qr.d_current,
644
657
  qr.abs_position,
658
+ qr.power,
645
659
  ])
646
660
  for i in range(c1.size()):
647
661
  c1.maybe_write()
@@ -888,6 +902,7 @@ class Controller:
888
902
  velocity_limit=None,
889
903
  accel_limit=None,
890
904
  fixed_voltage_override=None,
905
+ ilimit_scale=None,
891
906
  query=False,
892
907
  query_override=None):
893
908
  """Return a moteus.Command structure with data necessary to send a
@@ -909,6 +924,7 @@ class Controller:
909
924
  pr.velocity_limit if velocity_limit is not None else mp.IGNORE,
910
925
  pr.accel_limit if accel_limit is not None else mp.IGNORE,
911
926
  pr.fixed_voltage_override if fixed_voltage_override is not None else mp.IGNORE,
927
+ pr.ilimit_scale if ilimit_scale is not None else mp.IGNORE
912
928
  ]
913
929
 
914
930
  data_buf = io.BytesIO()
@@ -943,6 +959,8 @@ class Controller:
943
959
  writer.write_accel(accel_limit, pr.accel_limit)
944
960
  if combiner.maybe_write():
945
961
  writer.write_voltage(fixed_voltage_override, pr.fixed_voltage_override)
962
+ if combiner.maybe_write():
963
+ writer.write_voltage(ilimit_scale, pr.ilimit_scale)
946
964
 
947
965
  self._format_query(query, query_override, data_buf, result)
948
966
 
@@ -1098,6 +1116,7 @@ class Controller:
1098
1116
  maximum_torque=None,
1099
1117
  stop_position=None,
1100
1118
  watchdog_timeout=None,
1119
+ ilimit_scale=None,
1101
1120
  query=False,
1102
1121
  query_override=None):
1103
1122
  """Return a moteus.Command structure with data necessary to send a
@@ -1115,6 +1134,7 @@ class Controller:
1115
1134
  pr.kd_scale if kd_scale is not None else mp.IGNORE,
1116
1135
  pr.maximum_torque if maximum_torque is not None else mp.IGNORE,
1117
1136
  pr.watchdog_timeout if watchdog_timeout is not None else mp.IGNORE,
1137
+ pr.ilimit_scale if ilimit_scale is not None else mp.IGNORE,
1118
1138
  ]
1119
1139
 
1120
1140
  data_buf = io.BytesIO()
@@ -1142,6 +1162,8 @@ class Controller:
1142
1162
  writer.write_torque(maximum_torque, pr.maximum_torque)
1143
1163
  if combiner.maybe_write():
1144
1164
  writer.write_time(watchdog_timeout, pr.watchdog_timeout)
1165
+ if combiner.maybe_write():
1166
+ writer.write_pwm(ilimit_scale, pr.ilimit_scale)
1145
1167
 
1146
1168
  self._format_query(query, query_override, data_buf, result)
1147
1169
 
@@ -54,15 +54,30 @@ class FirmwareUpgrade:
54
54
  self.old = old
55
55
  self.new = new
56
56
 
57
- SUPPORTED_ABI_VERSION = 0x0106
57
+ SUPPORTED_ABI_VERSION = 0x0108
58
58
 
59
59
  if new > SUPPORTED_ABI_VERSION:
60
60
  raise RuntimeError(f"\nmoteus_tool needs to be upgraded to support this firmware\n\n (likely 'python -m pip install --upgrade moteus')\n\nThe provided firmare is ABI version 0x{new:04x} but this moteus_tool only supports up to 0x{SUPPORTED_ABI_VERSION:04x}")
61
61
 
62
+ if old > SUPPORTED_ABI_VERSION:
63
+ raise RuntimeError(f"\nmoteus_tool needs to be upgraded to support this board\n\n (likely 'python -m pip install --upgrade moteus')\n\nThe board firmware is ABI version 0x{old:04x} but this moteus_tool only supports up to 0x{SUPPORTED_ABI_VERSION:04x}")
64
+
62
65
  def fix_config(self, old_config):
63
66
  lines = old_config.split(b'\n')
64
67
  items = dict([line.split(b' ') for line in lines if b' ' in line])
65
68
 
69
+ if self.new <= 0x0107 and self.old >= 0x0108:
70
+ if float(items.get(b'servo.bemf_feedforward', '0')) == 0.0:
71
+ print("Reverting servo.bemf_feedforward to 1.0")
72
+ items[b'servo.bemf_feedforward'] = b'1.0'
73
+
74
+ if self.new <= 0x0106 and self.old >= 0x0107:
75
+ # motor_position.output.sign was broken in older versions.
76
+ if int(items[b'motor_position.output.sign']) != 1:
77
+ print("WARNING: motor_position.output.sign==-1 is broken in order versions, disabling")
78
+ items[b'motor_position.output.sign'] = '1'
79
+ pass
80
+
66
81
  if self.new <= 0x0105 and self.old >= 0x0106:
67
82
  # Downgrade the I2C polling rate.
68
83
  for aux in [1, 2]:
@@ -279,6 +294,18 @@ class FirmwareUpgrade:
279
294
  items[poll_rate_us_key] = str(int(poll_ms) * 1000).encode('utf8')
280
295
  print("Upgrading I2C rates for version 0x0106")
281
296
 
297
+ if self.new >= 0x0107 and self.old <= 0x0106:
298
+ if int(items.get(b'motor_position.output.sign', 1)) == -1:
299
+ print("Upgrading from motor_position.output.sign == -1, " +
300
+ "this was broken before, behavior will change")
301
+
302
+ # No actual configuration updating is required here.
303
+ pass
304
+
305
+ if self.new >= 0x0108 and self.old <= 0x0107:
306
+ if float(items.get(b'servo.bemf_feedforward', 1.0)) == 1.0:
307
+ print("Upgrading servo.bemf_feedforward to 0.0")
308
+ items[b'servo.bemf_feedforward'] = b'0.0'
282
309
 
283
310
  lines = [key + b' ' + value for key, value in items.items()]
284
311
  return b'\n'.join(lines)
@@ -798,6 +825,8 @@ class Stream:
798
825
  return cal_voltage
799
826
 
800
827
  async def do_calibrate(self):
828
+ self.firmware = await self.read_data("firmware")
829
+
801
830
  # Determine what our calibration parameters are.
802
831
  self.calculate_calibration_parameters()
803
832
 
@@ -1417,8 +1446,10 @@ class Stream:
1417
1446
  geared_v_per_hz = 1.0 / _calculate_slope(voltages, speed_hzs)
1418
1447
 
1419
1448
  v_per_hz = (geared_v_per_hz *
1420
- unwrapped_position_scale *
1421
- motor_output_sign)
1449
+ unwrapped_position_scale)
1450
+ if self.firmware.version <= 0x0106:
1451
+ v_per_hz *= motor_output_sign
1452
+
1422
1453
  print(f"v_per_hz (pre-gearbox)={v_per_hz}")
1423
1454
 
1424
1455
  await self.command(f"conf set servopos.position_min {original_position_min}")
@@ -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.69"
15
+ VERSION="0.3.71"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moteus
3
- Version: 0.3.69
3
+ Version: 0.3.71
4
4
  Summary: moteus brushless controller library and tools
5
5
  Home-page: https://github.com/mjbots/moteus
6
6
  Author: mjbots Robotic Systems
@@ -110,10 +110,10 @@ pr.kp_scale = moteus.F32
110
110
  pr.kd_scale = moteus.F32
111
111
 
112
112
  qr = moteus.QueryResolution()
113
- qr.mode = mp.INT8
114
- qr.position = mp.F32
115
- qr.velocity = mp.F32
116
- qr.torque = mp.F32
113
+ qr.mode = moteus.INT8
114
+ qr.position = moteus.F32
115
+ qr.velocity = moteus.F32
116
+ qr.torque = moteus.F32
117
117
 
118
118
  c = moteus.Controller(position_resolution=pr, query_resolution=qr)
119
119
  ```
@@ -25,7 +25,7 @@ long_description = (here / 'README.md').read_text(encoding='utf-8')
25
25
 
26
26
  setuptools.setup(
27
27
  name = 'moteus',
28
- version = "0.3.69",
28
+ version = "0.3.71",
29
29
  description = 'moteus brushless controller library and tools',
30
30
  long_description = long_description,
31
31
  long_description_content_type = 'text/markdown',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes