Arduino with ODriveCan.h

I want to control the speed of the Odrive via CAN.

Is there a detailed explanation of “ODriveCAN.h” somewhere?

I can’t understand the contents of the “Arduino Library Reference” at all. For example, I want to control it by the rotation speed, but do I need to set VELOCITY_CONTROL with setControllerMode(uint8_t control_mode, uint8_t input_mode)? In that case, what should I put in the argument? What is input_mode?

Even if I change “odrv0.setPosition” in the sample code to “odrv0.setVelocity(velocity);” it doesn’t work. Is velocity in rpm?

I hope Google Translate works.

Hi! Google translate worked, no problem :slight_smile:

For example, I want to control it by the rotation speed, but do I need to set VELOCITY_CONTROL with setControllerMode(uint8_t control_mode, uint8_t input_mode)?

Yes. You can see explanations for the control and input modes here: Controller — ODrive Documentation 0.6.10 documentation

The arguments would be the enums here: ODrive API Reference — ODrive Documentation 0.6.10 documentation, which have shortcuts here: ODriveArduino/src/ODriveEnums.h at master · odriverobotics/ODriveArduino · GitHub

So e.g. setControllerMode(ODriveControlMode::CONTROL_MODE_VELOCITY_CONTROL, ODriveInputMode::INPUT_MODE_PASSTHROUGH) for simple velocity control.

Velocity is in revolutions per second, so one rev/s == 60 RPM.

You need to be in velocity control mode with a correct input mode for velocity control to work.

I would recommend reading through the ODrive documentation and trying the GUI if you haven’t already :slight_smile:

Please let me know if there’s any other way I can help!

Oh, and please see the Arduino library reference here: Controlling ODrive from an Arduino via CAN — ODrive Documentation 0.6.10 documentation