You can control the ODrive directly from an hobby RC receiver.
Some GPIO pins can be used for PWM input, if they are not allocated to other functions. For example, you must disable the UART to use GPIO 1,2. See the pin function priorities for more detail.
Any of the numerical parameters that are writable from the ODrive Tool can be hooked up to a PWM input. As an example, we’ll configure GPIO4 to control the angle of axis 0. We want the axis to move within a range of -2 to 2 turns.
odrv0.axis0.controller.input_pos. If you need help with this follow the getting started guide.
In : odrv0.config.gpio4_pwm_mapping.min = -2 In : odrv0.config.gpio4_pwm_mapping.max = 2 In : odrv0.config.gpio4_pwm_mapping.endpoint = odrv0.axis0.controller._remote_attributes['input_pos']
Note: you can disable the input by setting
odrv0.config.gpio4_pwm_mapping.endpoint = None
In : odrv0.save_configuration() In : odrv0.reboot()
Be sure to setup the Failsafe feature on your RC Receiver so that if connection is lost between the remote and the receiver, the receiver outputs 0 for the velocity setpoint of both axes (or whatever is safest for your configuration). Also note that if the receiver turns off (loss of power, etc) or if the signal from the receiver to the ODrive is lost (wire comes unplugged, etc), the ODrive will continue the last commanded velocity setpoint. There is currently no timeout function in the ODrive for PWM inputs.