mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 06:53:33 +08:00
cleaned up
This commit is contained in:
@@ -1,8 +1,39 @@
|
|||||||
/*
|
/* Copyright (c) 2014 PX4 Development Team. All rights reserved.
|
||||||
* mc_att_control_base.cpp
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file mc_att_control_base.h
|
||||||
|
*
|
||||||
|
* @author Roman Bapst <bapstr@ethz.ch>
|
||||||
*
|
*
|
||||||
* Created on: Sep 25, 2014
|
|
||||||
* Author: roman
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mc_att_control_base.h"
|
#include "mc_att_control_base.h"
|
||||||
@@ -308,11 +339,9 @@ void MulticopterAttitudeControlBase::set_actuator_controls() {
|
|||||||
_actuators.control[1] = (isfinite(_att_control(1))) ? _att_control(1) : 0.0f;
|
_actuators.control[1] = (isfinite(_att_control(1))) ? _att_control(1) : 0.0f;
|
||||||
_actuators.control[2] = (isfinite(_att_control(2))) ? _att_control(2) : 0.0f;
|
_actuators.control[2] = (isfinite(_att_control(2))) ? _att_control(2) : 0.0f;
|
||||||
_actuators.control[3] = (isfinite(_thrust_sp)) ? _thrust_sp : 0.0f;
|
_actuators.control[3] = (isfinite(_thrust_sp)) ? _thrust_sp : 0.0f;
|
||||||
//_actuators.timestamp = hrt_absolute_time();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MulticopterAttitudeControlBase::set_attitude(const Eigen::Quaternion<double> attitude) {
|
void MulticopterAttitudeControlBase::set_attitude(const Eigen::Quaternion<double> attitude) {
|
||||||
// check if this is consistent !!!
|
|
||||||
math::Quaternion quat;
|
math::Quaternion quat;
|
||||||
quat(0) = (float)attitude.w();
|
quat(0) = (float)attitude.w();
|
||||||
quat(1) = (float)attitude.x();
|
quat(1) = (float)attitude.x();
|
||||||
@@ -336,7 +365,6 @@ void MulticopterAttitudeControlBase::set_attitude(const Eigen::Quaternion<double
|
|||||||
_v_att.R[2][2] = Rot(2,2);
|
_v_att.R[2][2] = Rot(2,2);
|
||||||
|
|
||||||
_v_att.R_valid = true;
|
_v_att.R_valid = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MulticopterAttitudeControlBase::set_attitude_rates(const Eigen::Vector3d& angular_rate) {
|
void MulticopterAttitudeControlBase::set_attitude_rates(const Eigen::Vector3d& angular_rate) {
|
||||||
@@ -344,7 +372,6 @@ void MulticopterAttitudeControlBase::set_attitude_rates(const Eigen::Vector3d& a
|
|||||||
_v_att.rollspeed = angular_rate(0);
|
_v_att.rollspeed = angular_rate(0);
|
||||||
_v_att.pitchspeed = angular_rate(1);
|
_v_att.pitchspeed = angular_rate(1);
|
||||||
_v_att.yawspeed = angular_rate(2);
|
_v_att.yawspeed = angular_rate(2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MulticopterAttitudeControlBase::set_attitude_reference(const Eigen::Vector4d& control_attitude_thrust_reference) {
|
void MulticopterAttitudeControlBase::set_attitude_reference(const Eigen::Vector4d& control_attitude_thrust_reference) {
|
||||||
@@ -365,7 +392,6 @@ void MulticopterAttitudeControlBase::set_attitude_reference(const Eigen::Vector4
|
|||||||
_v_att_sp.R_body[0][2] = Rot_sp(0,2);
|
_v_att_sp.R_body[0][2] = Rot_sp(0,2);
|
||||||
_v_att_sp.R_body[1][2] = Rot_sp(1,2);
|
_v_att_sp.R_body[1][2] = Rot_sp(1,2);
|
||||||
_v_att_sp.R_body[2][2] = Rot_sp(2,2);
|
_v_att_sp.R_body[2][2] = Rot_sp(2,2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MulticopterAttitudeControlBase::get_mixer_input(Eigen::Vector4d& motor_inputs) {
|
void MulticopterAttitudeControlBase::get_mixer_input(Eigen::Vector4d& motor_inputs) {
|
||||||
|
|||||||
Reference in New Issue
Block a user