Dinesh
-
Posts
8 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by Dinesh
-
-
Hello, so I have been working with the OACSP library for a bit now and works just fine. But now, I want to eliminate that and send values to Arduino with fsuipc and lua script. The script seems to send data to Arduino and the Arduino does seem to receive data as the RX is blinking. But when I use an LCD screen to print the data it shows nothing. Could you please help me out here. The LCD screen I use is I2c interfaced, hence does not need the serial port to be available. Also randomly the data would start appearing on the screen. I am also logging the data using ipc.log and that data seems consistent. i have attached the Arduino code and lua script.
Thanking you
Dinesh
-
presently I couldn't find any software that connects p3d and Matlab. Is there a possibility of connecting p3d and Matlab using fsuipc? There is an option of connecting xplane with Matlab. What xplane does is send UDP packets of data to a specified IP address and Matlab can be the receiving IP and hence data can get transferred. This got me thinking if something similar to this is possible with p3d and Matlab.
-
I am trying to interface P3D and Matlab to create some control loops like phugoid control etc. I was thinking if the following idea would work
Run Matlab on a PC and P3D on another and then use LAN connection with wideFs to exchange data
Thanks in advance
Dinesh
-
Can you suggest any good text editor for LUA scripting? currently, I am using notepad and store it with UTF8 encoding
-
Hello, I am trying to extract variables from the P3DV4 and store them on a CSV. The given example works great for me. But when I try to write the code myself it doesn't work. Moreover, when I just copy paste the code with varied parameters I still get some error. I have attached the error below along with the code. Please do help me out.
CODE--------------------------------------------------------------------------------------------------------------------------------------------
-- "Record to CSV" example data logging LUA plug-in, by Pete Dowson, September 2008
-- Open an exisitng "FSrecord.csv" file to append to, or create it if it doesn't exist
-- It will go into the Modules folder because I've not included a full path (like "C:\....")
-- By using "assert" you get an error message if this failsf = assert(io.open("FSrecord.csv","a+"))
-- write the CSV column headings
f:write("\r\vs,mach,bank,BHP,ff,weight,alt,ias,tas,gs\n")-- note the elapsed mSecs count now so can provide relative mSec timing column
time0 = ipc.elapsedtime()-- Loop until our Flag 0 is set (by assigned FSUIPC control)
while not ipc.testflag(0) do-- Set the timestamp for this loop
time = ipc.elapsedtime() - time0-- Read all the data we want from FSUIPC
mach = ipc.readUW(0x11C6) -- mach number
vs = ipc.readSW(0x842) -- vertical speed
bank = ipc.readSD(0x057C) -- bank angle
bhp = ipc.readDBL(0x3820) -- Brake horse power
ff = ipc.readDBL(0x0918) -- fuel flow in pounds per hour
fw = ipc.readUD(0x1264) -- fuel quantity in gallons
alt = ipc.readSD(0x3324) --altimeter reading in feet
ias = ipc.readUD(0x02BC) --indicated airspeed
--tas = ipc.readUD(0x02B8) --true airspeed
--gs = ipc.readUD(0x02B4) --groundspeed
----------------------conversion-----------------------
mach = mach / 20480
vs = vs * -3.28084
bank = bank * 360/ (4294967296) --conversion seems wrong
bhp = bhp / 570
fw = fw * 6.17
ias = ias / 128
-- but only log this time IF we aren't in an FS menu, or loading scenery
-- (check the "ready-to-fly" flag word at 3364)
-- and provided we are not paused (flagged at 0264)
if (ipc.readUW(0x3364) == 0) and (ipc.readUW(0x0264) == 0) then-- write a CSV line to the open file
f:write(string.format("%d,%.3f,%.2f,%.2f,%.2f,%.2f,%d,%d\n",vs,mach,bank,bhp,ff,fw,alt,ias))
end-- 20 times per second, roughly (allow 2 mSecs overhead)
ipc.sleep(48)end
-- tidy up at end ...
f:write("\n")
f:close()-- end of example program
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ERROR-------------------------------------------------
********* LUA: "parameters test1" Log [from FSUIPC version 5.103] *********
886422 System time = 23/06/2019 08:16:21, Simulator time = 14:05:16 (19:05Z)
886422 LUA: beginning "G:\P3Dv4\New folder\Modules\parameters test1.lua"
886422 *** LUA Error: G:\P3Dv4\New folder\Modules\parameters test1.lua:1: unexpected symbol near 'ï'
886422 >>> Thread forced exit (ipc.exit or os.exit) <<<
886422 System time = 23/06/2019 08:16:21, Simulator time = 14:05:16 (19:05Z)
********* LUA execution terminated: Log Closed *********
*************************************__________________________________________************************************Thanks in advance
-
Thank You for your help sir It worked as soon as I used SINT instead of UNIT. I am now trying to read altitude from the simulator. It says the offset has two parts, 0574 and 0570. now if I want to read the height do I make two independent events and read them?
-
Hello, I have been trying to extract some flight sim variables for physical representation such as gauges, using the oacsp library for Arduino and command gateway. I am trying to extract the bank angle data mapped with offset 0x057C. When I bank left I get some useful reading and I am able to convert it into degrees. But when rolled right, I get a constant value of 0 irrespective of my bank angle. Could you please help me out. I have attached my Arduino code below. Please disregard the file name
trouble with bank angle
in FSUIPC Support Pete Dowson Modules
Posted
Hello Sir,
Thank you for your quick reply
OACSP is a library for Arduino. It stands for open airbus cockpit. This library helps in extracting data from Fs and sending it to Arduino to be worked on. The library is capable of both, extracting and writing data to the flight sim. problem being I cannot extract double floating point values. hence I am individually trying to get the data out of the simulator.
I am not aware of any program that can track your Arduino process if there is please do tell me. For the LCD to work there is a simple library and to print anything on the lcd all we have to do is lcd.print(); My LCD has 2 lines.
When I run the Arduino I get the all good message but it just stays there.
By consistent, I meant that the data that is shown on my aircraft is the same as the one logged into log file.
And sure sir I will look into the delay clashing, I presumed the delay must be same so that data comes out syncronised.
I would also ask on the arduino forum but the problem is there are a very few people who are working with Arduino Fs and Lua scripts.
Once again Thank You for your response