Ejemplo n.º 1
0
def GET_BAT():
    i2c.SETSLAVE(SLAVE_ADDRESS)
    bat = {}
    bat["CELL1"] = {}
    bat["CELL1"]["VOLT"] = (i2c.READ(I2C_CELL1VOLTh) * 128 +
                            i2c.READ(I2C_CELL1VOLTl)) / 1000
    bat["CELL1"]["PERCENTAGE"] = i2c.READ(I2C_CELL1PERC)
    bat["CELL2"] = {}
    bat["CELL2"]["VOLT"] = (i2c.READ(I2C_CELL2VOLTh) * 128 +
                            i2c.READ(I2C_CELL2VOLTl)) / 1000
    bat["CELL2"]["PERCENTAGE"] = i2c.READ(I2C_CELL2PERC)
    bat["CELL3"] = {}
    bat["CELL3"]["VOLT"] = (i2c.READ(I2C_CELL3VOLTh) * 128 +
                            i2c.READ(I2C_CELL3VOLTl)) / 1000
    bat["CELL3"]["PERCENTAGE"] = i2c.READ(I2C_CELL3PERC)
    bat["CELL4"] = {}
    bat["CELL4"]["VOLT"] = (i2c.READ(I2C_CELL4VOLTh) * 128 +
                            i2c.READ(I2C_CELL4VOLTl)) / 1000
    bat["CELL4"]["PERCENTAGE"] = i2c.READ(I2C_CELL4PERC)

    return bat
Ejemplo n.º 2
0
def GET_STATUS():
    i2c.SETSLAVE(SLAVE_ADDRESS)
    status = {}
    #status["angle"] = int(i2c.READ(I2C_ANGLE))-100
    #status["FLpower"]   = int(i2c.READ(I2C_FLpower))-100
    #status["FLspeed"]   = int(i2c.READ(I2C_FLspeed))-100
    #status["FLspdmeas"] = int(i2c.READ(I2C_FLspdmeas))-100
    #status["FRpower"]   = int(i2c.READ(I2C_FRpower))-100
    #status["FRspeed"]   = int(i2c.READ(I2C_FRspeed))-100
    #status["FRspdmeas"] = int(i2c.READ(I2C_FRspdmeas))-100
    #status["BLpower"]   = int(i2c.READ(I2C_BLpower))-100
    #status["BLspeed"]   = int(i2c.READ(I2C_BLspeed))-100
    #status["BLspdmeas"] = int(i2c.READ(I2C_BLspdmeas))-100
    #status["BRpower"]   = int(i2c.READ(I2C_BRpower))-100
    #status["BRspeed"]   = int(i2c.READ(I2C_BRspeed))-100
    #status["BRspdmeas"] = int(i2c.READ(I2C_BRspdmeas))-100
    #MoveMode = int(i2c.READ(I2C_MoveMode))
    #if MoveMode == MoveMode_Speed:
    #	status["MoveMode"] = "Speed"
    #elif MoveMode == MoveMode_Torque:
    #	status["MoveMode"] = "Torque"
    return status
Ejemplo n.º 3
0
def GET_STATUS():
    i2c.SETSLAVE(SLAVE_ADDRESS)
    status = {}
    status["FET1power"] = int(i2c.READ(I2C_FET1power)) - 100
    status["FET1speed"] = int(i2c.READ(I2C_FET1speed))
    status["FET1spdmeas"] = int(i2c.READ(I2C_FET1spdmeas)) - 100
    status["FET2power"] = int(i2c.READ(I2C_FET2power)) - 100
    status["FET2speed"] = int(i2c.READ(I2C_FET2speed))
    status["FET2spdmeas"] = int(i2c.READ(I2C_FET2spdmeas)) - 100
    status["FET3power"] = int(i2c.READ(I2C_FET3power)) - 100
    status["FET3speed"] = int(i2c.READ(I2C_FET3speed))
    status["FET3spdmeas"] = int(i2c.READ(I2C_FET3spdmeas)) - 100
    status["FET4power"] = int(i2c.READ(I2C_FET4power)) - 100
    status["FET4speed"] = int(i2c.READ(I2C_FET4speed))
    status["FET4spdmeas"] = int(i2c.READ(I2C_FET4spdmeas)) - 100
    status["Apower"] = int(i2c.READ(I2C_Apower)) - 100
    status["Aspeed"] = int(i2c.READ(I2C_Aspeed)) - 100
    status["Aspdmeas"] = int(i2c.READ(I2C_Aspdmeas)) - 100
    status["Bpower"] = int(i2c.READ(I2C_Bpower)) - 100
    status["Bspeed"] = int(i2c.READ(I2C_Bspeed)) - 100
    status["Bspdmeas"] = int(i2c.READ(I2C_Bspdmeas)) - 100

    return status
Ejemplo n.º 4
0
def SET_FET4(speed):
    i2c.SETSLAVE(SLAVE_ADDRESS)
    i2c.WRITECMDWAIT(CMD_FET4SPD, speed)
Ejemplo n.º 5
0
def STOP():
    i2c.SETSLAVE(SLAVE_ADDRESS)
    i2c.WRITECMDWAIT(CMD_STOP)
Ejemplo n.º 6
0
def SET_MOTORS(left, right):
    i2c.SETSLAVE(SLAVE_ADDRESS)
    i2c.WRITECMDWAIT(CMD_MOTORL, left + 100)
    i2c.WRITECMDWAIT(CMD_MOTORR, right + 100)
Ejemplo n.º 7
0
def SET_SPEED(speed):
    i2c.SETSLAVE(SLAVE_ADDRESS)
    i2c.WRITECMDWAIT(CMD_USERSPEED, speed + 100)
Ejemplo n.º 8
0
def SET_ANGLE(angle):
    i2c.SETSLAVE(SLAVE_ADDRESS)
    i2c.WRITECMDWAIT(CMD_USERANGLE, angle + 100)
Ejemplo n.º 9
0
def MOVEMODE(movemode):
    i2c.SETSLAVE(SLAVE_ADDRESS)
    i2c.WRITECMDWAIT(CMD_MOVEMODE, movemode)