How to use --extrinsics with ouster-cli for SLAM testing (OSF from PCAP)

Hi everyone,

I’m currently using ouster-sdk v0.14.0 on Windows 11 Home.

I have some data collected while driving around a parking lot, and I would like to test the SLAM functionality included in the SDK using this dataset. The data was originally in PCAP format and I’ve converted it to OSF.

I tried running the following command with the --extrinsics option:

ouster-cli source test.osf --extrinsics "0,5,0,0,0,0" slam viz

However, the command doesn’t seem to work as expected.
Could anyone clarify the correct way to use --extrinsics with an OSF file for SLAM testing?

Any guidance would be greatly appreciated.
Thank you in advance!

Hi @victo !

Options and flags, including the --extrinsics option, have to follow a command, e.g. source.

As such, the command should take the form

ouster-cli source --extrinsics "0,5,0,0,0,0" test.osf slam viz

The --extrinsics option can take many forms of input. Here’s the explanation from the help text for the source command:

  -e, --extrinsics TEXT      Use this arg to adjust Lidar sensor extrinsics of
                             the source. Supported formats:
                             
                             -e extrinsics.json ; A json file containing a per
                             sensor extrinsics
                             
                             -e identity ; Use this to override any stored
                             extrinsics with identity matrix
                             
                             -e X,Y,Z,R,P,Y ; 'X Y Z' for position (meters),
                             'R P Y' represent euler angles (deg)
                             
                             -e X,Y,Z,QX,QY,QZ,QW ; 'X Y Z' for position
                             (meters), 'QX, QY QZ, QW' represent a quaternion
                             
                             -e n1,n2,..,n16 ; 16 float representing a 2D
                             array in a row-major order
                             
                             If more than one sensor is present in the source
                             and this argument is used then the same
                             extrinsics will be applied to all sensors except
                             when using an extrinsics file.

I hope this helps! Please let me know if you have any further questions.

Cheers,
Tom

2 Likes

@tom
Hi Tom!
Thank you for your previous response — it was very helpful, and I was able to get it working successfully.

I would now like to test some of the other options, particularly the use of -e extrinsics.json. It seems that this file cannot be generated directly by the SDK, so I would like to create it manually.

Specifically, I am planning to connect and use three to four sensors simultaneously, and I understand that an extrinsics.json file is required for this configuration. However, I am unsure of the exact format and structure this file should follow.

Could you kindly share the correct format or a sample of how the extrinsics.json file should be structured?

Thank you in advance for your assistance.

Best regards,
Victo

Here is a sample extriniscs.json file showing three sensors (the source_frame is the sensor serial number that the transform will be applied to):

{
    "transforms": [
      {
        "destination_frame": "world",
        "p_x": 12.900038003921509,
        "p_y": 54.88382339477539,
        "p_z": 15.093940734863281,
        "q_w": 0.7467111945152283,
        "q_x": -0.14726592600345612,
        "q_y": 0.10559403151273727,
        "q_z": 0.6399883031845093,
        "source_frame": "122150000150"
      },
      {
        "destination_frame": "world",
        "p_x": 15.144094467163086,
        "p_y": -2.7492141723632813,
        "p_z": 13.969382286071777,
        "q_w": 0.9823863506317139,
        "q_x": 0.012154391966760159,
        "q_y": 0.1813080757856369,
        "q_z": 0.04355182126164436,
        "source_frame": "992313000353"
      },
      {
        "destination_frame": "world",
        "p_x": 2.866729736328125,
        "p_y": 54.92229461669922,
        "p_z": 14.699606895446777,
        "q_w": 0.6737944483757019,
        "q_x": -0.2551470398902893,
        "q_y": 0.2224845290184021,
        "q_z": 0.6568117141723633,
        "source_frame": "992225001114"
      }
    ]
}

@Samahu
Thank you for the example!
I’ll give it a try and see how it works.
:love_you_gesture:

Hi Samahu,

Thank you for providing the sample.

I have a question regarding the -e, --extrinsics TEXT option in ouster-cli. According to the documentation, it supports both -e X,Y,Z,R,P,Y and -e X,Y,Z,QX,QY,QZ,QW formats. However, in the sample file you shared, the values are represented as "q_w", "q_x", "q_y", and "q_z".

I understand that these represent a quaternion, but I am unsure how to correctly use them. Although there are many calculators that can convert Euler angles to quaternions, the resulting angles do not seem to align properly. Could you please explain the meaning of "q_w", "q_x", "q_y", and "q_z"?

Additionally, is it mandatory to use quaternions in extrinsics.json, or Instead, is it possible to use Euler angles from a json file?

Best regards,

Additionally, is it mandatory to use quaternions in extrinsics.json

Yes, unfortunately the extriniscs.json expects transforms in the form of a quaternion.

The “q_x", "q_y", and "q_z" are the imaginary parts of the quaternion (think of it as the axis or rotation) while “q_w” is the real part (how much rotation around the axis). Think of a quaternion as a rotation around an axis defined by the q_x, q_y, q_z and q_w representing the rotation amount around this axis.

You can use an online calculator or the scipy python package to convert between euler angles and quaternions.