Where would I change vectored thrust mixing in the source code?

So it will model the thrust vectoring??? wow! thats impressive. thanks Pete…

David - thanks for the offer… Im going to be trying to figure out whats got to be changed on “tiltrotor.cpp” to do the following:

in MC mode - front 2 motors for yaw & pitch - aft motor for pitch control
in FW mode - front 2 motors for roll & pitch + diff thrust for yaw - aft motor for thrust only

Any ideas of code changes to make those features happen would be greatly appreciated.

The first priority is to get the aft motor to vector fore & aft for pitch control and assist position hold capabilities.

thank you very much!

Jeff

Currently there is no support for a tilting tail rotor, so you would need to add a new ServoChannel type for tiltMotorRear. I’ll check on where to do that. Then you assign a SERVOx_FUNCTION parameter to that new type value.

You be mostly interest in Plane/TiltRotor.cpp, look at the YawVectoredThrust method. There is where you would make changes to control the tail rotor tilt. I would suggest you just ignore the actual tilt angle changes for yaw on the tail rotor. Just let it tilt forward or back for transitions. I’ll dig a little deeper tonight. You should probably read through the code, it is well documented.

I don’t think arduplane uses motor tilt for pitch control in MC. I believe it’s treated like a regular tricopter/quad and motor speed causes a forward or back tilt of the airframe, just like a quad. I would like to see tilting for fore/aft movement (can’t really call it pitch) on at least the two front motors. That would give lots of control authority even if the tail rotor stayed at 90 degrees until a transition to foreward flight. Basically you could treat the tail rotor as a binary tilt motor, either up or down. It might make your life a lot easier :slight_smile: I’m afraid adding the tail tilt may be a good bit of work to get it right. Basic support should be easy, but the transition could get messy.

you can just us the normal tilt output, 41:MotorTilt

Thanks David and Pete,

I agree David that the aft motor tilting for pitch control would be tricky to dial in and making it a binary would be a lot easier.

FYI “Kris”, the guy in China that made these mods work (and wont release the source), made a new function for the tail motor(#45) that did assist in position control (see the youtube link on the OP).

I believe the #41 servo function only serves as yaw control in tricopter frames which would require a left/right tilt.

the fore/aft tilt of the rear motor serves to add a lot of ability of the airframe to stabilize itself in wind and hold position better. The previous build I used in the px4 source was a standard tricopter VTOL (called the “convergence” airframe where only the 2 front tilted for yaw control in MC) wasn’t very good at dealing with the wind.

the video makes it very evident how much control authority aft motor tilt adds in wind.

Jeff

its for motor tilt if you don’t have separate left and right, like this for example

Yaw only output is Motor 7 on tri-copters

I looked at using 41, but the tricopter code didn’t seem to use it the way I was thinking. Defining a TailRotorVerticalTilt motor may not be necessary. I’ll look into the coding more tonight. I only spent 3 minutes looking at TiltRotor.cpp. I have an Frsky Telemetry problem I have been working on for days. The _port.write() gets called, but no data goes out on the TX pins. Its bizarre.

I have wanted to build a big tri-copter or quad vtol, so I hope I learn a few more thing looking at the code.

Thanks for looking at it David… Ive been seeing a lot of issues with telemetry lately.

If you want to build a tri, i recommend them. I like the way they fly vs. a quad.

If you come up with anything you want me to try out, I have a test bed built so i can try it right away and get back to you with the results.

I looked at the code some more, and there is no control of forward/back movement by tilting the motors at all. I suspect this is because it was never in copter, and the copter code was used for most of the MR flight. The tiltrotor code mostly deals with transition.

I think that needs to be added first, expanding the tilting to the tail rotor also. I flew my convergence yesterday in a 25+ mph wind and while it did ok, I had to keep the nose pointed into the wind or it would lose position. I was in QSTABILIZE and the altitude control felt weird to me. That was my first flight with ardupilot so maybe QHOVER will be better. I’m get can’t intialize barometer messages, so either my barometer or the whole FC is bad. My last Matek F405-Wing burned up, so I’m looking for an alternative.

David,
thats what i was thinking, that there was no way for the code to mix in vectoring for movement (or position) control … I wonder if the transition code could do it … maybe have 2 transition states where stage 1 is MC flight with vectoring and stage 2 is the transition…

The px4 code does have a mixer but I never could add the aft motor tilt

I dont know if you watched the video but “Kris” had ONLY the aft motor tilting when the airframe was pitched (front 2 did only yaw control) and tied to his radio’s pitch control. I dont have any use for the alternative modes where different combinations of the motors run in FW mode)

The plane Im building is a 2 meter flying wing with about 6 lbs AUW so the more control authority the better. When I flew it with px4’s “convergence” frame code it was pretty unstable (I didnt tune it so thats on me). It did seem to be a lot more sluggish than ardupilot’s code.

Ive had a couple of FCs get sketchy on me too… in fact I bought one of the very first pixhawks from 3DR (back in 2014 i think) and it never did work right… too bad I didnt mess with it for 2 years after i bought it, i could have returned it.

thanks for your thoughts

Jeff

I translated some of the readme’s of “Kris’s” code documentation and I picked out some interesting things. the whole document is attached… its from a January firmware release.

Firmware Name: ArduPlane-20180502 (V3.9.0-DEV)
=============================================================readme.txt (36.4 KB)
note:
This new version of the firmware code changes quite a bit, from the old version to this version may have to adjust the parameters
Can fly, so it is recommended that novices do not use for the time being, let the friends who are familiar with PID first try.

  1. Synchronize the official code

    Fixed a bug where the tangential angle was incorrect when lotto_to_alt (circled up or down) left.

    Modify the default installation orientation for Here GPS’s ICM-20948 compass.
    Correction of the tailstock type transition from FBWA to QSTABILIZE throttle sometimes suddenly pulls down the bug.

  2. Vertical takeoff and landing (VTOL) optimization
    Replace the old multi-axis attitude control with a new position control algorithm.
    Use a new rate attitude controller during the transition (transition) (the transition is smoother / the height control is better)
    The horizontal position controller runs at full speed of 400hz (old 50hz)
    New L1 distance calculation method (turning will be smoother)

    .New / Transaction parameters
    Q_A_INPUT_TC (attitude control input time constant), the smaller the value, the larger the response, the larger the value, the smaller the response
    Example: Q_A_INPUT_TC=0.5 is very soft, 0.2 soft, 0.15, 0.1 fast, 0.05 very fast

    Speed ??gain doubled, Q_P_VELXY_P, Q_P_VELXY_I, Q_P_VELXY_D parameters may have to be adjusted (tune up)

    .Q_P_ANGLE_MAX Position controller angle limit (0-45 degrees), if set to 0, use Q_ANGLE_MAX

    Multi-axis QLOITER adds brake control, parameters: WPNAV_BRK_JERK, BRK_ACCEL and BRK_DELAY
    Tilt angle Q_WP_LOIT_ANGM (0-45), if set to 0, 70% angle of Q_ANGLE_MAX

  • Added conversion back to multi-axis throttle scaling parameter. If it is converted back to multi-axis, it will increase the value. For example, 60 (%)
    TILT_UP_THR=0 is disabled, 1~99 is throttle zoom%

    • Added low height assistance parameters:
      ASSIST_ALT=0.5 seconds below this height triggers the rescue (0=disable, 1~300=1m~300m)
      ASSIST_ALT_MOD=What mode is used to save the machine (0=disable, 17=QSTABILIZE,18=QHOVER,19=QLOITER,20=QLAND)
      Note: At least the flight must have exceeded ASSIST_ALT + 5 meters in fixed-wing mode, if not, it will not trigger.

There is another thread looking at the same thing, at least for the front rotors. Im trying to think of what needs to be added. Obviously elevator mixing. What about throttle compensation as the tilt angle increases? I also think rear tilt should be limited to prevent problems with backwards flight. Do we also disable the control surfaces in MR? I would like more input on that.

Control surfaces are active in VTOL modes, but their deflection is scaled down at low airspeeds. See https://github.com/ArduPilot/ardupilot/blob/master/ArduPlane/Attitude.cpp#L26

but note that this only works if you have an airspeed sensor.

David…
Im not sure about throttle mixing with tilt angle but I would think that would be a part of thrust vectoring. alternatively, would the gyros want to change thrust (maybe with an angular tilt limiter/expander) depending on what the airframe’s orientation is?

agreed on the liniting of the rear tilt.

i would think the control surfaces should function in MR to help with wind shifts while the plane is weathervaning.

thanks for the info Mark.

OK, I have performed a full translation of Kris’s code documentation to see if we can figure out how he made these mods to the code. Its interesting that he says he “Synchronized the official code” with each new update. It appears that he did not but I could be wrong.

The readme is attached.

Kris Translated notes.txt (188.6 KB) thanks

Jeff

Where does Kris’s notes come from? Is this the source that we do no have available? I think we can use the code from kd0aij and mix the elevator to a throttle channel for tilting elevator in MR. It should be possible to add the tailrotor to the existing tiltrotor.cpp or quadplane.cpp code, I just need to figure out how to do that the best way, plus figure out how to test it in sitl. I haven’t felt that great lately, having had both heart and lung surgery 3 months ago, but I will try to get to it before the end of the year. Just FYI, heart surgery was no really big deal, lung surgery sux!!!

A heart and lung surgery??? What the heck happened? I hope your recovery goes well… Once again thank you very much for looking at this.

As far as Kris’s notes, I think he wrote them… they are in chinese/taiwanese and included with each of his releases. The source code has not been made available despite Philip Rowse (developer of the Cube) employing some of his associates in China to contact Kris.

Ive just moved so my life is in boxed chaos and I will be reading through the translated notes to see what clues are there. I would suggest starting at his first notes… could show you where to start.

I wish I could help more but I have no clue how the firmware processes flight control.

Thanks again and please let me know if I can help you with your recovery at all.

Jeff

High blood pressure caused my aorta to rupture (I’m 55). I felt a sharp pain between my shoulder blades. After about 20 minutes I had my gf take me to the ER. They stuck me in a heli for a flight to a another hospital that handle bad cardiac cases, and they did surgery in time. But something went wrong during the aortic resection and my right lung was damaged. About a week later they removed 2/3s of it, and a week later went back in to fix a couple of issues with my lung. You don’t ever want lung surgery. They kept me a month and I lost 30-40 lbs!! I could barely walk when I got home. After 3 months I’m getting lots better, but stairs still kill me. I wrote this off-topic reply mostly as a warning to others, as you get older watch that blood pressure!! There are some serious complications. I had no idea my aorta could rupture. Never heard of that before, and usually if it happens the pressure just blows a hole out the side and you die quickly. I got really lucky and my aorta separated into layers and just leaked, but if I had not been flown to the surgeon I would likely not have made it in an ambulance.

I’ still studying the code and wishing for either good weather, or some place to cut foam about the size of an X8. I live in a condo and the isn’t any good place to work, but I really want to build a tricopter vtol, mostly just scaling up a convergence to 2 meters. I’m still debating tilting the tail rotor for forward flight. What are the advantages over using more powerful wing motors? Control in the wind? If that is the case should it tilt in all 4 directions?