MCPcopy Create free account
hub / github.com/MarkFzp/act-plus-plus / _update_data

Method _update_data

dynamixel_client.py:444–457  ·  view source on GitHub ↗

Updates the data index for the given motor ID.

(self, index: int, motor_id: int)

Source from the content-addressed store, hash-verified

442 self._cur_data = np.zeros(len(self.motor_ids), dtype=np.float32)
443
444 def _update_data(self, index: int, motor_id: int):
445 """Updates the data index for the given motor ID."""
446 cur = self.operation.getData(motor_id, ADDR_PRESENT_CURRENT,
447 LEN_PRESENT_CURRENT)
448 vel = self.operation.getData(motor_id, ADDR_PRESENT_VELOCITY,
449 LEN_PRESENT_VELOCITY)
450 pos = self.operation.getData(motor_id, ADDR_PRESENT_POSITION,
451 LEN_PRESENT_POSITION)
452 cur = unsigned_to_signed(cur, size=2)
453 vel = unsigned_to_signed(vel, size=4)
454 pos = unsigned_to_signed(pos, size=4)
455 self._pos_data[index] = float(pos) * self.pos_scale
456 self._vel_data[index] = float(vel) * self.vel_scale
457 self._cur_data[index] = float(cur) * self.cur_scale
458
459 def _get_data(self):
460 """Returns a copy of the data."""

Callers

nothing calls this directly

Calls 1

unsigned_to_signedFunction · 0.85

Tested by

no test coverage detected