MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / set_motor_position

Method set_motor_position

Software/Python/gopigo3.py:466–478  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 7

drive_cmMethod · 0.45
drive_degreesMethod · 0.45
orbitMethod · 0.45
turn_degreesMethod · 0.45
Motor_Position.pyFile · 0.45
Motor_Follow.pyFile · 0.45
TurnDegreesFunction · 0.45

Calls 1

spi_transfer_arrayMethod · 0.95

Tested by

no test coverage detected