Community Forum

get speedometer value and X, Y location

Forum Overview >> Scripting

CategoryScripting
Created08.04.2019 06:36


Zariche Brasil (Unknown) 08.04.2019 06:36
Hello I need to get the velocimeter values ​​and the X, Y location of the map and send it to the serial COMport. can you help me?

Bilbo Beutlin (BBeutlin) 08.04.2019 07:48
See for reference LUADOC Vehicles -> Vehicle

The position you get with
local x,y,z = getWorldTranslation(node)

The speed of a vehicle
local speed = vehicle:getLastSpeed()

However you can't write to serial port directly, since in FS the system I/O functions are disabled (due to sandbox).
You can only write to an xml file and read this from an external program.

Espen K. (estyx) 08.04.2019 14:17
Writing to an XML file is relative slow though, you can also write directly to a file:

local file = io.open(filepath, 'w')
file:write('content..')
file:close()

Zariche Brasil (Unknown) 08.04.2019 18:19
Thank you guys you are incredible. I want to make the interaction with a GPS john deere gs3. It will be nice in my simulator.


Zariche Brasil (Unknown) 08.04.2019 18:23



Zariche Brasil (Unknown) 08.04.2019 18:23



Note: Log in to post. Create a new account here.