koala
February 26, 2020, 8:45pm
1
Hi, i wanted to know if it is possible to get the value of each motors directly, i used the method read_encoders() that returns a tuple wich contains both motors value.
There is no longer the get_motor_status () method ?
1 Like
cleoqc
February 26, 2020, 9:12pm
2
get_motor_status() is part of the gopigo3 library, which easygopigo3 inherits from.
Check :
Keyword arguments:
port -- The motor port(s). MOTOR_LEFT and/or MOTOR_RIGHT.
power -- The power limit in percent (0 to 100), with 0 being no limit (100)
dps -- The speed limit in degrees per second, with 0 being no limit
"""
dps = int(dps * self.MOTOR_TICKS_PER_DEGREE)
outArray = [self.SPI_Address, self.SPI_MESSAGE_TYPE.SET_MOTOR_LIMITS, int(port), int(power),\
((dps >> 8) & 0xFF), (dps & 0xFF)]
self.spi_transfer_array(outArray)
def get_motor_status(self, port):
"""
Read a motor status
Keyword arguments:
port -- The motor port (one at a time). MOTOR_LEFT or MOTOR_RIGHT.
Returns a list:
flags -- 8-bits of bit-flags that indicate motor status:
bit 0 -- LOW_VOLTAGE_FLOAT - The motors are automatically disabled because the battery voltage is too low
bit 1 -- OVERLOADED - The motors aren't close to the target (applies to position control and dps speed control).
2 Likes