Home › Forums › Everything about everything else › Triflight 0.7 Beta 2
Tagged: tail tune reverse servo
- This topic has 154 replies, 34 voices, and was last updated 6 years, 4 months ago by juanquy.
-
AuthorPosts
-
9 April, 2018 at 08:30 #57387Kevin_ErikModerator
It’s possible that the tailtune was interrupted in flight and had to start over several times. If it’s windy outside this is common. (easier to do it with auto leveling active) I have had valid tunes complete in less then 30 seconds and then some that take up to a minute on really windy days.
Note: Make sure that you’ve completed a valid bench tail-calibration before you attempt to do the in flight tailtune.
Also, if you are using an OSD with your video feed, then you should see a warning notification display that looks like 4 or 5 stars in the center of the screen. Keep in mind that this may or may not be shown depending on what your OSD settings are. Anyways, having it shown is a good way to verify the tune as often the copter can not be heard if its wandered away some.
9 April, 2018 at 09:35 #57388samp38ParticipantHi again,
Thank you for all these informations.
I’m sure the bench tuning is fine and I don’t think the wind is a problem (i tried many times indoor ans thé result us the same).
I’m afraid i’m not sure about the tones : what is the fail tone? And the success tone? I think I have the fail tone…
I will try tout reverse the servo internally today. (can i do it un the code by reversing the servoDirection function?9 April, 2018 at 09:46 #57389Kevin_ErikModeratorDavid’s video should have an example of the tones.
Silly question: I assume you have a buzzer attached?
Far as I know of you can reverse the Servo via the Betaflight Servo tab. Not tried it myself so I am not familiar with the specifics.
9 April, 2018 at 11:22 #57390samp38ParticipantYes I have a working buzzer attached 🙂
I reversed the servo with the following cli command : smix reverse 5 2 r which is the same as reversing it via the servo tab… I really think that I have to reverse it internally or mechanically. I will try today and let you know.Cheers,
Sam
9 April, 2018 at 11:25 #57391fomoco_44ParticipantTo reverse the servo in BF/TF you need to use the SMIX command in the CLI tab:
e.g. when using the TRI mixer to reverse the tail servo on a tricopter use this:
smix reverse 5 2 r
But I still don’t think it will work for you, as I could never get it to complete…..pretty sure there is something in the code preventing it.
What I meant by reversing the servo is to actually open it up and re-wire the motor and potentiometer….not easy.9 April, 2018 at 12:25 #57392samp38ParticipantYes it is what i was thinking about (rewiring the potentiometer) but it doesn’t seem doable. I tried to reverse the servoDirection function in servo.c. This way I don’t have to reverse the servo after flashing, it’s working the right direction out of the box, but Tail Tune still dosen’t complete.
Do you know if I can find the Omnibus F4 SD build of the 0.5 version?
Thanks
9 April, 2018 at 19:10 #57395Kevin_ErikModeratorYou maybe able to flip the PWM signal with the addition of a logic NOT circuit. (inverter) After all the PWM signal is really just a squarewave who’s length is variable.
https://www.electronics-tutorials.ws/boolean/bool_3.html
This will turn the positive going square-wave into a negative going one.However what you need is to change a long pulse-width into a short one and the short pulse-width into a long one ect. This would effectively flip the Servos direction. I’m sure there is something on the market capable of doing just that if your not able to do it via the CLI.
9 April, 2018 at 19:42 #57396samp38ParticipantI managed to complete a hover tail tune by changing the code of the 0.7 beta 2 version. I modified the line 388 if mixer_tricopter.c in the feedbackServoStep function from:
const int16_t currentAngle = ((endAngle – TRI_TAIL_SERVO_ANGLE_MID) * (ADCFeedback – midValue)
to
const int16_t currentAngle = ((endAngle – TRI_TAIL_SERVO_ANGLE_MID) * (-(ADCFeedback – midValue))
I did it in order to meet the condition line 505 of the same file :
if (averageServoAngle > 90.5f && averageServoAngle < 120.f)
This condition seemed to be the blocking condition of the tail tune success. I disabled it and looked at the resulting thrust_factor : -150.
I understood that, as the servo angle is reversed, the average angle is to be between 60° and 89.5° instead of 90.5° and 120°.
I’m not sure it’s the right way to get around the problem but the tail tune is ok (i get the right beeps codes) and the calculated thrust_factor is ok (141).I think there is a bug here : Tail Tune with a reversed servo is impossible with the original code because the calculated average angle is not in the [90..120] interval (line 505 of mixer_tricopter.c).
The copter flyes good (i will send a video soon) even though i encounter some yaw wagging at the end of rough yaw movements.
I don’t manage to do the same modification with the beta 3 version…
Cheers
9 April, 2018 at 22:15 #57398Kevin_ErikModeratorWould love for you to add your experience with the Yaw function As very few are currently involved. Most importantly, we’d need something to help mitigate Tailwag.
See: https://github.com/betaflight/betaflight/issues/5263
Also this is basic logic… If then do-this ect.
Could change it to…
if value > 60 and < 90 then run this function
Else
Run standard function ect
The danger here is that the script has no real way to know that the servo is working reversed. Hence a manfunctioning servo could also trigger the wrong part of the if-then statement resulting in a crash.
Keep in mind that’s it’s been years since I worked on any kinda script but the form and function is basically the same.
9 April, 2018 at 23:33 #57401samp38ParticipantI’m no expert in tail wagging but I encountered the same issue (stationary or under throttle wag) with 0.7 beta 3 version. My mod (reversing the sign of the current angle returned by the feedbackServoStep function) cured it but didn’t give me a complete tail tune. With the 0.7 beta 2 version I never had such wag like the copter is freaking out and i could complete the tail tune.
As for tail tune, are you sure that reversed servos are properly handled in the code?
I would go for something like that :
if(triGetServoDirection() == 1) {
manage tail tune with normal servo
}
else {
manage tail tune with reversed servo
}But the point is that some change must be done in the code. Obviously there is a unmanaged case here. Who is writing the code? Is it lauka?
🙂
10 April, 2018 at 01:29 #57402Kevin_ErikModeratorWell it was a rough example…
Last time I scripted I was modding Supreme Commander Forged Alliance.
Made new units, weapons, projectiles, effects and scripts to run it all.
Been a long time and i miss it.10 April, 2018 at 09:49 #57403samp38ParticipantWow impressive ! Sorry if I hurt you I’m sure you’re greater coder than me (I’m a quick&dirty one). What is your part in the Triflight project?
10 April, 2018 at 10:05 #57404laukaParticipantHave been really busy with other stuff recently, will resume this once the snows melt and have possibilities to do flight testing.
For reversed servos, the calculated servo angle should be the same as for non-reversed servo, doesn’t change the angles of the servo :).
So the problem is somewhere where the angle is calculated, in the beginning of the tricopter mixer logic. I’m quite sure that servo reversing was working at some point in time. Maybe the smix reverse command is not working anymore in the latest version?
Store the servo angle in the debug variables and observe the value in the configurator.
Please also do a blackbox log during the tail tune process, with set DEBUG_MODE=TRI.
10 April, 2018 at 10:06 #57405laukaParticipant@samp38: There has been many contributors to the Triflight code, check the release notes. Most of it is written by me. Help is always welcome, it doesn’t have to be only me who’s making the changes :).
10 April, 2018 at 13:40 #57407Kevin_ErikModeratorI am not a great coder by any means… just one that kept at it over several years of experimentation.
-
AuthorPosts
- The forum ‘Everything about everything else’ is closed to new topics and replies.