Skip to content

MotorController.cpp 余剰ゲイン算出部の正方向および負方向動作の不一致 #2

Description

@cuborex-admin

float MotorController::limitSpeed(){
if(!initialized_){
return -1.0;
}
float surplus; //Iゲイン自動整合用の余剰制御量を算出
surplus = speed_ - max_speed_;

// speed_ を範囲内に調整
if(speed_ > max_speed_){
speed_ = max_speed_;
//Serial.println("更新+: " + String(speed_));
return surplus;
}else if(speed_ < -max_speed_) {
speed_ = -max_speed_;
//Serial.println("更新-: " + String(speed_));
return surplus;
} else {
return 0.0;
}

}


surplus = speed_ - max_speed_;

正回転時はsurplusは記述の通りの計算となるが、逆回転時、

speed < 0となるため、

surplus = speed_ + max_speed_;

とならなければならない

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions