View my account

Cannot getting motion data from L515

Comments

3 comments

  • Aznie Syaarriehaah

    Hi Kenji Yasuda,
    I think there is an example for extracting the IMU data you can refer to for implementation details.

    Regards,
    Aznie
    Intel Customer Support

    0
    Comment actions Permalink
  • Kenji Yasuda

    Hi Aznie.

    Thank you so much for confirmin and suggesting a solution.

    I read this documentation.

    then, I executed below source code.

    import pyrealsense2 as rs
    import numpy as np
    
    
    def initialize_camera():
        p = rs.pipeline()
        conf = rs.config()
        conf.enable_stream(rs.stream.accel)
        conf.enable_stream(rs.stream.gyro)
        prof = p.start(conf)
        return p
        
    
    
    def gyro_data(gyro):
        return np.asarray([gyro.x, gyro.y, gyro.z])
    
    
    def accel_data(accel):
        return np.asarray([accel.x, accel.y, accel.z])
    
    p = initialize_camera()
    
    try:
        while True:
            f = p.wait_for_frames()
            accel = accel_data(f[0].as_motion_frame().get_motion_data())
            gyro = gyro_data(f[1].as_motion_frame().get_motion_data())
            print("accelerometer: ", accel)
            print("gyro: ", gyro)
    
    finally:
        p.stop() 

    However, I got error code in line 26 (f = p.wait_for_frames()).

    Error message: Frame didn't arrive within 5000.

    Please tell me what else I need to check.
    Thank you.

    0
    Comment actions Permalink
  • Aznie Syaarriehaah

    Hi Kenji Yasuda,
    The python case looks fine and it should work. It must be a system issue. Try to run the code from another PC.

    Regards,
    Aznie
    Intel RealSense Customer Support

    0
    Comment actions Permalink

Please sign in to leave a comment.