Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direction of two synchronized sensors #55

Closed
Alx2203 opened this issue Jan 11, 2024 · 5 comments
Closed

Direction of two synchronized sensors #55

Alx2203 opened this issue Jan 11, 2024 · 5 comments

Comments

@Alx2203
Copy link

Alx2203 commented Jan 11, 2024

Hi,

I'm having a problem with rotation to sensor frame definition. My sensors are placed in the same orientation as in the example you give, so I apply this as in the example:

# rotate left_sensor first by -90 deg around the z-axis, followed by a -90 deg rotation around the x-axis. As the rotation matrix is multiplied from the left, the rotation matrix  results in:
left_rot = rotation_from_angle(np.array([1, 0, 0]), np.deg2rad(-90)) * rotation_from_angle(
    np.array([0, 0, 1]), np.deg2rad(-90)
)

# rotate right_sensor first by +90 deg around the z-axis, followed by a +90 deg rotation around the x-axis
right_rot = rotation_from_angle(np.array([1, 0, 0]), np.deg2rad(90)) * rotation_from_angle(
    np.array([0, 0, 1]), np.deg2rad(90)
)

rotations = dict(left_sensor=left_rot, right_sensor=right_rot)

The problem is that when I reconstruct the trajectory, my 2 sensors seem to be pointing in opposite directions, whereas they are mounted on a person walking with both legs in the same direction.

traj_reconstruction

Is this a problem you've experienced before?

@AKuederle
Copy link
Member

Hi, thank you for opening this issue! This looks indeed like some issue with the initial orientation.

Just for general information:

  • I assume you used the Kalmanfilter for trajecotry reconstruction? It could be that if the 0-velocity detection goes really wrong, that the orientation of the sensor becomes really unpredictable
  • As our algorithms don't make use of a magnetometer, heading correction is always difficult, so even under the best conditions, I would never assume that both feet work perfectly in the same direction, when you don't enforce any further constrains.

However, in your case it looks like something might be wrong with your initial assumption of the sensor directions. Can you compare your signals (before and after to rotation) with the example singals for a stride shown here?

https://gaitmap.readthedocs.io/en/latest/source/user_guide/coordinate_systems.html

This should give some indication, if you rotated everything correcly.

@Alx2203
Copy link
Author

Alx2203 commented Jan 24, 2024

Hello,
Thanks for your answer.
Yes indeed, I use the Kalman filter for the reconstruction.
I checked and it seems that I didn't make a mistake concerning the directions of my sensors.
I tried to recalibrate my sensors but I couldn't correct the problem.
Here's the result I get for a straight line:
straigt_line

@AKuederle
Copy link
Member

AKuederle commented Jan 24, 2024

Mmh this looks like a problem with the initial orientation. We don't have any knowledge about the inittial orientation. Hence we initialize the initial orientation, under the assumption that the local sensor frame aligns with the directions of the global frame at t=0. If the x-axis of the sensors don't align with the forward direction of the movement at t=0, then this could explain the deviation you are seeing.

The paths of both sensors look "straight", hence I don't assume this is integration drift (which usually amplifies itself exponentially). So I assume that it is simply a case of "the x-axis of the two sensors are not pointing in the same direction at t=0".

Depending on your application, what you could try to do is, to estimate the direction of travel (if you know people are walking forward and rotate both trajectories accordingly. Unfortunately, I don't think there is a universal solution to perfectly initialize the orientation of both sensors in the same coordinate frame, in particular, when they are not perfectly aligned with the shoe/walking direction

@Alx2203
Copy link
Author

Alx2203 commented Jan 25, 2024

Ok thanks for the advice, I'll try to rotate the trajectories :)

@AKuederle
Copy link
Member

@Alx2203 I will close the issue for now. Feel free to reopen, in case you have further questions regarding this topic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants