# Get SLAM Trajectory Position and Orientation in Python

**URL:** https://discourse.paraview.org/t/get-slam-trajectory-position-and-orientation-in-python/15971
**Category:** LidarView, Lidar, and SLAM
**Created:** [January 12, 2025, 6:20pm UTC](https://discourse.paraview.org/t/get-slam-trajectory-position-and-orientation-in-python/15971 "2025-01-12T18:20:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![figbar](https://discourse.paraview.org/user_avatar/discourse.paraview.org/figbar/32/15779_2.png) [@figbar](https://discourse.paraview.org/u/figbar)
#### Post date: [January 12, 2025, 6:20pm UTC](https://discourse.paraview.org/t/get-slam-trajectory-position-and-orientation-in-python/15971/1 "2025-01-12T18:20:10Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

### Author: ![Gatien\_Ferret](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gatien_ferret/32/9789_2.png) [@Gatien\_Ferret](https://discourse.paraview.org/u/Gatien_Ferret)
#### Post date: [January 15, 2025, 12:44pm UTC](https://discourse.paraview.org/t/get-slam-trajectory-position-and-orientation-in-python/15971/2 "2025-01-15T12:44:19Z")

</div>

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 :

```auto
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](https://gitlab.kitware.com/LidarView/lidarview-core/-/blob/master/Examples/Python/UsePythonAnimations.md) regarding animations in LidarView

And in particular this [example](https://gitlab.kitware.com/LidarView/lidarview-core/-/blob/master/Examples/Python/animation_focus_last_pose.py)

Hope this helps,

Gatien
