Have been thinking it through and came up with something like this:
(bear in mind, I havent actually got a maestro to test it on, not yet anyway…)
For output 0:
1 get position
#gets value of pot 1 (speed 0-1023, neutral is 512)
2 get position plus
adds value of pot 2 (steering 0-1023, neutral is 512)
#(both inputs neutral gives 512 plus 512=1024, possible range
#is between 0 (0 plus 0) and 2046 (1023+1023)
512 minus
#subtracts 512 (effectually changes reading of pot 2 to be +/-512 rather than +0 / +1023;
possible range is now from -512 to +1534, with both inputs neutral =512)
Max 0
#sets value to 0 or higher (if value is less than 0)
Min 1023
#sets value to 1023 or lower (if value is more than 1023)
4 Times 4000 Plus
#scales value to 4000-8092, approximately 1-2 ms
0 servo
#set servo #0 based to the value
And for output 1:
1 get position
#gets value of pot 1 (speed 0-1023, neutral is 512)
2 get position minus
#subtracts value of pot 2 (steering 0-1023, neutral is 512)
#both inputs neutral gives 512 minus 512=0, possible range is
#between -1023 (0 minus 1023) and +1023 (1023-0)
512 plus
#adds 512 (effectually changes reading of pot 2 to be +/-512 rather than +0 / +1023,
#possible range is now from -512 to +1535, with both inputs neutral =512)
Max 0
#sets value to 0 or higher (if value is between -512 and 0)
Min 1023
#sets value to 1023 or lower (if value is between 1023 and 1535)
4 Times 4000 Plus
#scales value to 4000-8092, approximately 1-2 ms
1 servo
#set servo #1 based to the value
Does it look like this would work? Is there a better/easier/more elegant way?
(I’m rather sure there is…)
Come to think of it, the number of lines might be reduced a bit, like this:
2 get position minus 512 plus (written on one line rather than two)
Could the arguments 0 max and 1023 min be combined on one line in the same way?