movement icon indicating copy to clipboard operation
movement copied to clipboard

Ability to detect U-turns

Open niksirbi opened this issue 1 year ago • 6 comments

It would be useful to have a function that detects U-turns in 2D based on some adjustable criterium/threshold.

I haven't though this through, but we should be able to use either compute_forward_vector or compute_displacement (or both), depending on how one defines the U-turn.

niksirbi avatar Dec 10 '24 17:12 niksirbi

Check cout: https://traja.readthedocs.io/en/stable/turns.html#angles

niksirbi avatar Dec 13 '24 11:12 niksirbi

We discussed maybe having a detect_events module that returns an event vector. Also probably having a general version and a more specific version (similar to the head vector computation).

sfmig avatar Dec 13 '24 11:12 sfmig

Hi! I’d like to work on this issue. Could you please assign it to me? Thanks!

@niksirbi

vtushar06 avatar Jul 08 '25 11:07 vtushar06

hey @niksirbi, I’ve implemented a new feature to improve the U-turn detection logic by introducing a signed angle calculation with compute_signed_angle_2d(). This provides more accurate detection based on direction changes and enhances the reliability of the overall logic. Here’s the PR for your review: #634 Let me know if you have any feedback or suggestions!

@vtushar06

vtushar06 avatar Jul 08 '25 17:07 vtushar06

Hey @vtushar06, thanks for giving this a go!

Just to let you know: it might take us a while to review, as I’ll be on leave for a week and we’re generally short on reviewer time. This feature is definitely on our roadmap, but not an immediate priority, so reviews may be slower than usual.

As a general rule, we try to avoid multiple PRs for the same issue, though in this case I acknowledge the earlier attempt (PR 507) had gone stale. That said, it’s helpful to link to previous efforts for context. Could you add a reference to that earlier PR in yours?

We’ll get back to you as soon as we can. In the meantime, we’d be grateful if you could avoid opening too many new PRs, as we already have several pending from you.

Thanks again for your contributions. We really do appreciate them, even if we can’t always respond promptly.

Best,
Niko

niksirbi avatar Jul 08 '25 18:07 niksirbi

sure @niksirbi thanks for guidance and Clarification, will follow this.

vtushar06 avatar Jul 10 '25 07:07 vtushar06