Set the motor target position in degrees Keyword arguments: port -- The motor port(s). MOTOR_LEFT and/or MOTOR_RIGHT. position -- The target position
(self, port, position)
| 464 | self.spi_transfer_array(outArray) |
| 465 | |
| 466 | def set_motor_position(self, port, position): |
| 467 | """ |
| 468 | Set the motor target position in degrees |
| 469 | |
| 470 | Keyword arguments: |
| 471 | port -- The motor port(s). MOTOR_LEFT and/or MOTOR_RIGHT. |
| 472 | position -- The target position |
| 473 | """ |
| 474 | position_raw = int(position * self.MOTOR_TICKS_PER_DEGREE) |
| 475 | outArray = [self.SPI_Address, self.SPI_MESSAGE_TYPE.SET_MOTOR_POSITION, port,\ |
| 476 | ((position_raw >> 24) & 0xFF), ((position_raw >> 16) & 0xFF),\ |
| 477 | ((position_raw >> 8) & 0xFF), (position_raw & 0xFF)] |
| 478 | reply = self.spi_transfer_array(outArray) |
| 479 | |
| 480 | def set_motor_dps(self, port, dps): |
| 481 | """ |
no test coverage detected