Creating new mixer model for Octo-H airframe

Hello,

I am trying to make an octo-H mixer model in ROMFS/px4mu_common/mixers according to Redirecting to latest version of document (main)

There seems to be no Multirotor mixer for the octo-H, and I failed to make one using the Summing mixers. Is there any way to make a new mixer model with different geometric configuration?

image

(picture of the drone crash due to wrong motor mixing btw)

Thank you, Kangmin Lee

Hello @kangmin7

Have you tried creating a new mixer geometry: https://github.com/PX4/PX4-Autopilot/tree/master/src/lib/mixer/MultirotorMixer/geometries

It should be fairly simple. You can call it octa_h with the key “8h”

If you have any issues let me know, I can support you with it.

@RicardoM17 Thank you very much for your help!

I have made the new octo-H geometry like this

[info]
key = “8H”
description = “Generic Octacopter in H configuration”

[rotor_default]
axis = [0.0, 0.0, -1.0]
Ct = 1.0
Cm = 0.05

[[rotors]]
name = “front_right”
position = [1.08, 0.543, 0.0]
direction = “CW”

[[rotors]]
name = “rear_left”
position = [-1.08, -0.543, 0.0]
direction = “CW”

[[rotors]]
name = “mid_front_right”
position = [0.36, 0.543, 0.0]
direction = “CCW”

[[rotors]]
name = “rear_right”
position = [-1.08, 0.543, 0.0]
direction = “CCW”

[[rotors]]
name = “front_left”
position = [1.08, -0.543, 0.0]
direction = “CCW”

[[rotors]]
name = “mid_rear_left”
position = [-0.36, -0.543, 0.0]
direction = “CCW”

[[rotors]]
name = “mid_front_left”
position = [0.36, -0.543, 0.0]
direction = “CW”

[[rotors]]
name = “mid_rear_right”
position = [-0.36, 0.543, 0.0]
direction = “CW”

The only confusing part was that I had to invert the y position of the rotors in this file order to match the rotor geometry in the sdf file.

I wrote

R: 8H

in the mixer file and

. ${R}etc/init.d/rc.mc_defaults
set MAV_TYPE 14
set MIXER octo_H

in the configuration file.

I added the file names of configuration, mixer, and mixer geometry (the one you told me) to the CMakeLists.txt, but I still got the following error:

ERROR [mixer_module] mixer load failed with -1
ERROR [mixer] failed to load mixers from etc/mixers/octo_H.main.mix
ERROR [mixer] failed to load mixer
ERROR [init] Failed loading mixer: etc/mixers/octo_H.main.mix

Is there something more to do in order to use the “8H” key?

does the mixer have the right name?

octo_H.main.mix

And you added both the mixer file and the new geometry to the respective CMakeLists?

geometry here:

and the mixer here:

You said you did but just making sure.

Because if not it looks all good:

EDIT: nevermind I believe your mixer needs to be like

R: 8H 10000 10000 10000 0

Also I would change all so it’s “8h” as per PX4 standards, but it should work like that.

@RicardoM17 Changing “8H” to “8h” made the error to disappear!

Now I have to just change the control gains for the octocopter

Thank you!

no problem @kangmin7 ! Glad I could help.

Please select the comment with the solution so that this post can be closed.

Hi @kangmin7 and @RicardoM17,

I am facing a similar issue. I am able to compile and launch the new custom airframe and mixer when I run without ROS. But when I run Px4 from ROS this gives the following issue:

With ROS

INFO  [px4] Creating symlink /home/user/catkin_ws/src/PX4-Autopilot/build/px4_sitl_default/etc -> /home/user/.ros/etc
...
Info: found model autostart file as SYS_AUTOSTART=6013
INFO  [param] selected parameter default file eeprom/parameters_6013
[param] Loaded: eeprom/parameters_6013
INFO  [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
INFO  [simulator] Waiting for simulator to accept connection on TCP port 4560
INFO  [simulator] Simulator connected on TCP port 4560.
INFO  [commander] LED: open /dev/led0 failed (22)
ERROR [mixer_module] mixer load failed with -1
ERROR [mixer] failed to load mixers from etc/mixers/dodeca_octo.main.mix
ERROR [mixer] failed to load mixer
ERROR  [init] Failed loading mixer: etc/mixers/dodeca_octo.main.mix

Without ROS

INFO  [px4] Creating symlink /home/user/catkin_ws/src/PX4-Autopilot/build/px4_sitl_default/etc -> /home/user/catkin_ws/src/PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/etc
...
Info: found model autostart file as SYS_AUTOSTART=6013
INFO  [param] selected parameter default file eeprom/parameters_6013
[param] Loaded: eeprom/parameters_6013
INFO  [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
INFO  [simulator] Waiting for simulator to accept connection on TCP port 4560
INFO  [simulator] Simulator connected on TCP port 4560.
INFO  [commander] LED: open /dev/led0 failed (22)
INFO  [init] Mixer: etc/mixers/dodeca_octo.main.mix on /dev/pwm_output0

I checked if the mixer file is missing in the symlink path but it is there.

This is how I am launching px4 node

<node name="sitl_$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find px4)/build/px4_sitl_default/etc -s etc/init.d-posix/rcS -i $(arg ID) $(arg px4_command_arg1)">
    </node>

Any thoughts on what I might be missing?

I am also having the same issue with the rotor ordering. You said you had to mirror the rotors position in the Y-axis right ?

SOLUTION: I forgot to catkin build px4 ! ups