Lua interpreter in openTx
Re: Lua interpreter in openTx
It currently looks like it may not even be for sky9x unless someone wants to start playing hide and seek with flash bytes again...
-
- 9x Developer
- Posts: 2764
- Joined: Fri Dec 30, 2011 11:11 pm
- Country: -
Re: Lua interpreter in openTx
@Rob: would you allow .lua scripts to be attached on the forum?
-
- 9x Developer
- Posts: 2764
- Joined: Fri Dec 30, 2011 11:11 pm
- Country: -
Re: Lua interpreter in openTx
Example of use of LUA for a delta mix ...
The script: (it's only an example, not to be used for flying, a delta mix should not use LUA ...)
Bertrand.
The script: (it's only an example, not to be used for flying, a delta mix should not use LUA ...)
Bertrand.
- Rob Thomson
- Site Admin
- Posts: 4543
- Joined: Tue Dec 27, 2011 11:34 am
- Country: United Kingdom
- Location: Albury, Guildford
- Contact:
Re: Lua interpreter in openTx
Donebertrand35 wrote:@Rob: would you allow .lua scripts to be attached on the forum?
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
-
- 9x Developer
- Posts: 2764
- Joined: Fri Dec 30, 2011 11:11 pm
- Country: -
Re: Lua interpreter in openTx
For those who want to test, you have to checkout the "branches/lua" branch
- Rob Thomson
- Site Admin
- Posts: 4543
- Joined: Tue Dec 27, 2011 11:34 am
- Country: United Kingdom
- Location: Albury, Guildford
- Contact:
Re: Lua interpreter in openTx
Question - before I flash.
Will it automatically upgrade my epprom?
Sent from my GT-I9300 using Tapatalk 2
Will it automatically upgrade my epprom?
Sent from my GT-I9300 using Tapatalk 2
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
-
- 9x Developer
- Posts: 2764
- Joined: Fri Dec 30, 2011 11:11 pm
- Country: -
Re: Lua interpreter in openTx
No. This is an unstable branch. EEPROM will change again before going to trunk.
Re: Lua interpreter in openTx
This is awesome and really great to hear.
May I throw in some ideas for LUA functions?
* write access to telemetry screen
* read/write access to s.port data stream
With those 2, it shold be very easy to implement own telemetry functions. If it would be possible to add some kind of virtual screen, any additional data would be possible to transfer and display.
Any thoughts?
Best regards,
Marcus
May I throw in some ideas for LUA functions?
* write access to telemetry screen
* read/write access to s.port data stream
With those 2, it shold be very easy to implement own telemetry functions. If it would be possible to add some kind of virtual screen, any additional data would be possible to transfer and display.
Any thoughts?
Best regards,
Marcus
Re: Lua interpreter in openTx
So, how do those scripts work? I think I'm still missing some magic here.
How do they know what input and output and run functions are? Who calls them and when?
Where is getSourceValue() defined?
And I see awesomness in the input values. Can they be non-numeric though? (drop down to select tail type for example)
And can they be dynamic? (Like only ask for v-tail ratios if v-tail is selected.)
And, I can't find the code in the repo. There is lua stuff, but nothing in opentx.cpp.
My SVN is a bit rusty, svn update not enough to get that stuff?
Thanks bertrand35, I owe you a few beers. Or for you frogeaters that is whine, fine with me.
How do they know what input and output and run functions are? Who calls them and when?
Where is getSourceValue() defined?
And I see awesomness in the input values. Can they be non-numeric though? (drop down to select tail type for example)
And can they be dynamic? (Like only ask for v-tail ratios if v-tail is selected.)
And, I can't find the code in the repo. There is lua stuff, but nothing in opentx.cpp.
My SVN is a bit rusty, svn update not enough to get that stuff?
Thanks bertrand35, I owe you a few beers. Or for you frogeaters that is whine, fine with me.
Re: Lua interpreter in openTx
SVN I curse you!
svn checkout http://opentx.googlecode.com/svn/branches/lua opentx-read-only
Time to read up on the SVN git bridge before I go bugnutty
svn checkout http://opentx.googlecode.com/svn/branches/lua opentx-read-only
Time to read up on the SVN git bridge before I go bugnutty
Re: Lua interpreter in openTx
Ah, scriptnameInputs, scriptnameOutputs and scriptnameRun
Re: Lua interpreter in openTx
And I just had a look at the VALUES. It's numbers only.
I think for total world domination, two things are important.
A Setup function that can draw user input forms to ask more complex information. (Wizard driven, graphical, whatever) - Which is hard to do portable, and lua code would have to draw the menues which is perhaps overkill even if the base menu functions are used.
Or a input values definition that knows unions and ideally conditions. (Example, only ask for V-tail ratio when tail type v-tail is selected)
And secondly of course a persistent settings store. Serialising lua tables is quite easy. And more easy with added conditions like no hierarchy of tables and no function type values.
This settings store could be loaded in the global environment or so before the script is run.
I think for total world domination, two things are important.
A Setup function that can draw user input forms to ask more complex information. (Wizard driven, graphical, whatever) - Which is hard to do portable, and lua code would have to draw the menues which is perhaps overkill even if the base menu functions are used.
Or a input values definition that knows unions and ideally conditions. (Example, only ask for V-tail ratio when tail type v-tail is selected)
And secondly of course a persistent settings store. Serialising lua tables is quite easy. And more easy with added conditions like no hierarchy of tables and no function type values.
This settings store could be loaded in the global environment or so before the script is run.
Re: Lua interpreter in openTx
Am I doing anything wrong?
make simu PCB=TARANIS LUA=YES
I get no Scripts menu in the simulator.
make simu PCB=TARANIS LUA=YES
I get no Scripts menu in the simulator.
Re: Lua interpreter in openTx
PS: Addendum to my remarks about my 'one to rule them all' script idea.
I guess once I get that out of my head, we would be quite well served by having individual little scripts for certain functional parts. Like Delta Mix, V-Tail Mix, 4-servo Wing. Those individual bits would not have to be as dynamic setup wise as only the used components would be used.
Some plumbing will be required to put them together though. But that does not sound too scary.
I guess once I get that out of my head, we would be quite well served by having individual little scripts for certain functional parts. Like Delta Mix, V-Tail Mix, 4-servo Wing. Those individual bits would not have to be as dynamic setup wise as only the used components would be used.
Some plumbing will be required to put them together though. But that does not sound too scary.
- Rob Thomson
- Site Admin
- Posts: 4543
- Joined: Tue Dec 27, 2011 11:34 am
- Country: United Kingdom
- Location: Albury, Guildford
- Contact:
Re: Lua interpreter in openTx
This pictures on this post:
http://openrcforums.com/forum/viewtopic ... 127#p56127
Really show how it could be used.
I imagine it would be possible go define a type of model, but probably more flexible to have separate functions.
Now... One for Bertrand.
How do these in interact with flight phases?
Sent from my GT-I9300 using Tapatalk 2
http://openrcforums.com/forum/viewtopic ... 127#p56127
Really show how it could be used.
I imagine it would be possible go define a type of model, but probably more flexible to have separate functions.
Now... One for Bertrand.
How do these in interact with flight phases?
Sent from my GT-I9300 using Tapatalk 2
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
Re: Lua interpreter in openTx
Probably not intended to be dynamic yet, but sure not a bad idea.fireball wrote: * write access to telemetry screen
Well a few access methods for telemetry values already exist.fireball wrote: * read/write access to s.port data stream
Someone needs to do some time copying and pasting to implement them all.
That is not access to the data stream. But defined values can be read.
Re: Lua interpreter in openTx
So pardon the dumb question, as I am trying to wrap my head around what this enables.
am I correct in seeing the ability to basically write a mix (for example) that takes in any number of inputs, does some math on it, and returns 1 or more outputs?
As an aside, if that is the case, would trig & root functions either be supported or lookup tables in the script?
thanks
Greg
am I correct in seeing the ability to basically write a mix (for example) that takes in any number of inputs, does some math on it, and returns 1 or more outputs?
As an aside, if that is the case, would trig & root functions either be supported or lookup tables in the script?
thanks
Greg
Re: Lua interpreter in openTx
You'll be able to create functions with as many inputs and outputs as you want, and use all the library functions you'll find in the lua documentation
Sent via mobile
Sent via mobile
Re: Lua interpreter in openTx
interesting, is that the lua.org lua?
Re: Lua interpreter in openTx
so, what real use could we do with this in real RC model world apart from launching missiles and send satellites to orbit??
Why would I want to have this on my radio?
Thanks,
João
Why would I want to have this on my radio?
Thanks,
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
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
-
- Posts: 750
- Joined: Tue Dec 27, 2011 11:22 pm
- Country: United States
- Location: Carson City, Nv
Re: Lua interpreter in openTx
Yes please. I'm sorry to ask but I need a bit of guidance on this, even more than Joao....I can't even figure out how to use my missile to shoot down Joao's satellites!
Well on second thought, he probably has a Lua script protective screen around them. Drat, maybe I can dredge up a Perl script to kill it.
Well on second thought, he probably has a Lua script protective screen around them. Drat, maybe I can dredge up a Perl script to kill it.
Dean
OldDmbThms: 1. Takeoff, 2. Crash, 3. Repair, GOTO 1
OldDmbThms: 1. Takeoff, 2. Crash, 3. Repair, GOTO 1
Re: Lua interpreter in openTx
You would have to find them first..
I give you a little clue.. they are all around Lua
I give you a little clue.. they are all around Lua
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
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
Re: AW: Lua interpreter in openTx
Since I didn't try out the Lua branch yet: is it possible to start a script by Custom Switch?
Re: Lua interpreter in openTx
here is how I hope to use it. My toy of choice is RC battleships. for years I have wanted to implement the following
TX input sticks specify range and bearing to target.
software in TX does the proper coordinate transform for each turret based on its position relative to ship 0,0
curve fit the output of that to take care of mechanical differences/details to ensure each turret points to the correct position (both bearing and range)
currently I have a modified version of opentx running on my 9x (works very well, no noticable speed impact, requried adding integer sine/cosine/arcsine/arccos and using the sweet square root function already in opentx) . this works for 2 turrets (1 master 1 slave) and was simplified greatly by normalizing off the turret spacing distance... I plan to move to a taranis soon as it opens up so many possibilities. I was planning to add the code needed for more to the firmware but if I can script it instead and not have to compile anything (and more readily share with others) that is even better
I will have to download this branch and figure out how to play with the scripts in simu. Now I get to learn another language variant, yay
thanks
Greg
TX input sticks specify range and bearing to target.
software in TX does the proper coordinate transform for each turret based on its position relative to ship 0,0
curve fit the output of that to take care of mechanical differences/details to ensure each turret points to the correct position (both bearing and range)
currently I have a modified version of opentx running on my 9x (works very well, no noticable speed impact, requried adding integer sine/cosine/arcsine/arccos and using the sweet square root function already in opentx) . this works for 2 turrets (1 master 1 slave) and was simplified greatly by normalizing off the turret spacing distance... I plan to move to a taranis soon as it opens up so many possibilities. I was planning to add the code needed for more to the firmware but if I can script it instead and not have to compile anything (and more readily share with others) that is even better
I will have to download this branch and figure out how to play with the scripts in simu. Now I get to learn another language variant, yay
thanks
Greg
Re: Lua interpreter in openTx
Scripts run continously, on each cycle. Script outputs are however mapped to channels via usual mixer lines, to which you can of course assign a switch to activate or not.fireball wrote:Since I didn't try out the Lua branch yet: is it possible to start a script by Custom Switch?
Sent via mobile
Re: Lua interpreter in openTx
Random question. Would this allow the imperial units compile option to be obseleted on platforms that support LUA? Would a simple LUA script be simpler to convert units? it would also mean for vario's (for example) that don't provide an imperial output the LUA script could do the conversion
Re: Lua interpreter in openTx
There is already no more compile option on those platforms, just a choice in the radio settings.
Re: Lua interpreter in openTx
How does the Lua branch code differ from trunk?
I was just comparing the two and there are significant differences besides just the Lua changes.
I was just comparing the two and there are significant differences besides just the Lua changes.
-
- 9x Developer
- Posts: 2764
- Joined: Fri Dec 30, 2011 11:11 pm
- Country: -
Re: Lua interpreter in openTx
It will be a MAJOR release, with many differences:
- LUA interpreter added
- The Expo/DR screen will be replaced by an INPUTS screen far more powerful
- The curves system will be different (with any number of points from 2 to 17)
- The outputs will have the possibilty of a curve associated
- Many little enhancements
- LUA interpreter added
- The Expo/DR screen will be replaced by an INPUTS screen far more powerful
- The curves system will be different (with any number of points from 2 to 17)
- The outputs will have the possibilty of a curve associated
- Many little enhancements
Re: Lua interpreter in openTx
So the Lua branch will eventually become mainline? If that's the case then I will switch over to the Lua branch.
I have been a Lua developer for many years so this definitely interests me.
I have been a Lua developer for many years so this definitely interests me.