Writes a value to the motors. Args: motor_ids: The motor IDs to write to. value: The value to write to the control table. address: The control table address to write to. Returns: A list of IDs that were unsuccessful.
(
self,
motor_ids: Sequence[int],
value: int,
address: int,
)
| 236 | LEN_GOAL_POSITION) |
| 237 | |
| 238 | def write_byte( |
| 239 | self, |
| 240 | motor_ids: Sequence[int], |
| 241 | value: int, |
| 242 | address: int, |
| 243 | ) -> Sequence[int]: |
| 244 | """Writes a value to the motors. |
| 245 | |
| 246 | Args: |
| 247 | motor_ids: The motor IDs to write to. |
| 248 | value: The value to write to the control table. |
| 249 | address: The control table address to write to. |
| 250 | |
| 251 | Returns: |
| 252 | A list of IDs that were unsuccessful. |
| 253 | """ |
| 254 | self.check_connected() |
| 255 | errored_ids = [] |
| 256 | for motor_id in motor_ids: |
| 257 | comm_result, dxl_error = self.packet_handler.write1ByteTxRx( |
| 258 | self.port_handler, motor_id, address, value) |
| 259 | success = self.handle_packet_result( |
| 260 | comm_result, dxl_error, motor_id, context='write_byte') |
| 261 | if not success: |
| 262 | errored_ids.append(motor_id) |
| 263 | return errored_ids |
| 264 | |
| 265 | def sync_write(self, motor_ids: Sequence[int], |
| 266 | values: Sequence[Union[int, float]], address: int, |
no test coverage detected