Hey everyone,
I am currently trying to talk to my oDrive v3.6 with an esp32 through CAN bus.
I am able to send RTRs to the oDrive and successfully get an answer back.
My issue now is that I don’t know how to turn these 8 bytes of data into sensible information.
The oDrive documentation says to use the can_helpers.hpp library, but I could not find any examples
of how to implement that into my code with the Arduino IDE.
Could someone help me with decoding these messages?
Thanks!
Lizzy
HI Lizzy! This part can be a bit confusing. There is a .dbc file available in the tools folder of the github repo which lists all of the messages and signals available in those messages, along with their start bit, length, data type, factor, and scaling. Most of the data are floats, so you’d do something like:
if(can.available()) {
can.receive();
if(can.message.id == 0x09) {
float pos_estimate = can_getSignal<float>(can.message.buffer, 0, 32);
float vel_estimate = can_getSignal<float>(can.message.buffer, 32, 32);
}
Thank you very much for your reply!
I studied the .dbc file a little and that cleared a lot of thing up for me.
I am now able to perform all the communications that involve data of the type float.
However, when I try to set the control mode, which expects an integer, I run into an issue.
When I send a message to the odrive with the dlc set to 2, the value for the control mode is set
correctly, however the value for the input mode is set to 0.
Is that the intended behaviour? And if so, how do I set the control mode independend from the input mode?
Your help is very much appreciated!
Lizzy