Commit Graph

152 Commits

Author SHA1 Message Date
Paul Guenette
b968a6735d Add function to remove anticogging bias 2023-03-07 21:59:50 -08:00
Paul Guenette
e88fa10978 Make vel_ramp safer by limiting the vel_setpoint to vel_limit 2022-09-22 00:28:44 -07:00
Oskar Weigl
6444197251 make input mode change trigger consistent with all sources 2022-05-05 13:40:07 -07:00
Torbjørn Ludvigsen
fa144cff29 Makes behavior consistent across interfaces
Defines and uses set_setpoint_to_estimate() reusable function
Uses it in three places:
 - axis.cpp to avoid transient on startup
 - can_simple.cpp to avoid sudden movement upon mode change
 - odrive-interface.yaml just to make it executable via USB and UART

Swaps set_input_pos() to set_input_pos_and_steps() so that we get the
same behavior when changing input_pos over USB and UART as we get when
we change it via CAN.
2022-05-05 11:11:01 +02:00
Torbjørn Ludvigsen
c5017f4baf Making circular_setpoints optional in step/dir mode
.. because circular_setpoints was broken beyond repair.
2022-05-04 16:30:30 +02:00
Torbjørn Ludvigsen
d272fbe2b4 Puts fmodf_pos back into the steps_ assignment 2022-04-07 15:10:25 +02:00
Torbjørn Ludvigsen
ae262e4cd1 Sets steps_ in CANSimple::set_input_pos_callback
... because otherwise, the effect of the callback is canceled by an
assignment in the main update() loop, that calculates input_pos
based on steps_, if we're in step/dir mode.

- Fixes a steps_ underflow/wrapping bug
2022-04-07 15:10:25 +02:00
Paul Guenette
f04f02aff7 Add input_xxx to the setpoints for autotuning 2021-12-01 17:41:00 -05:00
Aleksandr
31e601ebed Fix race condition in trap traj control 2021-11-02 15:23:42 +03:00
pbrier
ef03591379 Added integrator_limit to allow prevention of integrator windup 2021-09-16 10:06:07 +02:00
Samuel Sadok
d86a86a936 fix comments 2021-09-03 15:41:12 +02:00
Samuel Sadok
99713725ac Remove position setpoint reset during Motor::arm()
The position setpoint is already set before arming in start_closed_loop_control().

This fixes https://github.com/odriverobotics/ODrive/issues/599.
2021-09-01 20:19:54 +02:00
Paul Guenette
759c85c9e1 Rename current -> torque mode vel limit 2021-08-03 21:33:50 -04:00
Samuel Sadok
a37f6c3ba3 revert CAN protocol enum to flags, remove unused variables 2021-07-27 16:51:53 +02:00
Paul Guenette
1d958b9b7d Add measured_phase variable 2021-07-26 08:58:23 -04:00
Paul Guenette
a1338ac551 Input mode Tuning enhancements 2021-06-12 11:31:13 -04:00
PAJohnson
b707cd870f CAN baud rate setting fix, spinout detection improvements 2021-05-13 23:21:48 -04:00
PAJohnson
678c1c9c7e Spinout detection fixes - I^2 * R compensation 2021-05-12 21:39:48 -04:00
PAJohnson
427b7b4f11 Changed step and direction handling to always require circular positioning 2021-05-05 19:43:44 -04:00
PAJohnson
db5d952a08 Fixed step callback typo, moved input_pos = steps * turns_per_step to Controller::update() 2021-04-30 22:40:29 -04:00
Paul Guenette
83e09b73fc Add torque_mirror_ratio 2021-04-30 18:32:51 -04:00
Paul Guenette
f2eb40b5ef Add torque FF to axis mirroring 2021-04-30 18:25:03 -04:00
PAJohnson
2622f4d8eb Fixed spinout error reset on odrive.clear_errors() 2021-04-29 23:01:44 -04:00
PAJohnson
a7bed2074c Added spinout detection 2021-04-29 20:17:51 -04:00
Paul Guenette
6ff5e18c56 Update to devel 2021-01-10 15:04:50 -05:00
Paul Guenette
2f3caed851 Change how TUNING mode handles frequency, add last_error_time 2020-12-20 14:04:27 -05:00
Paul Guenette
a95b259f91 Increment axis.loop_counter in controller::update 2020-12-19 23:28:06 -05:00
Paul Guenette
a52ed93bb9 Add input_mode_tuning 2020-12-19 20:04:14 -05:00
Samuel Sadok
c32cbec58c rename some of the new functions and variables 2020-11-16 21:03:23 +01:00
Samuel Sadok
1f7815459f Merge branch 'devel' into control-loop-refactor 2020-11-03 18:34:08 +01:00
Paul Guenette
a428d08ecd Merge branch 'timing' into devel_fast 2020-10-30 21:26:31 -04:00
Samuel Sadok
7fd0806d49 introduce InputPort and OutputPort, don't use NAN
The InputPort/OutputPort infrastructure facilitates safer
data paths between components: OutputPorts store a value
and the age of the value measured in number of control loop
iterations. InputPorts can be connected to various sources,
for instance an OutputPort. InputPorts expose the values to
consumers in the form of std::optional to reflect the fact
that an InputPort can be dangling or connected to a stale
OutputPort.
2020-09-23 16:20:21 +02:00
Oskar Weigl
fb7d1d2961 change fabsf to std abs 2020-09-04 18:27:14 -07:00
Oskar Weigl
54636c764f implement faster fmodf related functions 2020-09-03 20:03:10 -07:00
Samuel Sadok
5661a3b5ed Refactor control loop.
Please see https://github.com/madcowswe/ODrive/issues/472 for a detailed description.
2020-09-01 00:03:01 +02:00
Unknown
2bb990937a Add TaskTimer class 2020-08-25 21:40:24 -04:00
Samuel Sadok
8d144bd944 Merge branch 'devel' into lowlevel-refactor 2020-08-05 16:28:17 +02:00
PAJohnson
8fcd5e1b30 Merge branch 'devel' of https://github.com/madcowswe/ODrive into counts_to_rads
Merge devel into counts_to_rads (turns) - conflict for the step input callback
2020-07-27 21:36:00 -04:00
PAJohnson
be2d1037e3 Fixed null pointer checks in controller.cpp
Fixed formatting in trapTraj.hpp
Fixed how pos_setpoint is set in axis.cpp to avoid transients on startup so that it will handle circular position setpoints
More unit corrections in the docs: radians -> turns
2020-07-27 21:26:41 -04:00
Unknown
88b3ed4260 Optimize step/dir callback 2020-07-26 16:16:10 -04:00
Oskar Weigl
97469235d7 Add _src to estimate pointers 2020-07-25 20:24:55 -07:00
Samuel Sadok
938f088fc2 make axis allocation static 2020-07-21 13:02:03 +02:00
PAJohnson
e1b1641d70 Changed from radians internally to units of "turns" where a full rotation is 1.0 turn
Changed documentation to reflect the unit change
2020-07-14 20:02:59 -04:00
PAJohnson
a2626889c5 Added pos_circular_ to Encoder for tracking position in a circular space
Corrected docs as they relate to unit changes
Added pos_estimate_linear and pos_estimate_circular to Controller and eliminated pointer switching logic in Controller::select_encoder()
2020-07-14 17:22:39 -04:00
PAJohnson
9d5b2bc6d8 Changed conditions and sources of wrapping for the circular setpoint feature as it related to this unit change. setpoints_in_cpr is still not exposed as an endpoint due to implementation changes when input_mode was introduced. 2020-07-13 23:31:57 +01:00
PAJohnson
aa79b7ebe0 Merge branch 'counts_to_rads' of https://github.com/madcowswe/ODrive into counts_to_rads 2020-07-13 21:05:41 +01:00
PAJohnson
7ce896c2ce In encoder.*pp, XXX_estimate -> XXX_estimate_counts and XXX_est_rad -> XXX_estimate.
Changed HWIL tests to reflect unit change
Corrected sources for position and velocity estimates elsewhere.
2020-07-13 20:59:35 +01:00
Oskar Weigl
4b01f54afb Revert "Un-removed custom setter for input_pos_"
This reverts commit 744bfeb110.
2020-07-11 15:43:07 -07:00
PAJohnson
744bfeb110 Un-removed custom setter for input_pos_
removed explicit casts where variables would be promoted anyway
2020-06-26 19:48:21 +01:00
PAJohnson
9faf46ad47 Changed from counts->radians internally. By default, input positions and velocities are also in radians.
Added multipliers for input pos/vel to allow users to define their own units for those inputs.
2020-06-25 21:39:20 +01:00