CAN Interface Available for Testing

@alexisdal, if you are looking for an option to interface CAN
check out this can-to-usb converter. Its cheap and says it comes with ‘slcan’ firmware–a type that is compatible with linux kernel CAN driver(socketCAN). I am currently using a slcan type converter as well.

thanks for suggestion. I may give it a try later.

but i think i’m likely to prevent from using a PC ever again with odrive (unless for debuging purposes).
i’m thinking of using a teensy 3.5, it has much more horse power than arduino mega + i see both a can bus onboard and some serial ports as well shall i fail to make CAN bus as i want.

I now try to read encoder values and motors errors during trajectory execution and i’m facing UART bandwith bottlenecks now :confused:
canbus would help here

@Wetmelon and other CAN interface users,
I have some opinion about the Set Pos Setpoint (0x00C) command.

I started to use Vel FF along with Pos Setpoint to track motion trajectory, and noticed the scale factor of 0.1 and int16_t representation limits the range of Vel FF quite a bit:
2^16/2/10 = +/-3276 (16bit, signed, scale factor).
Considering motor rpm of several thousand used with encoder with several thousand cpr gives max velocity of something like 200,000 ~ 500,000.

What do you think about taking 4 bits from Pos_Setpoint to make Vel_FF signed 20 bit int and making the scale factor to 1? This will allow +/- 524288, while still having more than enough range for Pos_Setpoint.

This is a never-ending struggle unfortunately. What happens if someone comes along and wants to use an encoder with 500000 counts?

The correct solution is to decouple the value from CPR, by making it radians or mm or something like that

Good point. Decoupling will also eliminate the need to duplicate cpr settings to software controlling ODrive. How about going in this direction then? are there other issues?

Hi @alexisdal,
Sorry for my late reply. For the Microchip CAN BUS Analyzer, I bought this one : https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/APGDT002 . I don’t know where you are from but in France, you can find it on Farnell or RS.
For the Nucleo Board, I use a Nucleo F446RE with a CAN Transceiver Microchip MCP2551 (https://www.microchip.com/wwwproducts/en/en010405). You can buy the Nucleo Board on Farnell, RS, Amazon and many others stores. Same for the can transceiver.

Don’t hesitate if you need more details.

BRs

Timothée

Hey,

I didn’t see a way to get the motor current, am I missing something or would it be possible to add a message to get the current?

jutava

Hi jutava, motor phase current is known as Iq, so it’s in the Get_IQ message

Oh, I should have known that. Thanks for the quick answer!

I’m having some trouble flashing the firmware. When I type “make flash” in the VS Code terminal I get the following error:

‘make’ is not recognized as an internal or external command,
operable program or batch file.

Please help.

You need to add make to your PATH.

1 Like

Is there a way to get the motor acceleration via can or do I have to implement that in my code myself?

ODrive doesn’t calculate acceleration anywhere, so no way to fetch it. Only current and velocity estimate

Hi @Wetmelon,

I got it up and running, thank you.

For the “Set Axis Requested State” command, what are the corresponding integer values for each state? I can’t seem to find that in the documentation anywhere.

Hi all,

Great work ! congratulations !

I have a, probably stupid, question :
Does oDribve board include the transceiver and the termination resistor or shall them be added externally ?

regards,

axis states used in CAN protocol is same as enum State_t found in axis.hpp.

1 Like

Both transceiver and termination resistor are included. There is a toggle switch to turn termination on/off.

perfect!
I will order a CAN hat for my PI3 to test it.

Would this chip work for the CAN protocol you wrote @Wetmelon http://www.ti.com/product/TCAN4550-Q1

A basic question. @Wetmelon or @Kakskiv

@Kakskiv I encountered the same problem as you did. My odrive package was installed using “pip install odrive” in anaconda environment as stated in “Get Started” section. @Wetmelon I’m wondering how to incorporate your CAN communication code into my installation? You mentioned I might need to pull the CAN PR or your fork. But I’m not very familiar with Github, could you please give a more detailed instruction on how to add CAN capability to my current installation?

UPDATE: I managed to download your branch. I ran the odrivetool at ODrive/tools/odrivetool. But in the odrivetool interface, I still couldn’t find CAN setting for each axis. Also couldn’t find the setting to adjust baud rate.

Thank you!