Get SLAM Trajectory Position and Orientation in Python

I’m attempting to use the python scripting to position the camera at the latest trajectory position / orientation while running online SLAM. However, I’m having trouble extracting the trajectory details from the filter.

I start by loading the capture file, then applying the online SLAM filter. At some point I pause the playback:

When I list all available sources, I see:

Name: LidarReader1, Source: <paraview.servermanager.LidarReader object at 0x1c3a26b50>
Name: Measurement Grid, Source: <paraview.servermanager.GridSource object at 0x1c39f3ac0>
Name: RPM, Source: <paraview.servermanager.Text object at 0x1c76d4610>
Name: SLAMonline1, Source: <paraview.servermanager.SLAMonline object at 0x1c76d4520>
Name: TrailingFrame1, Source: <paraview.servermanager.TrailingFrame object at 0x1c76d4670>

So I attempted to look for trajectory in the SLAM filter:
I ran:
slam_online = FindSource("SLAMonline1")

However when I listed ports, properties, data arrays, etc attached to this object, I wasn’t able to find anything related to the trajectory (and adjacently, I’m interested in isolating the Edge Map and Planar Map objects, but wasn’t sure how to find those).

How do I get these from the SLAMonline filter?

Thank you for the help

Hi @figbar ,

You need first to retrieve the Client Side Object, then you can access to the outputs, so the python scripting for doing this would be the following :

slam_online = FindSource("SLAMonline1")
slam_cso = slam_online.GetClientSideObject()
traj = slam_cso.GetOutput(1) # the trajectory is the second output of the SLAM filter

You may also want to have a look at this regarding animations in LidarView

And in particular this example

Hope this helps,

Gatien

1 Like