Patch for Custom Servo Cycle Mixer

More
03 Aug 2017 17:27 #63705 by rpangrazio
Patch for Custom Servo Cycle Mixer was created by rpangrazio
I created a mixer that will move a servo back and forth between the extremes (min-max-min-max....) proportional to the value from a given input.

I have some robotics projects that could use this, and I thought I would share. It's not complicated, but who knows.

File Attachment:

File Name: mypatch.txt
File Size:3 KB

File Attachment:

File Name: mypatch.txt
File Size:3 KB
Below is the patch file generated by git from a clean repo.

I've tested it on my 7e and on various emulators.
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Aug 2017 04:14 #63710 by mwm
Replied by mwm on topic Patch for Custom Servo Cycle Mixer
From looking at the patch, you can do this with the existing mixer types. No C code is needed. The basic idea is to generate a sawtooth wave on a virtual channel, then use that as a source for a mixer with a curve to get whatever shape you want. See www.deviationtx.com/forum/7-development/...rs-to-channels#13834 and following discussion for more information.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
04 Aug 2017 13:22 #63728 by rpangrazio
Replied by rpangrazio on topic Patch for Custom Servo Cycle Mixer
Cool. I'll look at that. I looked through the manual and didn't really see a way to do it, but I'll check that out.

Please Log in or Create an account to join the conversation.

More
04 Aug 2017 21:56 #63732 by mwm
Replied by mwm on topic Patch for Custom Servo Cycle Mixer
You won't find this in the manual. It's a reference guide, so all it documents is what the various settings do, not all the things you can build with them.

Unfortunately, there's not a single good "how to" guide anywhere. There's an introductory text at rc.mired.org/p/writing-deviationtx-model.html , but it doesn't get this advanced. The wiki is the right place for this stuff, but it didn't exist until 5.0, so is still both sparse and underutilized.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
05 Aug 2017 01:07 #63735 by rpangrazio
Replied by rpangrazio on topic Patch for Custom Servo Cycle Mixer
Now I don't feel so bad. I'm an embedded systems engineer, and this is my first computer rc transmitter and well as they say when all you have is a hammer all the world is a nail.

I hope you can point me in the right direction. I see how you have the two channels oscillating, but I am trying to make it to where the speed at which they oscillate is controlled by an input. I tried introducing several different mixers and just can't seem to get it right.

How would you do it? Is putting a delay the right strategy and I'm just not doing it right?

Please Log in or Create an account to join the conversation.

More
06 Aug 2017 04:03 #63745 by mwm
Replied by mwm on topic Patch for Custom Servo Cycle Mixer
Good. That's why I pointed out our problem.

I don't think you can change the speed. But I think you can get that effect by framing the problem differently.

Look at the up half of a sawtooth wave. If you vary the speed that it is traversed, you effectively change the slope, making it steeper where it's faster and shallower where it's slower. So you can get the output to change as if it were traveling the sawtooth faster by changing the curve. If you want fixed speed changes, use the cycling curve as the src for a mixer with the appropriate curve. You can use a complex mix to switch between curves based on inputs. If you want the speed to be from an analog input, follow it with a mix that has your input as src, and a mux type of mul. That isn't everything, but ought to get you started.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
06 Aug 2017 07:53 #63746 by FDR
Replied by FDR on topic Patch for Custom Servo Cycle Mixer
Doesn't the slope and the period as well depend on how much we increment it in every loop in the saw channel?
I think you can increase it by adding more, however it would work only in discrete steps...

Please Log in or Create an account to join the conversation.

More
06 Aug 2017 18:55 - 06 Aug 2017 19:59 #63751 by Wene001
Replied by Wene001 on topic Patch for Custom Servo Cycle Mixer
I am using a servotester with conrollable speed via poti AUX6 (Virt4-7) (Hit trainer switch to start)
On Virt 1-3 is a sawtooth with controllable speed and direction via AUX7
ThrX is a sticky throttle hold

Open Channel monitor and test it out :-)

name=Servotester
mixermode=Advanced
[radio]
protocol=DEVO
num_channels=8
fixed_id=123456
tx_power=10mW

[protocol_opts]
Telemetry=On

[channel1]
safetysw=Virt8
template=complex
[mixer]
src=ELE
dest=Ch1
[mixer]
src=AUX6
dest=Ch1
scalar=30
offset=70
usetrim=0
muxtype=multiply

[channel2]
template=simple
[mixer]
src=AIL
dest=Ch2

[channel3]
safetysw=Virt8
safetyval=-100
template=simple
[mixer]
src=THR
dest=Ch3

[channel4]
template=simple
[mixer]
src=RUD
dest=Ch4

[virtchan1]
name=Virt1
template=complex
[mixer]
src=AUX7
dest=Virt1
scalar=2
usetrim=0
muxtype=add
curvetype=3point
points=-50,0,50
[mixer]
src=AIL
dest=Virt1
switch=Virt2
scalar=0
offset=-100
usetrim=0
curvetype=fixed
[mixer]
src=AIL
dest=Virt1
switch=Virt3
scalar=0
offset=100
usetrim=0
curvetype=fixed

[virtchan2]
template=complex
[mixer]
src=Virt1
dest=Virt2
offset=-101
usetrim=0
[mixer]
src=Virt2
dest=Virt2
usetrim=0
curvetype=min/max
points=0

[virtchan3]
template=complex
[mixer]
src=!Virt1
dest=Virt3
offset=-101
usetrim=0
[mixer]
src=Virt3
dest=Virt3
usetrim=0
curvetype=min/max
points=0

[virtchan4]
name=Virt4
template=complex
[mixer]
src=Virt5
dest=Virt4
scalar=2
usetrim=0
muxtype=add
curvetype=3point
points=-30,0,30

[virtchan5]
template=complex
[mixer]
src=AUX6
dest=Virt5
switch=Virt6
scalar=45
offset=55
usetrim=0
[mixer]
src=AUX6
dest=Virt5
switch=Virt7
scalar=-45
offset=-55
usetrim=0
[mixer]
src=HOLD1
dest=Virt5
switch=TRN1
usetrim=0
curvetype=fixed

[virtchan6]
name=Virt6
template=complex
[mixer]
src=!Virt4
dest=Virt6
offset=-100
usetrim=0
[mixer]
src=Virt6
dest=Virt6
usetrim=0
curvetype=min/max
points=0

[virtchan7]
template=complex
[mixer]
src=Virt4
dest=Virt7
offset=-101
usetrim=0
[mixer]
src=Virt7
dest=Virt7
usetrim=0
curvetype=min/max
points=0

[virtchan8]
name=ThrX
template=complex
[mixer]
src=!THR
dest=Virt8
scalar=-100
usetrim=0
muxtype=add
curvetype=zero/max
points=99
[mixer]
src=HOLD1
dest=Virt8
switch=HOLD1
usetrim=0

[virtchan9]
template=simple
[mixer]
src=AUX6
dest=Virt9
scalar=45
offset=55
curvetype=expo
points=0,0

[trim1]
src=LEFT_V
pos=TRIMLV+
neg=TRIMLV-
[trim2]
src=RIGHT_V
pos=TRIMRV+
neg=TRIMRV-
[trim3]
src=LEFT_H
pos=TRIMLH+
neg=TRIMLH-
[trim4]
src=RIGHT_H
pos=TRIMRH+
neg=TRIMRH-
[timer2]
type=countdown
time=10
[datalog]
switch=None
rate=1 sec
[safety]
Auto=min
[gui-480x272]
V-trim=213,91,1
H-trim=86,236,3
V-trim=263,91,2
H-trim=271,236,4
Big-box=89,56,Virt9
Big-box=89,106,Virt4
Small-box=89,166,Timer2
Small-box=89,197,None
Bargraph=285,166,Ch1
Bargraph=315,166,Ch2
Bargraph=345,166,Ch3
Bargraph=375,166,Ch4
Model=286,56
Toggle=210,54,1,64,128,None
Toggle=248,54,2,65,129,None
Toggle=227,92,0,66,0,RUD DR
Toggle=227,131,0,67,0,AIL DR
Toggle=227,169,0,68,0,ELE DR
Toggle=227,208,8,71,0,None
quickpage1=Telemetry monitor
Last edit: 06 Aug 2017 19:59 by Wene001.

Please Log in or Create an account to join the conversation.

More
09 Aug 2017 01:00 #63763 by rpangrazio
Replied by rpangrazio on topic Patch for Custom Servo Cycle Mixer
I wanted to say thanks to everyone for all their help. I was able to get it going exactly the way I wanted.

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum