Skip to content

viam-modules/odrive

Repository files navigation

ODrive Modular Component

This module implements the motor driver for ODrive Robotics' ODrive S1 and ODrive Pro motors to be used with viam-server. It only supports serial connectivity. ODrive clones, such as ODESC, may work as well but are not tested.

Getting Started

The motor must first be wired, configured, and calibrated following Odrive instructions.

Before configuring your board, you must create a machine.

Navigate to the CONFIGURE tab of your machine in the Viam app.

Model viam:odrive:serial

Attributes

The following attributes are available for the motor resources available in the Viam ODrive module:

Name Type Inclusion Description
serial_number string Optional The serial number of the ODrive. Can be found using the odrivetool. Will be auto-discovered if not provided. Required if multiple motors are connected.
odrive_config_file string Optional Filepath of a separate JSON file containing your ODrive's configuration. Overrides settings stored in memory. Typically exported using the odrivetool backup-config command.
overrides object Optional Additional configuration overrides in key/value format. See example below.

Example:

{
  "serial_number": "NUM000",
  "odrive_config_file": "local/path/to/motor/config.json",
  "overrides": {
    "axis0.controller.config.vel_limit": 1,
    "axis0.config.watchdog_timeout": 2,
    "axis0.config.enable_watchdog": true
  }
}

Note
There are three levels of motor configuration:

  1. Configuration stored in the ODrive controller's memory, set by the odrivetool.
  2. Optionally, you can define an odrive_config_file to override the memory settings (useful if you prefer to manage settings yourself or share settings across motors).
  3. Finally, you can use the overrides configuration to fine-tune individual settings (especially useful for testing and manual calibration).

Important
You must define axis0.controller.config.vel_limit (velocity limit, in rotations per second) in your motor configuration to use the SetPower command. The SetPower command uses velocity control to set a target velocity as a percentage of the configured axis0.controller.config.vel_limit value.

Next Steps

License

Copyright 2021-2023 Viam Inc.

Apache 2.0 - See LICENSE file

About

Modular component for the odriveS1

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors