Skip to content

ODriveHardwareCAN sendMsg always returns true #4

Closed
@bthacher-crabi

Description

@bthacher-crabi

While trying to write to 6 ODrives using the Arduino GIGA R1 WiFi, I found that only the first 3 messages would successfully be transmitted. At first, I realized that I wasn't checking the output of the ODriveCAN::setPosition function that internally calls can_intf.write, which calls the sendMsg function defined in ODriveHardwareCAN.hpp, but then I realized that since the underlying Arduino_CAN write function (which calls the mbed::CAN write function) returns 1 on success and 0 on failure. This means that the last line in the sendMsg function (return can_intf.write(msg) >= 0;) causes this function to always return true without checking if the message was queued or not. By removing the >= and checking the output to wait until messages were sent, I was able to get my project working. I'm not sure how high the sendMsg is in the firmware stack, so I'm not sure if removing the >= would fix only my platform and break others, but if it would work I think it would be a very important fix. I also understand that 6 ODrives may not be the most common setup, but the code as it is does not work properly on my platform.

The line in question

Let me know if more information is needed, thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions