Pixhawk 2 custom mixer failure to output 8 pwm channels

I am trying to use a custom mixer that I wrote to control 8 PWM output channels. Based on code from the multicopter and helicopter modules I set the outputs in the mix function and I return 8.

In the px4io monitor command, I see the controls and it shows 8 outputs, but the last 4 never change. I have the PWM_OUT 12345678 set in the init.d config file.

I am obviously missing something. Any help would be appreciated

Thanks

Are you sure your custom mixer is using all 8? Anything else in your init script that might accidentally be calling a different config?

I’m having the same issue. Moving back to release 1.5.5 fixes it for me, so I think the problem must have been introduced between 1.5.5 and 1.6.0rc1. Can you confirm smgoza?

EDIT: ignore, wrong reply

I’m not sure why, but it looks like in the older stable release one of the other mag drivers fails to start, so the system only has 3 total and doesn’t hit this error.

So the extra mag driver is messing with the PWM outputs? Would disabling one of the three help?

Sorry, my response is completely wrong. I’m on my phone and only saw the truncated topic name and your comment. Thought it was a response to this other Pixhawk 2 issue I’ve been looking at. Pixhawk 2 mag calibration failure with here GPS module

I forked V1.5.2 on Dec 9, 2016 time frame. If I can figure out how to merge in the 1.5.5 update, I will be glad to try it. One other thing I’m going to try a little later when I have time is to run the octocopter and see if the outputs work like anticipated for an octo.

Here is my repo…

https://github.com/smgoza/Firmware/tree/feature/osprey

I’m using the 16002_osprey in init.d and the rotormast_osprey.main.mix. The mixer code is in mixer_v22_osprey.cpp with the class definition in mixer.h

Maybe someone can see something obvious and thanks for those who have replied so far.

Mike

Here is the init.d/16002_osprey file contents

set VEHICLE_TYPE mc
set MAV_TYPE 4
set MIXER rotormast_osprey
set PWM_OUT 12345678   
set PWM_RATE 50

Not sure if I need the MAV_TYPE 4. I’m going to try and remove that next

The mixer file has all my custom mixing stuff in it so it really won’t show anything.

Mike

Hi @smgoza,

Are you sure your custom mixer is updating those last 4 outputs?

Would it make more sense to treat the osprey like a tiltrotor VTOL instead of a helicopter?

That has always been the biggest problem with px4io. Since it is on the secondary processor, it makes it hard to decode. If I could find a good way to get diagnostics, then I could test better. I did put it on mixer_aux and could print data for all 8 outputs even though aux only supports 6.

I did try telling it to be an octo and did see 8 outputs change on the px4io monitor command, but that obviously does not use my mixer. Maybe something is not getting started? How would I know?

In terms of VTOL, the osprey is unique in that it can fly at various nacelle positions. All the docs I saw showed pixhawk only doing VTOL as a fast transition between the two. This osprey doesn’t need this to be fast, in fact slower might be better.

Maybe I should propose a more basic question… How should I set this up to run. Let’s say I want to call it a helicopter with 8 PWM outputs at 50Hz. What should the various config files look like? There are so many options it is hard to tell what to do.

PX4 VTOL basically hops between being a regular multicopter, and then a regular plane, with the vtol “controller” facilitating the transitions.

I think I’d need to take a step back and gain a better understanding of the Osprey in general, and then your particular model. It sounds like you have collective and cyclic pitch? How are the nacelles used other than straight forward and straight up?

The Rotormast Osprey model has collective and fore/aft cyclic on each rotor. In hover (ie nacelles pointed up), you have collective to control altitude, fore/aft to control fore/aft, differential fore/aft controls yaw and differential collective to control roll.

In forward flight (ie nacelles forward), differential collective controls yaw, differential fore/aft controls roll, fore/aft controls pitch, collective controls speed.

Adjusting the nacelle angle linearly mixes between the two. I’ve got all the mixing worked out.

At this stage, I would be overjoyed just to be able to hover in rate control manual mode and then eventually GPS position hold. Trying to get to that point has been more of an ordeal than I thought it should have been so any help is appreciated!

I found my problem. In px4iofirmware/mixer.cpp it turns out the mixer_text had a buffer limit of 200. I increased that to 300 and now it loads correctly. I currently have lots of options and exceeding the buffer caused it to fail creating the mixer class. As a side note, it did work for the aux mixer since that is using a different mixer.cpp file which added to the confusion.

Glad to hear it! Be careful with the IO, it’s apparently quite low on memory. https://github.com/PX4/Firmware/issues/7142

We’ve extended this to 230 bytes already. @dagar the low memory is mostly a v1.6 thing and will get fixed before the release.

@LorenzMeier does the low memory fix now mean we can extend “PX4IO_MAX_MIXER_LENGHT” beyond 230? Having similar problems with channels cutting out for large mixer files (4X for motors, + 4 elevons ->3 commands each)