diff options
author | Julian Oes <joes@student.ethz.ch> | 2012-12-31 16:12:55 -0800 |
---|---|---|
committer | Julian Oes <joes@student.ethz.ch> | 2012-12-31 16:12:55 -0800 |
commit | 805c08815eb5d7a2b719be7f2371a7589e224590 (patch) | |
tree | 06edd8cd2dbfc4b08d25e9be54d7981af98178b1 /apps | |
parent | 8d1b1354e1bd83242369210bcde66b00acd68a67 (diff) | |
download | px4-firmware-805c08815eb5d7a2b719be7f2371a7589e224590.tar.gz px4-firmware-805c08815eb5d7a2b719be7f2371a7589e224590.tar.bz2 px4-firmware-805c08815eb5d7a2b719be7f2371a7589e224590.zip |
The multirotor mixer return 0 instead of the number of channels, my Hex is flying now (not reliably now, random flips
Diffstat (limited to 'apps')
-rw-r--r-- | apps/drivers/px4io/px4io.cpp | 6 | ||||
-rw-r--r-- | apps/systemlib/mixer/mixer_group.cpp | 2 | ||||
-rw-r--r-- | apps/systemlib/mixer/mixer_multirotor.cpp | 6 |
3 files changed, 10 insertions, 4 deletions
diff --git a/apps/drivers/px4io/px4io.cpp b/apps/drivers/px4io/px4io.cpp index 8001f1ff6..f24beaf53 100644 --- a/apps/drivers/px4io/px4io.cpp +++ b/apps/drivers/px4io/px4io.cpp @@ -587,9 +587,9 @@ PX4IO::io_send() cmd.f2i_magic = F2I_MAGIC; /* set outputs */ - for (unsigned i = 0; i < _max_actuators; i++) - cmd.output_control[i] = _outputs.output[i]; - + for (unsigned i = 0; i < _max_actuators; i++) { + cmd.output_control[i] = (uint16_t)_outputs.output[i]; + } /* publish as we send */ _outputs.timestamp = hrt_absolute_time(); /* XXX needs to be based off post-mix values from the IO side */ diff --git a/apps/systemlib/mixer/mixer_group.cpp b/apps/systemlib/mixer/mixer_group.cpp index 9aeab1dcc..25d19f9ad 100644 --- a/apps/systemlib/mixer/mixer_group.cpp +++ b/apps/systemlib/mixer/mixer_group.cpp @@ -55,6 +55,8 @@ #define debug(fmt, args...) do { } while(0) //#define debug(fmt, args...) do { printf("[mixer] " fmt "\n", ##args); } while(0) +//#include <debug.h> +//#define debug(fmt, args...) lib_lowprintf(fmt "\n", ##args) MixerGroup::MixerGroup(ControlCallback control_cb, uintptr_t cb_handle) : Mixer(control_cb, cb_handle), diff --git a/apps/systemlib/mixer/mixer_multirotor.cpp b/apps/systemlib/mixer/mixer_multirotor.cpp index 3dd6dfcf7..cf9debe6c 100644 --- a/apps/systemlib/mixer/mixer_multirotor.cpp +++ b/apps/systemlib/mixer/mixer_multirotor.cpp @@ -56,6 +56,8 @@ #define debug(fmt, args...) do { } while(0) //#define debug(fmt, args...) do { printf("[mixer] " fmt "\n", ##args); } while(0) +//#include <debug.h> +//#define debug(fmt, args...) lib_lowprintf(fmt "\n", ##args) #define CW (-1.0f) #define CCW (1.0f) @@ -213,9 +215,11 @@ unsigned MultirotorMixer::mix(float *outputs, unsigned space) { float roll = get_control(0, 0) * _roll_scale; + //lib_lowprintf("roll: %d, get_control0: %d, %d\n", (int)(roll), (int)(get_control(0, 0)), (int)(_roll_scale)); float pitch = get_control(0, 1) * _pitch_scale; float yaw = get_control(0, 2) * _yaw_scale; float thrust = get_control(0, 3); + //lib_lowprintf("thrust: %d, get_control3: %d\n", (int)(thrust), (int)(get_control(0, 3))); float max = 0.0f; float fixup_scale; @@ -272,7 +276,7 @@ MultirotorMixer::mix(float *outputs, unsigned space) if (outputs[i] < _deadband) outputs[i] = _deadband; - return 0; + return _rotor_count; } void |