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

Obtain every frame IMU's timestamps and IMUPacket's timestamps #617

Open
moonmoonmoonmoon opened this issue Oct 16, 2024 · 2 comments
Open
Assignees
Labels
question Further information is requested

Comments

@moonmoonmoonmoon
Copy link

Hello, how can I get the IMU timestamps information by using python, such as Accelerometer Read Time and Gyroscope Read Time? And how can I get the IMUPacket's timestamps information?

Thank you!

@moonmoonmoonmoon moonmoonmoonmoon added the question Further information is requested label Oct 16, 2024
@matthew-lidar
Copy link
Collaborator

matthew-lidar commented Nov 16, 2024

Here's an example script that prints those in Python. Just provide your sensor IP/hostname as the first argument.

from ouster.sdk import client

import sys

config = client.SensorConfig()
config.udp_dest = '@auto'
packets = client.SensorPacketSource([(sys.argv[1], config)])
pf = client.PacketFormat(packets.metadata[0])

for i, pack in enumerate(packets):
    index, packet = pack
    if i >= 100:
        break

    if isinstance(packet, client.ImuPacket):
        ax = pf.imu_la_x(packet.buf)
        ay = pf.imu_la_y(packet.buf)
        az = pf.imu_la_z(packet.buf)
        ats = pf.imu_accel_ts(packet.buf)
        gts = pf.imu_gyro_ts(packet.buf)
        sts = pf.imu_sys_ts(packet.buf)
        print(ats, gts, sts)

@matthew-lidar matthew-lidar self-assigned this Nov 16, 2024
@moonmoonmoonmoon
Copy link
Author

Thank you very much!!!

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

No branches or pull requests

2 participants