You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Thanks for digging into this and tracking the issue down! After looking at it, it seems that the Arduino mbed core is not behaving according to the Arduino API specs, so I went ahead and opened this issue: arduino/ArduinoCore-mbed#924. Let's see what the response is on that, and then we'll do a fix on this repo. Good to know that you were already able to make it work for you in the meantime!
And yes controlling many ODrives at once is definitely a use case we want to support well.
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 callscan_intf.write
, which calls thesendMsg
function defined inODriveHardwareCAN.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 thesendMsg
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 thesendMsg
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!
The text was updated successfully, but these errors were encountered: