Skip to content

Comments

Relative position sensor#41

Open
kenblu24 wants to merge 6 commits intomainfrom
relativesensor
Open

Relative position sensor#41
kenblu24 wants to merge 6 commits intomainfrom
relativesensor

Conversation

@kenblu24
Copy link
Owner

@kenblu24 kenblu24 commented Sep 23, 2025

This PR introduces a new sensor, and also separates two concerns within BinaryFOVSensor:

  • Getting all agents within a radius of the sensor origin --> class RangedSensor
    • When an agent position quadtree is available, create a bounding box of the circle of sensing range and use this AABB to query the quadtree for agents
    • Return the agents within < r radius of the sensor origin
  • Sensing agents within an FOV -- class BinaryFOVSensor(RangedSensor)
    • Create a bounding box of the FOV which is used to query RangedSensor for nearby agents
    • Check if any other agent is within FOV

In other words, BinaryFOVSensor now inherits from a new class RangedSensor.

This makes it easier to implement the quadtree-optimized agent getter in other sensors.

I am also introducing RelativeAgentSensor, which returns relative coordinates to nearby agents, from a global frame (i.e. 5 meters East, 2 meters North), as opposed to agent/sensor body frame. This can of course be extended in the future with a config option to return body frame coordinates.

This sensor passes all tests in tests/sensors at this time, and I have run an SNN milling test which returns the same Circliness up to 4 decimal places (0.9421 w/ casPYan, 0.9389 w/ caspian)

This PR also includes some changes to the way that BinaryFOVSensor calculates the FOV axis-aligned bounding box, which I did for readability. I have NOT benchmarked this change for performance uplift/degradation.

(cherry picked from commit f435adb)
(cherry picked from commit 279bab0)
(cherry picked from commit 35be6e3)
(cherry picked from commit ccaeb92)
(cherry picked from commit 0bc7dc1)
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

Successfully merging this pull request may close these issues.

1 participant