# Error in Tracking State

**URL:** <https://community.stereolabs.com/t/error-in-tracking-state/9346>\
**Category:** ZED2\
**Created:** [July 10, 2025, 3:46pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346 "2025-07-10T15:46:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 10, 2025, 3:46pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/1 "2025-07-10T15:46:30Z")

</div>

Hi,

I have a ZED 2i camera mounted on an e-scooter driving through sidewalks. I am using the cloud points to calculate widths and slopes of the sidewalks.

Everything is fine with the widths, but with the slopes I keep getting errors, I think it’s due to the rotation of my point clouds. As the camera is not completely aligned with the ground, as it is placed looking a bit downwards, it has a certain initial angle that can be corrected by rotating the point cloud.  
Well, I use the positional\_tracking\_parameters in order to rotate this point clouds, i am using this:

```
	positional_tracking_parameters = sl.PositionalTrackingParameters()

```

positional\_tracking\_parameters.set\_gravity\_as\_origin = True  
positional\_tracking\_parameters.enable\_imu\_fusion = True  
positional\_tracking\_parameters.mode = sl.POSITIONAL\_TRACKING\_MODE.GEN\_2  
self.zed. enable\_positional\_tracking(positional\_tracking\_parameters)  
Then, every frame i rotate with  
pose = sensors\_data.get\_imu\_data().get\_pose()  
rotation = pose.get\_rotation\_matrix()  
rotation\_matrix = rotation.r  
rotated\_points = np.dot(xyz.reshape(-1, 3), rotation\_matrix.T).reshape(xyz.shape)

However, I constantly see high vibration alerts on the accelerometer and so on, due to the scooter bouncing on the pavement, and I think this is causing my point cloud to not get straightened properly, so I get false slopes due to the cloud being incorrectly straightened. I also see that the position\_track\_state sometimes gets lost.

Am I rotating the cloud wrong or is it because of these high vibrations that I am not able to get my slopes right?

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [July 11, 2025, 9:01am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/2 "2025-07-11T09:01:00Z")

</div>

Hi @CristianViSa

> [@CristianViSa](#):
>
> Am I rotating the cloud wrong or is it because of these high vibrations that I am not able to get my slopes right?

Normally, you do not need to rotate the point cloud because you enabled `set_gravity_as_origin`, which uses the IMU to automatically rotate it to align to the gravity vector.

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 11, 2025, 10:35am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/3 "2025-07-11T10:35:14Z")

</div>

Thanks,

What about the high vibrations? They make the IMU to provide wrong measures? Can the IMU recover its state or the measurements are wrong since that moment?

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [July 11, 2025, 10:44am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/4 "2025-07-11T10:44:24Z")

</div>

> [@CristianViSa](#):
>
> What about the high vibrations? They make the IMU to provide wrong measures?

I need more information to reply to this.

> [@CristianViSa](#):
>
> Can the IMU recover its state or the measurements are wrong since that moment?

Not necessarily, the Positional Tracking will recover a good status as soon as the camera can see a “known” location

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 21, 2025, 8:16am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/5 "2025-07-21T08:16:30Z")

</div>

Sorry for the late reply.

I am constantly getting this warnigns:  
[2025-07-21 08:09:52 UTC][ZED][WARNING] IMU data issue detected : IMU: HIGH\_VIBRATION\_ACC

I think my IMU is not providing correct measures in order to orient my cloud point, therefore, i am obtaining wrong values for my slopes.

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [July 21, 2025, 12:46pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/6 "2025-07-21T12:46:20Z")

</div>

Hi @CristianViSa  
are you using the latest ZED SDK v5.0.3?

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 21, 2025, 12:49pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/7 "2025-07-21T12:49:34Z")

</div>

I have my SDK updated now, but those videos were recorded using 4.2.5

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [July 21, 2025, 1:01pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/8 "2025-07-21T13:01:14Z")

</div>

Please place the camera on a stable surface, then open ZED Sensor Viewer and check the stability of the Accelerometer and Gyroscope sensor data.  
Please take and send me a few screenshots as a double check.

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 21, 2025, 1:14pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/9 "2025-07-21T13:14:45Z")

</div>

Seems to be OK  
Accelerometer

 ![imagen](https://community.stereolabs.com/uploads/default/original/2X/7/75577ff6060e20504d713e4d4211c20910a60301.png)

Gyroscope

 ![imagen](https://community.stereolabs.com/uploads/default/original/2X/8/87cd26bfb501e216313fa0d9bf224b73eb727943.png)

It normally happens to my vehicle when the sidewalk is a bit more bumped than usual.

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [July 21, 2025, 4:06pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/10 "2025-07-21T16:06:14Z")

</div>

> [@CristianViSa](#):
>
> It normally happens to my vehicle when the sidewalk is a bit more bumped than usual.

This is a piece of relevant information; the warning is expected in this case.

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 22, 2025, 6:20am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/11 "2025-07-22T06:20:25Z")

</div>

It makes sense, but how can I be sure that the sensor readings, from that moment on, are correct? Sometimes I see that the tracking\_state is lost and I don’t know if the readings are corrupted after that.

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [July 22, 2025, 8:35am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/12 "2025-07-22T08:35:05Z")

</div>

If the tracking is lost, it’s not a problem with the IMU, but with the visual features for Visual Odometry.  
A slow “turn in place” could allow the robot to see “past feature” and recover the tracking.

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 23, 2025, 11:16am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/13 "2025-07-23T11:16:38Z")

</div>

I have made test, in order too see what is the problem, and I noticed that the values of the pointcloud does not change if i use set\_gravity\_as\_origin and if don’t use any positional tracking parameters.  
See this screenshot i get this values for both cases:

 ![gravity_as_origin](https://community.stereolabs.com/uploads/default/original/2X/4/48196efecd2266545b85f1dec787d61dc984e6ef.jpeg)

Is this expected? You told me that is not neccesary to rotate my pointcloud using the set\_gravity\_as\_origin=True, but i can see the same exact values.  
What I am trying to correct is the fact that my camera is not straight, it is facing a bit towards the ground and therefore the point clouds are not well oriented and my slopes have this error in the angle, but I am not being able to do it at all. See this picture to illustrate how I mount my zed 2i on a scooter, I have to correct this initial tilt.

 ![Captura desde 2025-07-23 13-15-28](https://community.stereolabs.com/uploads/default/original/2X/0/0813d4081d7d7aaec0d35969d5199bae6434c824.png)

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [July 23, 2025, 12:52pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/14 "2025-07-23T12:52:38Z")

</div>

> [@CristianViSa](#):
>
> I have made test, in order too see what is the problem, and I noticed that the values of the pointcloud does not change if i use set\_gravity\_as\_origin and if don’t use any positional tracking parameters.

Please explain this with other words adding details and eventually the configuration file.

> [@CristianViSa](#):
>
> What I am trying to correct is the fact that my camera is not straight, it is facing a bit towards the ground and therefore the point clouds are not well oriented and my slopes have this error in the angle, but I am not being able to do it at all.

Please send screenshots and videos to show the problem as it is.

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 23, 2025, 1:16pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/15 "2025-07-23T13:16:34Z")

</div>

Sorry, let me explain my problem.

I mount my camera like this, note the tilt of the camera, is facing the ground.

 ![WhatsApp Image 2025-07-23 at 15.02.14](https://community.stereolabs.com/uploads/default/original/2X/6/6ba45a70ee90dbe021191f9e4c2d30204fe6c8ee.jpeg)  
Because of this tilt, the camera generates the point clouds wrongly, they are wrongly oriented due to this angle and have to be rotated. If they are not rotated, the slopes measured are unrealistic as the cloud is not straightened.  
To do this, what I do is to obtain two points, calculate the distance between them and the difference in height between them, in order to calculate the slope.  
For this to work, the point cloud has to be correctly oriented, using the slope angles returned by the IMU.  
I am using this script: [SlopeCalculation (m84xy5cs) - PasteCode.io](https://pastecode.io/s/m84xy5cs)

What i said is that you mentioned this:

> Blockquote Normally, you do not need to rotate the point cloud because you enabled `set_gravity_as_origin`, which uses the IMU to automatically rotate it to align to the gravity vector.

But i noticed that if i just comment this part, to not use any positional tracking parameter:

```
    positional_tracking_parameters = sl.PositionalTrackingParameters()
    positional_tracking_parameters.set_gravity_as_origin = True
    positional_tracking_parameters.enable_imu_fusion = True
    positional_tracking_parameters.mode = sl.POSITIONAL_TRACKING_MODE.GEN_2
    self.zed.enable_positional_tracking(positional_tracking_parameters)

```

The values obtained in my point cloud is the same as enabling the positional\_tracking\_parameters.set\_gravity\_as\_origin = True

So basically, it is not rotating anything.  
For example, if i set gravity\_as\_origin = True i obtain this values for both points:  
p1: px=(1376, 1070), X=0.35, Y=1.41, Z= -0.58  
p2: px=(1423, 791), X=0.75, Y=2.55, \>=-0.38

And if i disable the positional tracking parameters, the values are the same:

p1: px=(1376, 1070), X=0.35, Y=1.41, Z= -0.58  
p2: px=(1423, 791), X=0.75, Y=2.55, \>=-0.38

As mentioned in my first message, I have also tried to rotate my point cloud with this piece of code:  
pose = sensors\_data.get\_imu\_data().get\_pose()  
rotation = pose.get\_rotation\_matrix()  
rotation\_matrix = rotation.r  
rotated\_points = np.dot(xyz.reshape(-1, 3), rotation\_matrix.T).reshape(xyz.shape)

But the values for the slope are not correct either. I dont know what i am missing to solve this problem.

---

<div class="post-metadata">

**Author:** ![RodolphePerrin](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@RodolphePerrin](https://community.stereolabs.com/u/RodolphePerrin)\
**Post date:** [July 23, 2025, 2:36pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/17 "2025-07-23T14:36:44Z")

</div>

Hi Cristian,

Not too sure I’m getting the issue exactly but wanted to share some tips. Having your camera tilted shouldn’t be an issue.

Looking briefly at your code, it seems that you may be getting the pointcloud in the camera frame instead of the world frame. World frame origin is based on the Positional Tracking parameters that you set. It may explain why you’re not seeing any differences at the moment since results are probably given in the camera frame.

To change that behavior, add this when initializing your system :

runtime\_params = sl.RuntimeParameters()  
runtime\_params.measure3D\_reference\_frame = sl.REFERENCE\_FRAME.WORLD

More info can be found [here](https://www.stereolabs.com/docs/api/python/classpyzed_1_1sl_1_1RuntimeParameters.html#a275ec36f862c89a77bcda0819c489b80) in the API.

Please note that with our latest SDK, we recommend now using GEN\_3 as mode for Positional Tracking since it is providing more robust results.

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 23, 2025, 3:11pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/18 "2025-07-23T15:11:34Z")

</div>

The main problem is that i am measuring slopes and due to some point cloud orientation problem I keep getting wrong values.

I used this frame because I don’t really understand how the world frame works. In the first frame, the values are coherent, for example these in the screenshot

 ![imagen](https://community.stereolabs.com/uploads/default/original/2X/9/98cc6d634e498c4353035a2da126331212ce90de.jpeg)  
but as the video progresses, the values become very strange, in this case there are some very low negative values, I guess it’s because of the starting point, it’s the difference from the starting point.  
 ![imagen](https://community.stereolabs.com/uploads/default/original/2X/5/5949891223a37eec76723fabf89da6de0d5f39de.jpeg)

See the new snippet with the world frame. [WorldFrame (rub0yx7e) - PasteCode.io](https://pastecode.io/s/rub0yx7e)  
I am pretty sure i am missing something on this point cloud orientation, but I cant see what am i doing wrong.

---

<div class="post-metadata">

**Author:** ![RodolphePerrin](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@RodolphePerrin](https://community.stereolabs.com/u/RodolphePerrin)\
**Post date:** [July 23, 2025, 3:54pm UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/19 "2025-07-23T15:54:25Z")

</div>

Are you able to share what the pointclouds look like or the SVO ? I don’t get what you mean by “due to some point cloud orientation problem”.

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 24, 2025, 6:22am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/20 "2025-07-24T06:22:44Z")

</div>

Sure, here is a cut of my SVO2 file. I know that the slope of that sidewalk is 4%, topographically measured. [slope.svo2](https://inmaproco-my.sharepoint.com/:u:/g/personal/cvs_decodeingenieria_com/EfDffod0BwVOq5IvOBPpnTMBh0bInsAcsWoGq-ZcEFCVNQ?e=EwYYFN)

Let me explain what i mean by point cloud orientation problem. Lets use the Depth Viewer, if you dont mark the “IMU ORIENTATION” box, the point cloud look like this:

 ![imagen](https://community.stereolabs.com/uploads/default/original/2X/2/27a24bf6dc43d3948f5c4f6d6035841eeeb1daae.jpeg)  
You can see that is not true, this is due to the camera tilt, so you need to orient the point cloud, if we mark the IMU ORIENTATION box, the point cloud goes like this:  
 ![imagen](https://community.stereolabs.com/uploads/default/original/2X/8/8eb2b44c55b233fe92c772a593c667c5f623335a.jpeg)  
This is more realistic, as the tilt is corrected.  
What I think is happening is that this correction is not being done properly, because the slopes I am getting are not correct. If we understand slope as the difference in height / distance travelled, with the values of this point cloud oriented with the IMU I get a value of 11%, which is far from the reality.  
See the point cloud in las format [pointcloud\_rotated\_starting\_0.las](https://inmaproco-my.sharepoint.com/:u:/g/personal/cvs_decodeingenieria_com/EXUZjlR-h8ZFhbfjCruhw5sBdwmacnvlE0zLbf1CevnmIA?e=2iOLfU)

Another thing i have noticed is that, the same frame (frame 1044 of the SVO) has different values if you use zed.set\_svo\_postion(1044), see screenshot:

 ![imagen](https://community.stereolabs.com/uploads/default/original/2X/a/a484eba8ea692dc05d5b0a74952e018154b7db66.jpeg)  
And if you just go through the video from frame 0 to frame 1044, the values are so different, see this screenshot:  
 ![imagen](https://community.stereolabs.com/uploads/default/original/2X/3/361f316fa41a67ac3ca3cc6eb9642ab74c5ecd09.jpeg)  
See its point cloud in here:  
[pointcloud\_rotated\_starting\_0.las](https://inmaproco-my.sharepoint.com/:u:/g/personal/cvs_decodeingenieria_com/EXUZjlR-h8ZFhbfjCruhw5sBdwmacnvlE0zLbf1CevnmIA?e=cxnt2P)

How is this possible? I think the problem is clearly the angles used for the orientation.

This is my snippet, i am using world rotation now [SlopeWORLDFrame (fzwq2hjf) - PasteCode.io](https://pastecode.io/s/fzwq2hjf)

---

<div class="post-metadata">

**Author:** ![CristianViSa](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/c/85e7bf/32.png) [@CristianViSa](https://community.stereolabs.com/u/CristianViSa)\
**Post date:** [July 28, 2025, 8:48am UTC](https://community.stereolabs.com/t/error-in-tracking-state/9346/21 "2025-07-28T08:48:06Z")

</div>

Hi,

Did you have time to check it?

[Next page](https://community.stereolabs.com/t/error-in-tracking-state/9346.md?page=2)
