Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TODO] Read data from file for visualisation #9

Open
sandeepnmenon opened this issue Mar 4, 2022 · 3 comments
Open

[TODO] Read data from file for visualisation #9

sandeepnmenon opened this issue Mar 4, 2022 · 3 comments

Comments

@sandeepnmenon
Copy link

Raising issue as per TODO.

Would like to submit PR for the same

@sandeepnmenon
Copy link
Author

Raised PR #10
Please review.

@thecountoftuscany
Copy link
Owner

Hi sorry quite busy right now. Might review over the weekend.

@AsternA
Copy link

AsternA commented Jul 29, 2022

if your file is csv then just read the file using pandas, construct the message yourself and send it over UDP.

That's what I am doing right now and it does the trick

example:

df_csv = pd.read_csv(PATH_CSV)
time = df_csv['loggingTime(txt)']


quat_w = df_csv['motionQuaternionW(R)']
quat_x = df_csv['motionQuaternionX(R)']
quat_y = df_csv['motionQuaternionY(R)']
quat_z = df_csv['motionQuaternionZ(R)']

yaw = df_csv['motionYaw(rad)']
pitch = df_csv['motionPitch(rad)']
roll = df_csv['motionRoll(rad)']

UDP_IP = "0.0.0.0"
UDP_PORT = 5005
START_indx = 9350
END_indx = 10000
MESSAGE = 'w' + str(quat_w[1]) + 'wa' + str(quat_x[1]) + 'ab' + str(quat_y[1]) + 'bc' + str(quat_z[1]) + 'c'

print("UDP target IP:", UDP_IP)
print("UDP target port:", UDP_PORT)
print("message:", MESSAGE)
print(f"Time {time[1]}")

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
i = START_indx
# while True:
while i < END_indx:
    MESSAGE = 'w' + str(quat_w[i]) + 'wa' + str(quat_x[i]) + 'ab' + str(quat_y[i]) + 'bc' + str(quat_z[i]) + 'c'
    sock.sendto(bytes(MESSAGE, "utf-8"), (UDP_IP, UDP_PORT))
    print(f"Time: {time[i]}, i: {i}")
    i += 1
    input()

note: I use "input()" so the code runs when I want it so I can go over line by line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants