/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include "okapi/api/control/async/asyncVelocityController.hpp" #include "okapi/api/control/async/asyncWrapper.hpp" #include "okapi/api/control/controllerInput.hpp" #include "okapi/api/control/controllerOutput.hpp" #include "okapi/api/control/iterative/iterativeVelPidController.hpp" #include "okapi/api/util/timeUtil.hpp" #include namespace okapi { class AsyncVelPIDController : public AsyncWrapper, public AsyncVelocityController { public: /** * An async velocity PID controller. * * @param iinput The controller input. * @param ioutput The controller output. * @param itimeUtil The TimeUtil. * @param ikP The proportional gain. * @param ikD The derivative gain. * @param ikF The feed-forward gain. * @param ikSF A feed-forward gain to counteract static friction. * @param ivelMath The VelMath used for calculating velocity. * @param iratio Any external gear ratio. * @param iderivativeFilter The derivative filter. */ AsyncVelPIDController( const std::shared_ptr> &iinput, const std::shared_ptr> &ioutput, const TimeUtil &itimeUtil, double ikP, double ikD, double ikF, double ikSF, std::unique_ptr ivelMath, double iratio = 1, std::unique_ptr iderivativeFilter = std::make_unique(), const std::shared_ptr &ilogger = Logger::getDefaultLogger()); /** * Set controller gains. * * @param igains The new gains. */ void setGains(const IterativeVelPIDController::Gains &igains); /** * Gets the current gains. * * @return The current gains. */ IterativeVelPIDController::Gains getGains() const; protected: std::shared_ptr internalController; }; } // namespace okapi