Thread Tools
This thread is privately moderated by jfrickmann, who may elect to delete unwanted replies.
Feb 28, 2016, 08:44 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Do you have a github or other repository to store these? I'd like to submit a pull request for a change. I made a global for the "launch flight mode" value so that I could use a different value for the flight mode.

Why? Well, I have a program that I already use and am quite comfortable with however I'd like to use the telemetry screens. I've been reading the scripts and think I have everything working correctly in the simulator. I have one small problem. After hitting Ent after a task to save the info I was going through the task list and hit #5 (poker) and I'm now getting a script error on line 193 (I think it's 192 in the unmodified version):

local m = math.floor((1024 + getValue(pokerMinId)) / 205)

It's not likeing the getValue call. I'm on FW version 2.1.7.

Thoughts? This is the first time I've looked at a LUA script. Why couldn't they just have used JavaScript?! Would have been neat if it incorporated NodeJS!

Anyhow, if you do have a github account I'd like to fork your repo and submit a patch for the flight mode thing.

Thanks,

Mike G.

EDIT:

I looked up error handling in LUA. I tried making two calls using pcall to methods I made, getPokerMinutes and getPokerSeconds. This was enough for me to get the rounds started. However, after a few seconds into the round the script died again in another place where it was again trying to call the same getValue call that I mentioned above. It seems like pokerMinId and pokerSecId are not set (I think). Thoughts?
Last edited by mikejr83; Feb 28, 2016 at 08:55 PM.
Sign up now
to remove ads between posts
Feb 29, 2016, 08:22 PM
Jesper Frickmann
jfrickmann's Avatar
Thread OP
Hi Mike,

I do not have a GitHub account - I have posted everything here in RCG. But I think that we can figure out how to get the scripts to play with your radio program
First of all, are you using the latest version of the scripts? I changed a few things along the way to make it a little smarter with initializing things. So if you have not already done so, I recommend that you download the current version of the scripts from the first post in this thread.
As for the the flight mode, look for the following two lines of code in the background() function:
Code:
...
		-- Launch mode entered
		if (flightModeNew == 1 and flightMode ~= 1) then
...
		-- Launch mode left.
		if flightModeNew ~= 1 and flightMode == 1 then
...
The logic behind the code is that it saves the flight mode of the previous cycle and compares that to the flight mode of the current cycle. If it has changed to flight mode 1 (launch), or away from flight mode 1, then it takes the appropriate action. Have you substituted both the 1's in both the lines of code with the global variable (four 1's in total)?

The inputs for setting minutes and seconds in the Poker task are initialized by the following two lines of code in the init() function:
Code:
...
	pokerMinId = FindInputSource("Mins")
	pokerSecId = FindInputSource("Secs")
...
The FindInputSource() function is defined above in the script:
Code:
-- Find input source from name of input line
local function FindInputSource(lineName)
	local input, line, tbl
	for input = 0, 31 do
		for line = 0, model.getInputsCount(input) - 1 do
			tbl = model.getInput(input, line)
			if tbl.name == lineName then
				return tbl.source
			end
		end
	end
end  --  FindInputSource()
The function iterates through all of the lines of all the inputs in the radio program, and looks for a line with a matching name. Please notice that it is the name of the line and not the input that matters. Hence, the input lines must be named correctly in your radio program:



I agree with you that Lua is a bit corky in some ways, but it fits the hardware, and I guess it is free and was relatively easy for the openTX team to implement.
I have uploaded a new version with a global variable defining the launch flight mode. That is a good idea for others who also want to use the scripts with their own radio program.

Jesper
Last edited by jfrickmann; Feb 29, 2016 at 08:32 PM.
Feb 29, 2016, 08:39 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Ah, the input names! I downloaded the latest zip the other day.

I suggest setting up a GitHub account. Nice way to allow people to submit patches and version code.

I'll send you the updated code when I have it working.
Latest blog entry: Finished My Sbach 342!
Aug 20, 2016, 09:55 AM
Registered User

Aileron range at full flaperon


Hi Jesper, I really like your program but have an issue in that control with full flaperon is limited by only a few mm of aileron up available. All other control is good and accords with your setup notes. Do you have any suggestions please?
Thanks, Bruce
Aug 21, 2016, 06:44 AM
Jesper Frickmann
jfrickmann's Avatar
Thread OP
Thanks, I am glad that you like it! If you increase the AileTr global variable, that should do it.
Aug 21, 2016, 06:46 AM
Jesper Frickmann
jfrickmann's Avatar
Thread OP
---
Nov 29, 2016, 10:05 PM
Jesper Frickmann
jfrickmann's Avatar
Thread OP

Telemetry graph


I have added a third screen with a graph of telemetry data from the log file can be plotted.



I have also added curves for the aileron servos, so flap travel can be synchronized better.

Plus a number of minor improvements.
Nov 30, 2016, 03:57 AM
Have Fun and Just Fly!
l shems's Avatar
Nice!
Nov 30, 2016, 03:59 AM
Have Fun and Just Fly!
l shems's Avatar
Been thinking of this for some time as well. But wanted to remain compatible to 2.0.

Nice job.
Nov 30, 2016, 03:36 PM
Adam
xStatiCa's Avatar
That is a nice feature. I know loading data in the computer can take several seconds for a 4 MByte file. How long does it take the Taranis to crunch the data to display the graphs? It's CPU is certainly a lot slower.
Dec 01, 2016, 06:32 AM
Jesper Frickmann
jfrickmann's Avatar
Thread OP
Yes exactly. It is nice to view data in the field. For ~1 hour of data, it takes maybe 5 sec. to do the initial scan, indexing the file. Reading data for a flight takes a splitsecond. It refreshes data every 15 sec. or so.
Dec 01, 2016, 09:00 PM
Jesper Frickmann
jfrickmann's Avatar
Thread OP
I just updated the log file graph. The first version would always use zero for the min. scale; the new version has a more sophisticated scaling algorithm. Makes things like VSpd and RSSI nicer to look at. I also added a workaround to the bug that causes Companion to blow up, if there is no log file.
I hope to do some flying this weekend and get some data for some good screen shots.
Dec 17, 2016, 04:54 PM
Jesper Frickmann
jfrickmann's Avatar
Thread OP
I added a feature in the log graph so you can press MENU to view min., max. and launch altitude.

I also updated the documentation and moved it to a .PDF file included in the .ZIP for download, and rewrote post #1.
Dec 18, 2016, 02:23 AM
Registered User
Ndanger's Avatar
Very interesting to see the progress and the amazing features that are possible...
Dec 22, 2016, 01:24 PM
Jesper Frickmann
jfrickmann's Avatar
Thread OP

Organized telemetry sensors


I just did another little update. I set up two "calculated" sensors: "RBat" to be used for receiver volts, and "Alti" for altitude used internally by the program. That way, the sensors inside the program are not messed up when a new model is set up, and sensors are added. It also fixes the problem that older versions of OpenTX use "A1" for receiver battery volts, and newer versions use "RxBt". Much cleaner IMHO. I also updated the scripts and the documentation.

Today is a beautiful day here in Raleigh. Sunny, mild, and a little windy, with lots of energy in the air; both sink and lift. At the last flight of a 5x2 round, I had some good lift and decided to ride it out. Good fun


Quick Reply
Message:

Thread Tools