00001 /* 00002 * Copyright 2015 Fadri Furrer, ASL, ETH Zurich, Switzerland 00003 * Copyright 2015 Michael Burri, ASL, ETH Zurich, Switzerland 00004 * Copyright 2015 Mina Kamel, ASL, ETH Zurich, Switzerland 00005 * Copyright 2015 Janosch Nikolic, ASL, ETH Zurich, Switzerland 00006 * Copyright 2015 Markus Achtelik, ASL, ETH Zurich, Switzerland 00007 * 00008 * Licensed under the Apache License, Version 2.0 (the "License"); 00009 * you may not use this file except in compliance with the License. 00010 * You may obtain a copy of the License at 00011 * 00012 * http://www.apache.org/licenses/LICENSE-2.0 00013 00014 * Unless required by applicable law or agreed to in writing, software 00015 * distributed under the License is distributed on an "AS IS" BASIS, 00016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00017 * See the License for the specific language governing permissions and 00018 * limitations under the License. 00019 */ 00020 00021 #include "rotors_control/motor_controller.h" 00022 00023 MotorController::MotorController() { 00024 } 00025 00026 MotorController::~MotorController() { 00027 } 00028 00029 std::shared_ptr<ControllerBase> MotorController::Clone() { 00030 std::shared_ptr<ControllerBase> controller(new MotorController); 00031 return controller; 00032 } 00033 00034 void MotorController::InitializeParams() { 00035 amount_rotors_ = 6; 00036 initialized_params_ = true; 00037 } 00038 00039 void MotorController::CalculateRotorVelocities(Eigen::VectorXd* rotor_velocities) const { 00040 assert(rotor_velocities); 00041 assert(initialized_params_); 00042 00043 rotor_velocities->resize(amount_rotors_); 00044 00045 *rotor_velocities = motor_reference_; 00046 } 00047 00048 ROTORS_CONTROL_REGISTER_CONTROLLER(MotorController);