Use sticks not for servo position but for servo speed

Programing help and example for all firmwares based on thus's th9 firmware.
Post Reply
martinJhenne
Posts: 7
Joined: Sun May 13, 2012 6:48 pm
Country: -

Use sticks not for servo position but for servo speed

Post by martinJhenne »

Hi Folks,

normaly the stick position represents a servo position. For camera control i need something different:
The more you push the stick, the faster the servo should change its position. If the stick is back in neutral, the servo should keep its last position.

Is this possible with the firmware?


Thanks,
Martin

User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Use sticks not for servo position but for servo speed

Post by MikeB »

Try the following mixes on your camera channel (CH16 in thsi example)
+100% CH16
+2% RUD Switch SW1
R +100% FULL Switch SW2
R -100% FULL Switch SW3

SW1: |v|>ofs RUD 1
SW2: v>ofs CH16 100
SW3 v<ofs CH16 -100

First mix holds the channel
2nd mix adds a bit of the rudder stick in, more stick quicker moving.
3rd and 4th mixes stop the channel value going past 100%, otherwise it would and then would not move back immediately. (Limits stop the servo output, not the channel value)

SW1: detects when RUDder stick not centre
SW2 and SW3 detect the camera channel reaching full movement.

Play with the 2% in the second mix for different speed of movement. If it is too much, you will need to use another channel, e.g.
CH15: +20% RUD
then use CH15 instead of RUD in the 2nd mix. 2% of 20% is 0.4%.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Use sticks not for servo position but for servo speed

Post by Kilrah »

Awesome question!

I use that regularly for my gimbals, but since no radio could do that I designed a receiver-side module for it long ago... never thought about trying on the 9x now!

And yes it works! Here's my solution on open9x, assuming camera channel is CH1 and controlled by rudder stick:

Code: Select all

Custom Switches:
SW1: |v|>ofs RUD 1
SW2: |v|<ofs CH16 100

Mixers:
CH1:   +100%CH16
          +2%RUD Switch(SW1)
CH16: +100% CH1 Switch(SW2) Slow(u1:d1)
Attachments
Slew.eepe
(4.84 KiB) Downloaded 791 times
martinJhenne
Posts: 7
Joined: Sun May 13, 2012 6:48 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by martinJhenne »

Thank you so much Mike and Kilrah.
Such a quick reply an such amazing result - I'm impressed :-)

I knew the firmware could handle this ;-) EPIC.
daklein
Posts: 18
Joined: Sun Dec 30, 2012 9:52 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by daklein »

Great concept, thanks!

PoppyAnn
Posts: 19
Joined: Sun Aug 04, 2013 6:58 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by PoppyAnn »

Again many thanks Mike and Kilrah i am going to try the same mix for a bulldozer i have built out of lego.

regards Poppy Ann
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by nigelsheffield »

I just tried this on taranis, it works but at either end it bounces back and forth to 84 and 100 if I hold the stick at end and any time I let go it can be at anything from 84 to 99.
This was using kilrah s version
davx
Posts: 210
Joined: Sun Sep 15, 2013 7:01 am
Country: -

Re: Use sticks not for servo position but for servo speed

Post by davx »

Hi,

@nigelsheffield,
Just try the Mike version joined ;)

Rudder moves channel 10.

Bye
Attachments
Slew_Mike.eepe
(77.03 KiB) Downloaded 753 times
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by nigelsheffield »

Thanks, that worked fine in opentx.
on the taranis it is too fast, only the slightest of touches on the stick sends the servo to full deflection quite quickly and so very small movements are needed.
I will play about and see if I can make it work better.
Kirah version works at a nice pace.
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by nigelsheffield »

OK ,
I figured out a better version, based on Mikes,
this works much better on tx, looks very slow on opentx but where it matters on tx it is fine.
It does bounce a little at either end but only by .1% or so.
It uses another channel utulising 500 travel and mixing it down with 20%.
Slew.eepe
(76.03 KiB) Downloaded 3528 times
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by nigelsheffield »

I bet a lua script could do this though........
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Use sticks not for servo position but for servo speed

Post by MikeB »

I just tried this on eepe.

CH16:
+100% CH16
+2% RUD Switch SW1
R +100% FULL Switch SW2
R -100% FULL Switch SW3

CH15: +100% FULL Switch SW4 slow(u0:d1)


SW1: |v|>ofs RUD 1 AND SW4
SW2: v>ofs CH16 100
SW3 v<ofs CH16 -100
SW4 v<val CH15 98

Channel 15 and SW4 provide timing to limit the response on the Taranis.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Helle
Posts: 577
Joined: Sat Jul 21, 2012 7:08 am
Country: -

Re: Use sticks not for servo position but for servo speed

Post by Helle »

Hy,

you can combine it with a expo curve too for smoother reaction
User avatar
IdefixRC
Posts: 16
Joined: Sun Nov 23, 2014 2:00 pm
Country: -
Contact:

Re: Use sticks not for servo position but for servo speed

Post by IdefixRC »

Hi,

wanted to quickly post my configuration which is based on the ones above.

Background:
CH6 controls my Gimbal (Gimbal FW is set to position mode = gimbal will tilt and stop based on the position of the stick/side lever).
As this makes filming flyovers rather difficult due to the need to smoothly move the stick in accordance with the speed of the vehicle, I was looking for an option to toggle between both modes.

Thanks guys for providing the solution above (Mike, the last solution you posted above did not work for me as the movement is not smooth - it jumps in accordance with the steps due to the delay I believe).

Here is what I did:

CH6 = Gimbal Channel
SE Switch = Toggle between position and speed mode
LS Slider = used to tilt the camera

Mixes:

CH6 (CamTil)
LS Weight(+100%) Switch(!SE↓) NoTrim
CH16 Weight(+20%) Switch(SE↓) NoTrim

CH15
LS Weight(+30%) NoTrim

CH16
CH16 Weight(+100%)
CH15 Weight(+2%) Switch(L10)
R MAX Weight(+500%) Switch(L11)
R MAX Weight(-500%) Switch(L12)

Logical Switches
L10: |a|>x LS 1
L11: a>x CH6 100
L12: a<x CH6 -100

Change the weight in the CH15 mix to adjust the speed of the movement.

I hope this helps someone.
FPV, RC, 3D Printing and more..........
Link to my YouTube Channel: http://goo.gl/4HrjtR
Link to my Thingiverse Page: http://goo.gl/cayWH5
Almarza
Posts: 2
Joined: Sun Jan 28, 2018 11:16 am
Country: -

Re: Use sticks not for servo position but for servo speed

Post by Almarza »

Hello, can I program something like this direct on a taranis X9E with the original firmware?
I have some 1/87 scale models rc conversions, and this way to control a servo is perfect for cranes and excavators. Thanks in advance.
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Use sticks not for servo position but for servo speed

Post by Kilrah »

Yes.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Use sticks not for servo position but for servo speed

Post by jhsa »

I think he was asking how to do it as well? :)
I don't remenber how to, but I think Mike made an example a few years ago, but is was for Er9x/ErSky9x.. I think it should work the same in OpenTX.
I will look at some examples I have been gathering all over the years to see if I have this one. Unless Mike post it before of course.. :)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Use sticks not for servo position but for servo speed

Post by jhsa »

Ha,ha, ha :mrgreen: i didn't realize we are already in the right thread where Mike explained how to do it.. :D
I did a search, and it brought me exactly to this same thread :) ;)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
Almarza
Posts: 2
Joined: Sun Jan 28, 2018 11:16 am
Country: -

Re: Use sticks not for servo position but for servo speed

Post by Almarza »

Thank you very much, I have a very very limited space in my models. Normally I use planetary gear motors for almost all the movements I need, but this motors are very expensive and requires an extra ESC for motor(more space). Many times a cheap micro servo can do the work, but my problem is control that like a real machine. Here you can see my last crane truck over my X9E...
https://youtu.be/4j5C2Bn8CAw
User avatar
SR71
Posts: 109
Joined: Tue Feb 28, 2012 10:21 pm
Country: Italy
Location: Rome

Re: Use sticks not for servo position but for servo speed

Post by SR71 »

Almarza wrote: Tue Jun 05, 2018 4:22 pm Thank you very much, I have a very very limited space in my models. Normally I use planetary gear motors for almost all the movements I need, but this motors are very expensive and requires an extra ESC for motor(more space). Many times a cheap micro servo can do the work, but my problem is control that like a real machine. Here you can see my last crane truck over my X9E...
https://youtu.be/4j5C2Bn8CAw
OFF TOPIC
Almarza, let me say your truck is simply great !
/OFF TOPIC
mclags
Posts: 21
Joined: Thu Jun 07, 2018 11:43 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by mclags »

Hi all, I'm using this for pan tilt turret control on a build in doing.
Using the ail stick for pan and ele for tilt.

Basically I've just set it up as Mikes first post only in opentx.

Problem is that when the servo hits the end of its travel it goes nuts.

Setup as follows
Ch1 is ail stick for pan
(duplicate setup for ch2 on tilt but with logic switches 4,5,6)

Ch1 100
+= 1 Ail L01
+= 100 Ail L02
+= -100 Ail L03

L01 lal>x Ail 1
L02 a>x Ch1 100
L03 a<x Ch1 -100

What did I miss here?
ReSt
Posts: 1581
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by ReSt »

These two mixes must be of type "Replace", not "ADD"
+= 100 Ail L02
+= -100 Ail L03

Reinhard
mclags
Posts: 21
Joined: Thu Jun 07, 2018 11:43 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by mclags »

Awesome!
How do I change that?
ReSt
Posts: 1581
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by ReSt »

In the mixer setup there is the "Multiplex" selection with "ADD", "Multiply" and "Replace"

Select "Replace" and it will show the line with ":=" instead of "+="

Reinhard
mclags
Posts: 21
Joined: Thu Jun 07, 2018 11:43 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by mclags »

Brilliant! Thanks a bunch!
mclags
Posts: 21
Joined: Thu Jun 07, 2018 11:43 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by mclags »

Just changed the the adds to replaces.
Servo no longer goes crazy, but, now when it hits 100 either end it shoots back to centre ish. +-15
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Use sticks not for servo position but for servo speed

Post by Kilrah »

The replace mixes need to have MAX as source, you used Ail...
mclags
Posts: 21
Joined: Thu Jun 07, 2018 11:43 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by mclags »

Righto, I'll give that a bash shortly
Cheers
brus10000
Posts: 1
Joined: Tue Oct 12, 2021 3:07 pm
Country: -

Re: Use sticks not for servo position but for servo speed

Post by brus10000 »

Hello, I have applied all this to a robot arm and everything is fine except: one of the servos, when it rotates, returns to its axis slowly and the other problem is that I have an articulated arm on an axis with two servos, I mean, one goes invested in its movement with respect to the other, so, with this second problem, I don't know what parameters to introduce, could you help me?

Post Reply

Return to “er9x / gruvin9x / th9 based firmwares”