From e4bfd78847283491309328e54acc3ffdd4073712 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 2 Jan 2013 13:29:33 -0800 Subject: [PATCH 1/2] Attention: flipped the yaw direction of multirotors in order to be compatible to APM --- apps/systemlib/mixer/mixer_multirotor.cpp | 75 +++++++++++------------ apps/systemlib/mixer/multi_tables | 4 +- 2 files changed, 38 insertions(+), 41 deletions(-) diff --git a/apps/systemlib/mixer/mixer_multirotor.cpp b/apps/systemlib/mixer/mixer_multirotor.cpp index b5b25e5320..e293b1a2f8 100644 --- a/apps/systemlib/mixer/mixer_multirotor.cpp +++ b/apps/systemlib/mixer/mixer_multirotor.cpp @@ -54,9 +54,6 @@ #include "mixer.h" -#define CW (-1.0f) -#define CCW (1.0f) - namespace { @@ -64,52 +61,52 @@ namespace * These tables automatically generated by multi_tables - do not edit. */ const MultirotorMixer::Rotor _config_quad_x[] = { - { -0.707107, 0.707107, -1.00 }, - { 0.707107, -0.707107, -1.00 }, - { 0.707107, 0.707107, 1.00 }, - { -0.707107, -0.707107, 1.00 }, + { -0.707107, 0.707107, 1.00 }, + { 0.707107, -0.707107, 1.00 }, + { 0.707107, 0.707107, -1.00 }, + { -0.707107, -0.707107, -1.00 }, }; const MultirotorMixer::Rotor _config_quad_plus[] = { - { -1.000000, 0.000000, -1.00 }, - { 1.000000, 0.000000, -1.00 }, - { 0.000000, 1.000000, 1.00 }, - { -0.000000, -1.000000, 1.00 }, + { -1.000000, 0.000000, 1.00 }, + { 1.000000, 0.000000, 1.00 }, + { 0.000000, 1.000000, -1.00 }, + { -0.000000, -1.000000, -1.00 }, }; const MultirotorMixer::Rotor _config_hex_x[] = { - { -1.000000, 0.000000, 1.00 }, - { 1.000000, 0.000000, -1.00 }, - { 0.500000, 0.866025, 1.00 }, - { -0.500000, -0.866025, -1.00 }, - { -0.500000, 0.866025, -1.00 }, - { 0.500000, -0.866025, 1.00 }, + { -1.000000, 0.000000, -1.00 }, + { 1.000000, 0.000000, 1.00 }, + { 0.500000, 0.866025, -1.00 }, + { -0.500000, -0.866025, 1.00 }, + { -0.500000, 0.866025, 1.00 }, + { 0.500000, -0.866025, -1.00 }, }; const MultirotorMixer::Rotor _config_hex_plus[] = { - { 0.000000, 1.000000, 1.00 }, - { -0.000000, -1.000000, -1.00 }, - { 0.866025, -0.500000, 1.00 }, - { -0.866025, 0.500000, -1.00 }, - { 0.866025, 0.500000, -1.00 }, - { -0.866025, -0.500000, 1.00 }, + { 0.000000, 1.000000, -1.00 }, + { -0.000000, -1.000000, 1.00 }, + { 0.866025, -0.500000, -1.00 }, + { -0.866025, 0.500000, 1.00 }, + { 0.866025, 0.500000, 1.00 }, + { -0.866025, -0.500000, -1.00 }, }; const MultirotorMixer::Rotor _config_octa_x[] = { - { -0.382683, 0.923880, 1.00 }, - { 0.382683, -0.923880, 1.00 }, - { -0.923880, 0.382683, -1.00 }, - { -0.382683, -0.923880, -1.00 }, - { 0.382683, 0.923880, -1.00 }, - { 0.923880, -0.382683, -1.00 }, - { 0.923880, 0.382683, 1.00 }, - { -0.923880, -0.382683, 1.00 }, + { -0.382683, 0.923880, -1.00 }, + { 0.382683, -0.923880, -1.00 }, + { -0.923880, 0.382683, 1.00 }, + { -0.382683, -0.923880, 1.00 }, + { 0.382683, 0.923880, 1.00 }, + { 0.923880, -0.382683, 1.00 }, + { 0.923880, 0.382683, -1.00 }, + { -0.923880, -0.382683, -1.00 }, }; const MultirotorMixer::Rotor _config_octa_plus[] = { - { 0.000000, 1.000000, 1.00 }, - { -0.000000, -1.000000, 1.00 }, - { -0.707107, 0.707107, -1.00 }, - { -0.707107, -0.707107, -1.00 }, - { 0.707107, 0.707107, -1.00 }, - { 0.707107, -0.707107, -1.00 }, - { 1.000000, 0.000000, 1.00 }, - { -1.000000, 0.000000, 1.00 }, + { 0.000000, 1.000000, -1.00 }, + { -0.000000, -1.000000, -1.00 }, + { -0.707107, 0.707107, 1.00 }, + { -0.707107, -0.707107, 1.00 }, + { 0.707107, 0.707107, 1.00 }, + { 0.707107, -0.707107, 1.00 }, + { 1.000000, 0.000000, -1.00 }, + { -1.000000, 0.000000, -1.00 }, }; const MultirotorMixer::Rotor *_config_index[MultirotorMixer::Geometry::MAX_GEOMETRY] = { &_config_quad_x[0], diff --git a/apps/systemlib/mixer/multi_tables b/apps/systemlib/mixer/multi_tables index 2c4a5abed9..f17ae30ca6 100755 --- a/apps/systemlib/mixer/multi_tables +++ b/apps/systemlib/mixer/multi_tables @@ -70,9 +70,9 @@ foreach table $tables { upvar #0 $table angles foreach {angle dir} $angles { if {$dir == "CW"} { - set dd -1.0 - } else { set dd 1.0 + } else { + set dd -1.0 } factors $angle $dd } From e24dd0f684eb118a5052919c555d3e06ce8c569b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 7 Jan 2013 22:23:24 +0100 Subject: [PATCH 2/2] Fixed minor compile error --- apps/systemlib/mixer/mixer_multirotor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/systemlib/mixer/mixer_multirotor.cpp b/apps/systemlib/mixer/mixer_multirotor.cpp index 9090dcafe6..5fdc92c6a5 100644 --- a/apps/systemlib/mixer/mixer_multirotor.cpp +++ b/apps/systemlib/mixer/mixer_multirotor.cpp @@ -54,6 +54,11 @@ #include "mixer.h" +#define debug(fmt, args...) do { } while(0) +//#define debug(fmt, args...) do { printf("[mixer] " fmt "\n", ##args); } while(0) +//#include +//#define debug(fmt, args...) lib_lowprintf(fmt "\n", ##args) + /* * Clockwise: 1 * Counter-clockwise: -1