Meadville Space Center
Welcome, Guest. Please login or register.
May 19, 2013, 01:21:59 AM

Login with username, password and session length
Search:     Advanced search
20010 Posts in 1929 Topics by 2250 Members
Latest Member: mikegk
* Home Help Search Login Register
+  Meadville Space Center
|-+  Project Apollo - NASSP
| |-+  Project Apollo - NASSP News & Discussion (Moderators: movieman, Tschachim, Swatch, lassombra)
| | |-+  AGC Decoder MFD made by Lua script
« previous next »
Pages: [1] 2 Print
Author Topic: AGC Decoder MFD made by Lua script  (Read 1991 times)
schneci
Project Team Member
Full Member
****
Posts: 31


View Profile
« on: June 11, 2012, 12:39:16 AM »

Hi,

I made a new MFD module which can decode AGC computer data (V16NXX monitor decimal in R1, R2 and R3) and convert for example SI units, and display the alarm codes and description of it (V05N09 display octal component 1, 2, 3 in R1, R2, R3). You can see the screen layout of MFD of prototype in attachment.

More interesting, however, that this script was written in Lua. I have extended the NASSP module by LUA API calls. I found a solution of the real-time debugging ways of it.

If someone is interested in this topic ask any question for details.

Best regards,

George


* MFD2.PNG (213.58 KB, 966x468 - viewed 219 times.)
« Last Edit: June 15, 2012, 03:17:42 PM by schneci » Logged
schneci
Project Team Member
Full Member
****
Posts: 31


View Profile
« Reply #1 on: August 07, 2012, 12:59:27 PM »

I put some information about my LUA developing environment following link:

http://web.t-online.hu/schneci1/

Please give me any notification if you have some problem regarding to installation, configuration, debug, etc.

Regards,

Schneci
Logged
High Core
Full Member
***
Posts: 15


View Profile
« Reply #2 on: September 03, 2012, 04:01:51 PM »

Hi Schneci, I was not able to download the MFD, gives error in the page.

Error: Not Found
The requested URL /AGCDECMFD.zip was not found on this server.

Rgrds

Jose
Logged
schneci
Project Team Member
Full Member
****
Posts: 31


View Profile
« Reply #3 on: September 14, 2012, 02:00:19 PM »

Hi Schneci, I was not able to download the MFD, gives error in the page.

Error: Not Found
The requested URL /AGCDECMFD.zip was not found on this server.

Rgrds

Jose

Hi Jose,

I put into the CVS the LUA API changes in source: saturn.cpp, saturn.h, connector.cpp, connector.h,

It has been a new MFD directory in Config directory which includes the AGCDECMFD.lua source.
Plese write if you have any problem this LUA environment.


PS: I repaired the download link. You can access the AGCDECMFD.zip file now, which includes the compiled binary files and lua source

Best regards

Schneci
« Last Edit: September 15, 2012, 05:06:16 AM by schneci » Logged
Tschachim
Project Apollo - NASSP
Administrator
Hero Member
****
Posts: 3687


nassp.sf.net


View Profile WWW
« Reply #4 on: September 18, 2012, 11:15:07 AM »

Hi Schneci,

thanks a lot for your efforts!  Happy

I'd like to play a little bit with the LUA stuff, but I have 2 remarks/requests at first:

You changed the VC2010 project files because of the LUA libs, which is fine. But you changed them only for debug configuration, not for release configureation, so that the affected projects don't link in debug configuration anymore. Could you fix that?

You reference this script in code:

luaL_dofile (L, "..\\A7\\luatest\\init.lua");

but I didn't find it neither in CVS nor in your download zip?

...and would you mind to add the remaining files of your work (i.e. lua scripts, cfg files etc.) to CVS, too?

Thanks in advance
Tschachim

Logged

schneci
Project Team Member
Full Member
****
Posts: 31


View Profile
« Reply #5 on: September 19, 2012, 05:10:02 AM »

Hi Schneci,

thanks a lot for your efforts!  Happy

I'd like to play a little bit with the LUA stuff, but I have 2 remarks/requests at first:

You changed the VC2010 project files because of the LUA libs, which is fine. But you changed them only for debug configuration, not for release configureation, so that the affected projects don't link in debug configuration anymore. Could you fix that?

You reference this script in code:

luaL_dofile (L, "..\\A7\\luatest\\init.lua");

but I didn't find it neither in CVS nor in your download zip?

...and would you mind to add the remaining files of your work (i.e. lua scripts, cfg files etc.) to CVS, too?

Thanks in advance
Tschachim



Hi Tschachim,

  • I have fixed the release configuration of VC2010 project files.
  • I have deleted the init.lua line from Lua_InitInterpreter method of saturn.cpp. It was only test purpose, I forgot delete it. Thank you for your attention

I already put the MFD and other init lua script into the CVS the following place. Please check it:


* config-mfd.PNG (37.15 KB, 778x319 - viewed 47 times.)

* lua-script.PNG (22.69 KB, 768x234 - viewed 35 times.)
Logged
Tschachim
Project Apollo - NASSP
Administrator
Hero Member
****
Posts: 3687


nassp.sf.net


View Profile WWW
« Reply #6 on: September 19, 2012, 06:33:48 AM »

Thanks, it builds fine now.  Thumbs Up

The added files are missing in CVS (see here: http://nassp.cvs.sourceforge.net/viewvc/nassp/projectApolloConfig/MFD/), because you need to do a "CVS Commit" of the directories with the added files (i.e. MFD and Script). After that's I should get it working.

To be honest, I'd like to refactor/rename the new functions a little bit, for example prefix the functions with "Lua_" / "LuaSaturn_" to make it clear that this are the Lua/Luahelper functions. Also I'd like to change for example "prog" to "pressprog", "inlink" to "uplink" and things like this to make it more clear what the functions do, no functional changes. I'm aware of that I need to change the lua scripts according to that.

But before I start to change your work, I'd like to ask if this is fine for you and/or if I just shall tell you what I'd like to have changed and you do it or if you don't want to have changed anything at all...  Happy

Cheers
Tschachim
Logged

schneci
Project Team Member
Full Member
****
Posts: 31


View Profile
« Reply #7 on: September 19, 2012, 10:44:41 AM »

Thanks, it builds fine now.  Thumbs Up

The added files are missing in CVS (see here: http://nassp.cvs.sourceforge.net/viewvc/nassp/projectApolloConfig/MFD/), because you need to do a "CVS Commit" of the directories with the added files (i.e. MFD and Script). After that's I should get it working.

To be honest, I'd like to refactor/rename the new functions a little bit, for example prefix the functions with "Lua_" / "LuaSaturn_" to make it clear that this are the Lua/Luahelper functions. Also I'd like to change for example "prog" to "pressprog", "inlink" to "uplink" and things like this to make it more clear what the functions do, no functional changes. I'm aware of that I need to change the lua scripts according to that.

But before I start to change your work, I'd like to ask if this is fine for you and/or if I just shall tell you what I'd like to have changed and you do it or if you don't want to have changed anything at all...  Happy

Cheers
Tschachim

Hi Tschachim,

I have issued the CVS commit and I think now you can see the MFD and Script directory.


Feel free to change the names, but let me know when you're done because I would like to update my site.

Best regards,

Schneci
Logged
Tschachim
Project Apollo - NASSP
Administrator
Hero Member
****
Posts: 3687


nassp.sf.net


View Profile WWW
« Reply #8 on: October 04, 2012, 01:02:51 PM »

I almost got it running, but it looks like I'm missing the "bit" module:

Lua syntax error: Config/MFD/AGCDECMFD.lua:5: module 'bit' not found:
    no field package.preload['bit']
    no file '.\bit.lua'
    ...

I tried it with the lua.dll from http://code.google.com/p/luaforwindows/ in my Orbiter root folder, but no luck:

Lua syntax error: error loading module 'bit' from file '.\bit.dll':

...so I'd need some advice...  Happy

Cheers
Tschachim
Logged

schneci
Project Team Member
Full Member
****
Posts: 31


View Profile
« Reply #9 on: October 06, 2012, 09:43:08 AM »

I almost got it running, but it looks like I'm missing the "bit" module:

Lua syntax error: Config/MFD/AGCDECMFD.lua:5: module 'bit' not found:
    no field package.preload['bit']
    no file '.\bit.lua'
    ...

I tried it with the lua.dll from http://code.google.com/p/luaforwindows/ in my Orbiter root folder, but no luck:

Lua syntax error: error loading module 'bit' from file '.\bit.dll':

...so I'd need some advice...  Happy

Cheers
Tschachim


Hi Tschachim,

Try to copy to Orbiter root directory the following items from "Program Files\Lua\5.1\" directory:

"clibs\mime" full directory
"clibs\socket" full directory
"lua\socket\" full directory
"lua\mime.lua" file
"lua\socket.lua" file
"clibs\bit.dll" file  (it is used by bit mask functions)

above items are used by remote debugger only.

I hope after this it will work fine.

Cheers
Schneci
« Last Edit: October 16, 2012, 12:24:16 PM by schneci » Logged
Tschachim
Project Apollo - NASSP
Administrator
Hero Member
****
Posts: 3687


nassp.sf.net


View Profile WWW
« Reply #10 on: October 20, 2012, 06:24:33 PM »

I got it working, bit.dll and lua51.dll from http://code.google.com/p/luaforwindows/ need to be in the Orbiter root folder. I'll include both files in the next beta.

I did the following changes:

  • geterasable is renamed to get_agcerasable
  • inlink is renamed to set_agcerasable
  • isuplink is renamed to get_agcuplinkstatus
  • getchannel to renamed to get_agcchannel

Arguments, returns and functionality are the same. I changed AGCDECMFD.lua according to that (and removed the hardcoded paths and vessel name).

I introduced a couple of new functions:

  • set_panelswitch(name, state) sets the switch by name
  • get_panelswitch(name) returns the state of a switch
  • set_panelswitch_flashing(name, flash) enables/disables the flashing yellow border to highlight a switch
  • get_panelswitch_flashing(name) returns if a switch is highlighted that way

In the attached screenshot "lua1" the SC CONT switch is toggled and then highlighted via Lua terminal as an example.
These functions do the same as they do when controlled by ProjectApolloChecklistMFD, so you can control and highlight pretty much every switch on the CSM panels.
"prog" is now set_panelswitch("DskySwitchProg", 1), "switch(state)" is set_panelswitch("ModeSwitch", state), so I removed them.

This way scripts can be written to toggle switches, for example to help people with the procedures.  Happy
As an example I attached a simple script doing the DSKY lamp test, lamptest.lua. When placed in the Script folder, it can be called with run("lamptest") in the Lua terminal, see "lua2" screenshot.

What we now would need is a list of all switch names, I won't have the time to do that (hint: they can all be found in Saturn::InitSwitches in saturnpanel.cpp  Wink), many of them occur in Doc\Project Apollo - NASSP\Checklists\Apollo 7 Checklists.xls or CSM Default Checklists.xls, which helps hopefully.

Thanks again for doing that, schneci, I always wanted to have Lua support and never had the time to do it.  Thumbs Up
If my changes are fine for you, I'd like to do a wiki page similar to your page for documenation.

Cheers
Tschachim


* lua1.PNG (125.94 KB, 793x445 - viewed 56 times.)
* lamptest.lua (0.25 KB - downloaded 10 times.)

* lua2.PNG (146.91 KB, 920x467 - viewed 54 times.)
Logged

schneci
Project Team Member
Full Member
****
Posts: 31


View Profile
« Reply #11 on: October 24, 2012, 03:00:05 PM »

Hi Tschahim

Thanks for your effort. It is fine. I have checked out your changes and I looked it. I think is this a good concept (new switch handle functions). Thumbs Up

You mentioned that, have to make a list of switch names. My question is, which purpose and what kind of format have to make it? If you will describe it, I will try to do it.

PS: I think you forgot to put lamptest.lua script into the Script cvs directory!

Best regards

Schneci
« Last Edit: October 25, 2012, 09:40:47 AM by schneci » Logged
Tschachim
Project Apollo - NASSP
Administrator
Hero Member
****
Posts: 3687


nassp.sf.net


View Profile WWW
« Reply #12 on: October 26, 2012, 01:51:34 PM »

PS: I think you forgot to put lamptest.lua script into the Script cvs directory!

While doing that, I also did some cleanup of the CVS repository. I removed the Script module and did a projectApolloScript module with checkout directory "Script" as all other modules work, too. To properly get the new module, please do the following:

- Rename your Script folder to e.g. "Script_old".
- Do a CVS Checkout of the module projectApolloScript in your Orbiter folder. You'll get a Script folder back.
- Copy the following files/folders from Script_old, i.e. the Orbiter script stuff except oapi_init.lua (Do _NOT_ copy or rename the Script_old folder itself):
    attctrl.lua
    Atlantis
    Challenges
    Demo
    Demos
    DG

- Delete the Script_old folder, done!

I moved my script to a ProjectApollo folder for all Project Apollo script and renamed it, so you need to type run("ProjectApollo/dsky_lamptest") to execute this script.
That's all for now, I'll post about the switch list later.

Cheers
Tschachim
Logged

schneci
Project Team Member
Full Member
****
Posts: 31


View Profile
« Reply #13 on: October 28, 2012, 02:10:40 PM »

PS: I think you forgot to put lamptest.lua script into the Script cvs directory!

While doing that, I also did some cleanup of the CVS repository. I removed the Script module and did a projectApolloScript module with checkout directory "Script" as all other modules work, too. To properly get the new module, please do the following:

- Rename your Script folder to e.g. "Script_old".
- Do a CVS Checkout of the module projectApolloScript in your Orbiter folder. You'll get a Script folder back.
- Copy the following files/folders from Script_old, i.e. the Orbiter script stuff except oapi_init.lua (Do _NOT_ copy or rename the Script_old folder itself):
    attctrl.lua
    Atlantis
    Challenges
    Demo
    Demos
    DG

- Delete the Script_old folder, done!

I moved my script to a ProjectApollo folder for all Project Apollo script and renamed it, so you need to type run("ProjectApollo/dsky_lamptest") to execute this script.
That's all for now, I'll post about the switch list later.

Cheers
Tschachim

Ok! I did it for based on your instructions.

Thanks
Schneci
« Last Edit: October 28, 2012, 02:13:27 PM by schneci » Logged
meik84
Project Team Member
Sr. Member
****
Posts: 299



View Profile
« Reply #14 on: November 07, 2012, 06:01:57 AM »

Erm...I can't compile modules since my last checkout. I get error messages like that:
Code:
2>saturn.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_lua_type" in Funktion ""public: int __thiscall Saturn::Lua_InitInstance(void *)" (?Lua_InitInstance@Saturn@@QAEHPAX@Z)".
(yes, my compiler speaks german! Wink)
Do I have to 'wire in' something? Confused
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!