Using Pixhawk to control servos

Hi there,

I’m relatively new to the Pixhawk community so I’m prone to making some mistakes, please bear with me.

I recently joined a company where, long story short, we’re trying to use a pixhawk to fly a drone with a setup that’s similar to that of a multicopter (4X to be precise). However, the motors’ speed is set by another entity. I’m trying to use the Pixhawk to emulate yaw, pitch and roll using servos attached to said rotors.

My idea at first was to use a mixer set for helicopters, as I found the multicopter one to be too restrictive. However I run into multiple issues:

If I wanna set a roll, pitch or yaw, I’m trying to combine the action of the PixHawk on 4 different servos, my mixer should look like something like this:
M:1
O: 0 10000 0 -10000 10000
M:2
O: 0 10000 0 -10000 10000
M:3
O: “”"""
M:4
O: “”"""""
S: 0 X={0,1,2} 10000 10000 0 -10000 10000
but then i can’t actually dissociate the moment when I want to go right, and the moment I want to go left

Secondly, is it possible to “trick” the Pixhawk and use its ESC commands for servos? Cause even though I’m not using in theory the right activator (motor instead of servo) i’m still manipulating the same stuff?

If the community could be so kind to help me on this one, I’d be very grateful.

Hi,

There is little difference between ESC and Servo control from the point of view of the Pixhawk. The ESC usually run at a different PWM rate that the Servo (set the correct rate with the PWM_RATE parameter), also the PWM range can vary between ESC and Servo. However your mixer seem a bit strange, maybe having more information on how your servos affect the flight would help.

Hi,
First of all, thank se for pointing out the PWM issue that I forgot about.
The thing is, instead of using varying speeds for the motors , the servos are actually the one controlling each rotor’s inclination. The multicopter being a 4X, if I want to control my roll, 2 of the motors have to have the same control, whereas the opposite 2 have to have the opposite control.
For example if I want to go right, I have to set rotors 1 and 4 on a positive inclination and rotors 2 and 3 on a negative one. That’s what I attempt to do with this mixer but it’s obviously wrong.
If you have any idea on how to fix this please let me know!
Thanks a lot,

I believe the 4x mixer could work out of the box (depending of servo rotation direction and lever arm). Check that at the servo semi-min (@ 1000 us) position the rotor is in min pitch and at it semi-max position (2000 us) the rotor is in max pitch.

Here’s a schematic point of view of the whole setup, if you’re interested in the product, it’s "SAB HPS3"http://www.sab-heli-division.de/produkte/hps-2-_-hps-3-rotorkoepfe/index.html
Basically the servo sets the blades’ inclination, I think you know the physics behind how it works.

I’m still trying to figure out if the 4x mixer can work out of the gate, but it seems to me that the 4x mixer would at the same time affect all 4 rotors, while I’m trying to figure out a 2 rotor solution for the movement, as in just tilting the blades of the front or back rotors to generate roll.

Thanks though for your constructive remarks!

One thing I also might have to forget, is that the rotor’s speed is set, so if the rotor is always set at a specific speed, the roll and the pitch are only controlled by servo inclination

Hi,

Yes this is what I had in mind. You are also correct that a roll command for the 4X configuration should affect all rotor. If, for you, only 2 rotor are affected by pitch or roll command there is a chance you are in the + configuration:

If you in either configuration and the variable pitch rotor systems is configure in a way where at PWM 0% the pitch of the blades is such as no lift is generated and at PWM 100% maximun lift is generated. I believe the configuration should work out of the box.

Thanks for your response,

Right now, the rotor’s pitch is controlled by another different entity, PWM setups do not apply on its pitch, that would be the next step.
By using the quadrotor-X config, I can actually manipulate the drone using manual commands, but can we do smth similar by just switching up the 3 in lines 4 and 7 in mixers/quad_x.main.mix with 0 in order to maintain the drone in a stable state?
I’m trying to see if the drone can automatically (it should be able to) recognize its state in terms of yaw, roll and pitch, and be able to put itself back in place. Do I write a whole application, or I can setup a stable state for the drone, test it by throwing it off balance and expect it to stabilize itself?
Thanks a lot

I don’t understand your setup, this doesn’t make much sense: lines 4 and 7 are of “Manual Passthroughs” for the main outputs 5 & 6. Normally, your rotors would be connected to main outputs 1, 2, 3 and 4.

I think the best way forward is for you to have a better and clear understanding of how “everything works” for a standard multicopter. Mixer are covered here:

You’ll find a architecture overview here:

I do understand that the setup is a bit complicated, I’ll just explain it differently.
The 4x multicopter has all 4 rotors rotating at the same speed, that speed is controlled by another entity that doesn’t communicate yet with the pixhawk. Think of it as a set quantity that can’t be altered.
However I can manipulate the multicopter around an equilibrium altitude set by that pitch. It’s because each rotor is equipped with blades which angle can change using said pixhawk. If I input a positive voltage, the blades change their angle, which allows for uplift around the rotor. If it’s negative, it produces downforce, and allows for the rotor to go down in comparison to the other 3.
That way I can recreate roll and pitch.

Now let’s imagine this rotor is to fly with wind around, or whatever that can alter the equilibrium around that altitude. I plan on using the pixhawk to be able to know its roll,pitch, and yaw angle, and correct them through a mixer. Is it feasible through a mixer? And if so, do I need to use the line S: 0 {0,1,2} (according to rotor) etc… to simply stabilize? Or do I need to write a whole application? Because I don’t think I need to.

Thanks a lot though

I understand how a variable pitch multi-copters function. What I am saying is that answering your question would be simply to explain how the mixers and the mc attitude controller works. So I suggest you read up on these subject.

However, I can say the mc attitude controller don’t support “downforce” so you would to need find a work around or re-implement some functions.