Offset a motor encoder Keyword arguments: port -- The motor port(s). MOTOR_LEFT and/or MOTOR_RIGHT. offset -- The encoder offset Zero the encoder by offsetting it by the current position
(self, port, offset)
| 569 | return int(encoder / self.MOTOR_TICKS_PER_DEGREE) |
| 570 | |
| 571 | def offset_motor_encoder(self, port, offset): |
| 572 | """ |
| 573 | Offset a motor encoder |
| 574 | |
| 575 | Keyword arguments: |
| 576 | port -- The motor port(s). MOTOR_LEFT and/or MOTOR_RIGHT. |
| 577 | offset -- The encoder offset |
| 578 | |
| 579 | Zero the encoder by offsetting it by the current position |
| 580 | """ |
| 581 | offset = int(offset * self.MOTOR_TICKS_PER_DEGREE) |
| 582 | outArray = [self.SPI_Address, self.SPI_MESSAGE_TYPE.OFFSET_MOTOR_ENCODER, int(port),\ |
| 583 | ((offset >> 24) & 0xFF), ((offset >> 16) & 0xFF), ((offset >> 8) & 0xFF), (offset & 0xFF)] |
| 584 | self.spi_transfer_array(outArray) |
| 585 | |
| 586 | def reset_motor_encoder(self, port): |
| 587 | """ |
no test coverage detected