Files
ODrive/docs/input_modes.md
T
pjohnson ceabd24582 Made changes reflecting PR comments.
Added torque_ramp_rate to controller config.
Changed INPUT_MODE_CURRENT_RAMP to INPUT_MODE_TORQUE_RAMP for controller input mode enum.
Torque limits and current limits are now observed seperately. Torque limit is in the controller, current limit is in the motor object.
Fixed torque -> current calculation in motor_update to handle ACIM motors.
2020-06-17 13:15:36 -04:00

114 lines
3.2 KiB
Markdown

# Input Modes
As of version ###, ODrive now intercepts the incoming commands and can apply filters to them. The old protocol values `pos_setpoint`, `vel_setpoint`, and `current_setpoint` are still used internally by the closed-loop cascade control, but the user cannot write to them directly. This allows us to condense the number of ways the ODrive accepts motion commands. The new commands are:
* `<axis>.controller.config.input_mode`
* `<axis>.controller.input_pos`
* `<axis>.controller.input_vel`
* `<axis>.controller.input_torque`
The Input Modes currently valid are:
* `INPUT_MODE_INACTIVE`
* `INPUT_MODE_PASSTHROUGH`
* `INPUT_MODE_VEL_RAMP`
* `INPUT_MODE_POS_FILTER`
* `INPUT_MODE_MIX_CHANNELS`
* `INPUT_MODE_TRAP_TRAJ`
* `INPUT_MODE_TORQUE_RAMP`
* `INPUT_MODE_MIRROR`
---
## INPUT_MODE_INACTIVE
Disable inputs. Setpoints retain their last value.
## INPUT_MODE_PASSTHROUGH
Pass `input_xxx` through to `xxx_setpoint` directly.
### Valid Inputs:
* `input_pos`
* `input_vel`
* `input_torque`
### Valid Control modes:
* `CONTROL_MODE_VOLTAGE_CONTROL`
* `CONTROL_MODE_CURRENT_CONTROL`
* `CONTROL_MODE_VELOCITY_CONTROL`
* `CONTROL_MODE_POSITION_CONTROL`
## INPUT_MODE_VEL_RAMP
Ramps a velocity command from the current value to the target value.
### Configuration Values:
* `<axis>.controller.config.vel_ramp_rate` [cpr/sec]
* `<axis>.controller.config.inertia` [A/(count/s^2))]
### Valid inputs:
* `input_vel`
### Valid Control Modes:
* `CONTROL_MODE_VELOCITY_CONTROL`
## INPUT_MODE_POS_FILTER
Implements a 2nd order position tracking filter. Inteded for use with step/dir interface, but can also be used with position-only commands.
![POS Filter Response](secondOrderResponse.png)
Result of a step command from 1000 to 0
### Configuration Values:
* `<axis>.controller.config.input_filter_bandwidth`
* `<axis>.controller.config.inertia`
### Valid inputs:
* `input_pos`
### Valid Control modes:
* `CONTROL_MODE_POSITION_CONTROL`
## INPUT_MODE_MIX_CHANNELS
Not Implemented.
## INPUT_MODE_TRAP_TRAJ
Implementes an online trapezoidal trajectory planner.
![Trapezoidal Planner Response](TrapTrajPosVel.png)
### Configuration Values:
* `<axis>.trap_traj.config.vel_limit`
* `<axis>.trap_traj.config.accel_limit`
* `<axis>.trap_traj.config.decel_limit`
* `<axis>.controller.config.inertia`
### Valid Inputs:
* `input_pos`
### Valid Control Modes:
* `CONTROL_MODE_POSITION_CONTROL`
## INPUT_MODE_TORQUE_RAMP
Ramp a torque command from the current value to the target value.
### Configuration Values:
* `<axis>.controller.config.torque_ramp_rate`
### Valid Inputs:
* `input_torque`
### Valid Control Modes:
* `CONTROL_MODE_CURRENT_CONTROL`
## INPUT_MODE_MIRROR
Implements "electronic mirroring". This is like electronic camming, but you can only mirror exactly the movements of the other motor, according to a fixed ratio
[![](http://img.youtube.com/vi/D4_vBtyVVzM/0.jpg)](http://www.youtube.com/watch?v=D4_vBtyVVzM "Example Mirroring Video")
### Configuration Values
* `<axis>.controller.config.axis_to_mirror`
* `<axis>.controller.config.mirror_ratio`
### Valid Inputs
* None. Inputs are taken directly from the other axis encoder estimates
### Valid Control modes
* `CONTROL_MODE_POSITION_CONTROL`