The online racing simulator
Searching in All forums
(7 results)
pbbolt
Demo licensed
Quote from MadCatX :There is a sample C code that let's you connect to OutGauge and receive data. What you do with that data is up to you.

Yeah I think I've seen it Wink


Quote from MadCatX :
Not without seeing the code.

Oh sorry here is the code:

import socket
import struct

# Create UDP socket.
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# Bind to LFS.
sock.bind(('127.0.0.1', 30000))

while True:
# Receive data.
data = sock.recv(256)

if not data:
break # Lost connection

# Unpack the data.
outsim_pack = struct.unpack('I12f3i', data)
time = outsim_pack[0]
angvel = [outsim_pack[1], outsim_pack[2], outsim_pack[3]]
header = outsim_pack[4]
pitch = outsim_pack[5]
roll = outsim_pack[6]
accel = [outsim_pack[7], outsim_pack[8], outsim_pack[9]]
vel = [outsim_pack[10], outsim_pack[11], outsim_pack[12]]
pos = [outsim_pack[13], outsim_pack[14], outsim_pack[15]]

print "udp received"
#print "time is ", time
#print "angvel is ", angvel
#print "header is ", header
#print "pitch is ", pitch
#print "roll is ", roll
#print accel
print "vel is ", vel
#print "pos is ", pos
# Release the socket.
sock.close()

It actually was so much better but now it just gives one "udp received":/
It used to give like 30, 40 or something...

And is there a way to tell the time between each time it prints or gets the packet?
pbbolt
Demo licensed
Quote from MadCatX :Good. If you know C you can find a fully working OutGauge code right on the forum. It will also spare you the trouble of converting the raw packet format to something processable in VB.

You mean the one which prints the RPM?


Quote from MadCatX :Print them out to screen.

Yeah I did thanks, but after some printing it gives an error: unpack requires a string argument of length 64 :/
It didn't happen before without printings so I don't know I have no idea why it gives it do you know ?
pbbolt
Demo licensed
Quote from MadCatX :What exactly does that mean? What language(s) do you have some experience with? Do you know at least the basics of network communication?

Ummm I know MATLAB and a bit of Vb,Vb.net and C. I think I know the basics of network communication.

Quote from MadCatX : If you are sure you have OutSim and OutGauge enabled, you also should notice that the sample code does not display the received data anywhere. It only reads the raw data from the received packet and stores it in individual variables.

So how can I get the values of the stored variables?
Is it possible to see them with wireshark?
I tried to track the packets with wireshark but I was not able to do it so I'm trying to find something (some video or whatever) about how to track UDP packets with wireshark or whatever to be able to do it.
Last edited by pbbolt, .
pbbolt
Demo licensed
Quote from cargame.nl :In case of Python you can better try this; https://www.lfs.net/forum/thread/70545-Python---pyinsim---Python-InSim-library

Thanks this helped a lot but I don't know why even before moving none of the velocity vectors are literally zero they are all something like 0089384 and they are changing isn't that wrong?
pbbolt
Demo licensed
Quote from MadCatX :It sounds like what you need is OutSim. What is your programming background? Helper libraries like InSim.NET take care of the communication, all you have to do is process the received packets. Did you not see this sample code? (https://github.com/alexmcbride/insimdotnet#outgauge--outsim)

Thanks for your answer My programming is so basic not so good at all, do you have any suggestions so that I can become something like you guys in future?
and I tried the codes I only can get the headings, RPM and vector things doesn't work because I think C# cannot writeline vectors so I don't know what to do about that.
I have two other questions anyways:

1) I've tried the outsim code for python which is written here : http://en.lfsmanual.net/wiki/OutSim_/_OutGauge
It seems that the code is running but no data will come to there (cfg.text is correct), do you know what is going on? It will be awesome if I can get all the values from the game.

2) I want to decode a UDP packet sent from a micro autobox in a car to send it to a motion simulator seat. Any suggestions about that??
It has nothing to do with these right???
Is it easy to do it with wireshark?

Sorry for all the questions it will be so good if you can answer them somehow...
Regards,
Parsa
pbbolt
Demo licensed
Hey I want to simply be able to get the datas (ax,ay,az,vx,vy,vz and etc.) from LFS but I have no idea how to do it...
Can someone help me please?
where should I write a code and where should I get started to finally be able to write the code...
I've been struggling about 16 hours between these forums LFS programming manual INsim and Outsim but I wasn't able to connect to LFS nor with outsim nor with insim and I really want to do it...
where should I start what should I read/learn please help me please Frown
pbbolt
Demo licensed
Hey I want to simply be able to get the datas (ax,ay,az,vx,vy,vz and etc.) from LFS but I have no idea how to do it...
Can someone help me please?
where should I write a code and where should I get started to finally be able to write the code...
I've been struggling about 16 hours between these forums LFS programming manual INsim and Outsim but I wasn't able to connect to LFS nor with outsim nor with insim and I really want to do it...
where should I start what should I read/learn please help me please Frown
FGED GREDG RDFGDR GSFDG