Skip to content

Conversation

@epignatelli
Copy link
Owner

Fixes #100

Thanks @fernando-ml for spotting this. Let me know if this fixes it for you.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 12, 2025

************* Module navix._version
navix/_version.py:1:0: C0114: Missing module docstring (missing-module-docstring)
************* Module navix.environments.environment
navix/environments/environment.py:53:0: C0301: Line too long (105/100) (line-too-long)
navix/environments/environment.py:1:0: C0114: Missing module docstring (missing-module-docstring)
navix/environments/environment.py:36:0: C0115: Missing class docstring (missing-class-docstring)
navix/environments/environment.py:36:0: R0903: Too few public methods (0/2) (too-few-public-methods)
navix/environments/environment.py:47:0: C0115: Missing class docstring (missing-class-docstring)
navix/environments/environment.py:63:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:66:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:69:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:72:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:75:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:79:0: C0115: Missing class docstring (missing-class-docstring)
navix/environments/environment.py:105:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:105:4: R0913: Too many arguments (12/5) (too-many-arguments)
navix/environments/environment.py:105:4: R0917: Too many positional arguments (12/5) (too-many-positional-arguments)
navix/environments/environment.py:156:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:162:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:212:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/environments/environment.py:223:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
navix/environments/environment.py:223:11: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
navix/environments/environment.py:227:13: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
navix/environments/environment.py:229:13: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
navix/environments/environment.py:232:13: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
navix/environments/environment.py:238:13: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
navix/environments/environment.py:245:13: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
navix/environments/environment.py:251:13: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
navix/environments/environment.py:260:16: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
navix/environments/environment.py:220:4: R0911: Too many return statements (7/6) (too-many-return-statements)
************* Module navix.grid
navix/grid.py:547:0: C0301: Line too long (101/100) (line-too-long)
navix/grid.py:548:0: C0301: Line too long (123/100) (line-too-long)
navix/grid.py:558:0: C0301: Line too long (102/100) (line-too-long)
navix/grid.py:1:0: C0114: Missing module docstring (missing-module-docstring)
navix/grid.py:51:38: W0621: Redefining name 'coordinates' from outer scope (line 36) (redefined-outer-name)
navix/grid.py:480:4: C0103: Variable name "MIN_SCAN_RADIUS" doesn't conform to snake_case naming style (invalid-name)
navix/grid.py:516:0: W0102: Dangerous default value {} as argument (dangerous-default-value)
navix/grid.py:25:0: W0611: Unused List imported from typing (unused-import)
************* Module navix.observations
navix/observations.py:1:0: C0114: Missing module docstring (missing-module-docstring)
navix/observations.py:44:0: C0116: Missing function or method docstring (missing-function-docstring)
navix/observations.py:45:4: W0603: Using the global statement (global-statement)
navix/observations.py:49:9: W0613: Unused argument 'state' (unused-argument)
navix/observations.py:128:4: C0103: Variable name "H" doesn't conform to snake_case naming style (invalid-name)
navix/observations.py:128:7: C0103: Variable name "W" doesn't conform to snake_case naming style (invalid-name)
navix/observations.py:22:0: W0611: Unused import jax (unused-import)
navix/observations.py:30:0: W0611: Unused align imported from grid (unused-import)
navix/observations.py:30:0: W0611: Unused draw_grid_lines imported from grid (unused-import)
************* Module navix.rendering.registry
navix/rendering/registry.py:1:0: C0114: Missing module docstring (missing-module-docstring)
navix/rendering/registry.py:52:0: C0115: Missing class docstring (missing-class-docstring)
navix/rendering/registry.py:62:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:66:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:70:0: C0115: Missing class docstring (missing-class-docstring)
navix/rendering/registry.py:87:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:90:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:93:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:96:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:102:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:112:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:122:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:125:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/rendering/registry.py:131:4: C0116: Missing function or method docstring (missing-function-docstring)
************* Module navix.states
navix/states.py:1:0: C0114: Missing module docstring (missing-module-docstring)
navix/states.py:37:0: R0903: Too few public methods (0/2) (too-few-public-methods)
navix/states.py:67:22: E3701: Invalid usage of field(), it should be used within a dataclass or the make_dataclass() function. (invalid-field-call)
navix/states.py:70:20: E3701: Invalid usage of field(), it should be used within a dataclass or the make_dataclass() function. (invalid-field-call)
navix/states.py:71:22: E3701: Invalid usage of field(), it should be used within a dataclass or the make_dataclass() function. (invalid-field-call)
navix/states.py:72:24: E3701: Invalid usage of field(), it should be used within a dataclass or the make_dataclass() function. (invalid-field-call)
navix/states.py:118:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
navix/states.py:136:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
navix/states.py:378:41: W0613: Unused argument 'idx' (unused-argument)
navix/states.py:326:0: R0904: Too many public methods (23/20) (too-many-public-methods)
navix/states.py:25:0: C0411: standard import "dataclasses.field" should be placed before third party imports "jax.Array", "jax.numpy", "flax.struct" (wrong-import-order)
************* Module tests.test_observations
tests/test_observations.py:1:0: C0114: Missing module docstring (missing-module-docstring)
tests/test_observations.py:14:0: C0116: Missing function or method docstring (missing-function-docstring)
tests/test_observations.py:14:0: R0914: Too many local variables (21/15) (too-many-locals)
tests/test_observations.py:14:0: R1711: Useless return at end of function or method (useless-return)
tests/test_observations.py:101:0: C0116: Missing function or method docstring (missing-function-docstring)
tests/test_observations.py:136:0: C0116: Missing function or method docstring (missing-function-docstring)
tests/test_observations.py:137:4: C0415: Import outside toplevel (gymnasium) (import-outside-toplevel)
tests/test_observations.py:138:4: C0415: Import outside toplevel (minigrid) (import-outside-toplevel)
tests/test_observations.py:144:4: W0612: Unused variable 'timestep' (unused-variable)
tests/test_observations.py:1:0: W0611: Unused import pytest (unused-import)


Report
======
675 statements analysed.

Statistics by type
------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |7      |NC         |NC         |0.00        |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|class    |10     |NC         |NC         |50.00       |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|method   |65     |NC         |NC         |69.23       |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|function |38     |NC         |NC         |89.47       |0.00     |
+---------+-------+-----------+-----------+------------+---------+



External dependencies
---------------------
::

    navix (tests.test_observations)
      \-actions (navix.environments.environment)
      \-components (tests.test_observations)
      \-entities (tests.test_observations)
      \-observations (navix.environments.environment)
      \-rendering 
      | \-cache (navix.environments.environment,tests.test_observations)
      | \-registry (tests.test_observations)
      \-rewards (navix.environments.environment)
      \-spaces (navix.environments.environment)
      \-states (navix.environments.environment,tests.test_observations)
      \-terminations (navix.environments.environment)
      \-transitions (navix.environments.environment)



1980 lines have been analyzed

Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |994    |50.20 |NC       |NC         |
+----------+-------+------+---------+-----------+
|docstring |565    |28.54 |NC       |NC         |
+----------+-------+------+---------+-----------+
|comment   |151    |7.63  |NC       |NC         |
+----------+-------+------+---------+-----------+
|empty     |270    |13.64 |NC       |NC         |
+----------+-------+------+---------+-----------+



Duplication
-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |0     |NC       |NC         |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |NC       |NC         |
+-------------------------+------+---------+-----------+



Messages by category
--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |47     |NC       |NC         |
+-----------+-------+---------+-----------+
|refactor   |11     |NC       |NC         |
+-----------+-------+---------+-----------+
|warning    |18     |NC       |NC         |
+-----------+-------+---------+-----------+
|error      |4      |NC       |NC         |
+-----------+-------+---------+-----------+



% errors / warnings by module
-----------------------------

+-------------------------------+-------+--------+---------+-----------+
|module                         |error  |warning |refactor |convention |
+===============================+=======+========+=========+===========+
|navix.states                   |100.00 |5.56    |36.36    |4.26       |
+-------------------------------+-------+--------+---------+-----------+
|navix.environments.environment |0.00   |38.89   |45.45    |31.91      |
+-------------------------------+-------+--------+---------+-----------+
|navix.observations             |0.00   |27.78   |0.00     |8.51       |
+-------------------------------+-------+--------+---------+-----------+
|navix.grid                     |0.00   |16.67   |0.00     |10.64      |
+-------------------------------+-------+--------+---------+-----------+
|tests.test_observations        |0.00   |11.11   |18.18    |12.77      |
+-------------------------------+-------+--------+---------+-----------+
|navix.rendering.registry       |0.00   |0.00    |0.00     |29.79      |
+-------------------------------+-------+--------+---------+-----------+
|navix._version                 |0.00   |0.00    |0.00     |2.13       |
+-------------------------------+-------+--------+---------+-----------+



Messages
--------

+------------------------------+------------+
|message id                    |occurrences |
+==============================+============+
|missing-function-docstring    |24          |
+------------------------------+------------+
|missing-module-docstring      |7           |
+------------------------------+------------+
|comparison-with-callable      |7           |
+------------------------------+------------+
|unused-import                 |5           |
+------------------------------+------------+
|missing-class-docstring       |5           |
+------------------------------+------------+
|line-too-long                 |4           |
+------------------------------+------------+
|invalid-field-call            |4           |
+------------------------------+------------+
|no-else-return                |3           |
+------------------------------+------------+
|invalid-name                  |3           |
+------------------------------+------------+
|unused-argument               |2           |
+------------------------------+------------+
|too-few-public-methods        |2           |
+------------------------------+------------+
|import-outside-toplevel       |2           |
+------------------------------+------------+
|wrong-import-order            |1           |
+------------------------------+------------+
|useless-return                |1           |
+------------------------------+------------+
|unused-variable               |1           |
+------------------------------+------------+
|too-many-return-statements    |1           |
+------------------------------+------------+
|too-many-public-methods       |1           |
+------------------------------+------------+
|too-many-positional-arguments |1           |
+------------------------------+------------+
|too-many-locals               |1           |
+------------------------------+------------+
|too-many-arguments            |1           |
+------------------------------+------------+
|redefined-outer-name          |1           |
+------------------------------+------------+
|global-statement              |1           |
+------------------------------+------------+
|dangerous-default-value       |1           |
+------------------------------+------------+
|consider-using-f-string       |1           |
+------------------------------+------------+




-----------------------------------
Your code has been rated at 8.58/10

This comment was marked as outdated.

@epignatelli epignatelli requested a review from Copilot August 15, 2025 11:48

This comment was marked as outdated.

@epignatelli epignatelli requested a review from Copilot August 15, 2025 14:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the rgb_first_person observation function, addressing issue #100. The changes improve the first-person RGB observation by aligning sprites correctly, fixing observation space dimensions, and adding proper view cone handling.

Key changes:

  • Fixed observation space dimensions for first-person views to use consistent (radius * 2 + 1) sizing
  • Added get_sprites_first_person() method to properly align agent sprite to north direction
  • Enhanced view cone calculation with frontier obstacle detection and minigrid opacity support

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_observations.py Added test case for rgb_first_person observation with minigrid comparison
requirements_test.txt Added minigrid dependency for testing
navix/states.py Added get_sprites_first_person() method and sprite registry import
navix/rendering/registry.py Changed minimum tile size from 32 to 8 pixels
navix/observations.py Major refactor of rgb_first_person() function with proper view cone and opacity
navix/grid.py Enhanced crop function, added minigrid opacity and grid line utilities, improved view cone
navix/environments/environment.py Fixed observation space dimensions for first-person observations
navix/_version.py Version bump to 0.7.2
.github/workflows/CI.yml Added test requirements installation to CI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@epignatelli epignatelli merged commit e4eb92a into main Aug 15, 2025
7 checks passed
@epignatelli epignatelli deleted the i100 branch August 15, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Fix for rgb_first_person Observation Function

2 participants