mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-23 00:59:54 +08:00
make axis allocation static
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
Controller::Controller(Config_t& config) :
|
||||
config_(config)
|
||||
{
|
||||
bool Controller::apply_config() {
|
||||
config_.parent = this;
|
||||
update_filter_gains();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Controller::reset() {
|
||||
@@ -32,7 +32,7 @@ void Controller::input_pos_updated() {
|
||||
|
||||
bool Controller::select_encoder(size_t encoder_num) {
|
||||
if (encoder_num < AXIS_COUNT) {
|
||||
Axis* ax = axes[encoder_num];
|
||||
Axis* ax = &axes[encoder_num];
|
||||
if (config_.setpoints_in_cpr) {
|
||||
pos_estimate_src_ = &ax->encoder_.pos_cpr_;
|
||||
pos_wrap_src_ = &ax->encoder_.config_.cpr;
|
||||
@@ -181,8 +181,8 @@ bool Controller::update(float* torque_setpoint_output) {
|
||||
} break;
|
||||
case INPUT_MODE_MIRROR: {
|
||||
if (config_.axis_to_mirror < AXIS_COUNT) {
|
||||
pos_setpoint_ = axes[config_.axis_to_mirror]->encoder_.pos_estimate_ * config_.mirror_ratio;
|
||||
vel_setpoint_ = axes[config_.axis_to_mirror]->encoder_.vel_estimate_ * config_.mirror_ratio;
|
||||
pos_setpoint_ = axes[config_.axis_to_mirror].encoder_.pos_estimate_ * config_.mirror_ratio;
|
||||
vel_setpoint_ = axes[config_.axis_to_mirror].encoder_.vel_estimate_ * config_.mirror_ratio;
|
||||
} else {
|
||||
set_error(ERROR_INVALID_MIRROR_AXIS);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user