Sets whether torque is enabled for the motors. Args: motor_ids: The motor IDs to configure. enabled: Whether to engage or disengage the motors. retries: The number of times to retry. If this is <0, will retry forever. retry_int
(self,
motor_ids: Sequence[int],
enabled: bool,
retries: int = -1,
retry_interval: float = 0.25)
| 178 | self.OPEN_CLIENTS.remove(self) |
| 179 | |
| 180 | def set_torque_enabled(self, |
| 181 | motor_ids: Sequence[int], |
| 182 | enabled: bool, |
| 183 | retries: int = -1, |
| 184 | retry_interval: float = 0.25): |
| 185 | """Sets whether torque is enabled for the motors. |
| 186 | |
| 187 | Args: |
| 188 | motor_ids: The motor IDs to configure. |
| 189 | enabled: Whether to engage or disengage the motors. |
| 190 | retries: The number of times to retry. If this is <0, will retry |
| 191 | forever. |
| 192 | retry_interval: The number of seconds to wait between retries. |
| 193 | """ |
| 194 | remaining_ids = list(motor_ids) |
| 195 | while remaining_ids: |
| 196 | remaining_ids = self.write_byte( |
| 197 | remaining_ids, |
| 198 | int(enabled), |
| 199 | ADDR_TORQUE_ENABLE, |
| 200 | ) |
| 201 | if remaining_ids: |
| 202 | logging.error('Could not set torque %s for IDs: %s', |
| 203 | 'enabled' if enabled else 'disabled', |
| 204 | str(remaining_ids)) |
| 205 | if retries == 0: |
| 206 | break |
| 207 | time.sleep(retry_interval) |
| 208 | retries -= 1 |
| 209 | |
| 210 | def read_pos_vel_cur(self) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: |
| 211 | """Returns the current positions and velocities.""" |