Triton-Robotics / TR-mbed

6 stars 2 forks source link

Is motor connected #15

Closed pknessness closed 1 year ago

pknessness commented 1 year ago

Have a very simple function/variable that is a reflection of if a motor is online (has it been giving us feedback) or not.

GioByte10 commented 1 year ago
if(motorsExist[bus][r][c]) {
    if (us_ticker_read() / 1000 - lastCalled[bus][r][c] > TIMEOUT_MS) {
        if(debug) {
            printf("Motor %d on bus: %d lost connection\n", c + 4 * r + 1, bus + 1);
            printf("Motor[%d][%d][%d]\n", bus, r, c);
        }
        return false;
    }
}

There is code that checks for all motors being connected. We just have to change it for individual motors and create a boolean variable for it. Also have debug print motor name and [][][].

pknessness commented 1 year ago

yeah ok thats what it was, i remmeber that you had done something similar but i realized during comp it would be more useful to have it motor specific so i can be like oh if(pitch.isConnected) or smth

GioByte10 commented 1 year ago

https://github.com/Triton-Robotics/TR-mbed/commit/75d873e79ab2e41fc0a973d05f26d90ec1a50106

GioByte10 commented 1 year ago

https://github.com/Triton-Robotics/TR-mbed/commit/75d873e79ab2e41fc0a973d05f26d90ec1a50106