nepher 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. nepher/__init__.py +36 -0
  2. nepher/api/__init__.py +6 -0
  3. nepher/api/client.py +384 -0
  4. nepher/api/endpoints.py +97 -0
  5. nepher/auth.py +150 -0
  6. nepher/cli/__init__.py +2 -0
  7. nepher/cli/commands/__init__.py +6 -0
  8. nepher/cli/commands/auth.py +37 -0
  9. nepher/cli/commands/cache.py +85 -0
  10. nepher/cli/commands/config.py +77 -0
  11. nepher/cli/commands/download.py +72 -0
  12. nepher/cli/commands/list.py +75 -0
  13. nepher/cli/commands/upload.py +69 -0
  14. nepher/cli/commands/view.py +310 -0
  15. nepher/cli/main.py +30 -0
  16. nepher/cli/utils.py +28 -0
  17. nepher/config.py +202 -0
  18. nepher/core.py +67 -0
  19. nepher/env_cfgs/__init__.py +7 -0
  20. nepher/env_cfgs/base.py +32 -0
  21. nepher/env_cfgs/manipulation/__init__.py +4 -0
  22. nepher/env_cfgs/navigation/__init__.py +45 -0
  23. nepher/env_cfgs/navigation/abstract_nav_cfg.py +159 -0
  24. nepher/env_cfgs/navigation/preset_nav_cfg.py +590 -0
  25. nepher/env_cfgs/navigation/usd_nav_cfg.py +644 -0
  26. nepher/env_cfgs/registry.py +31 -0
  27. nepher/loader/__init__.py +9 -0
  28. nepher/loader/base.py +27 -0
  29. nepher/loader/category_loaders/__init__.py +2 -0
  30. nepher/loader/preset_loader.py +80 -0
  31. nepher/loader/registry.py +63 -0
  32. nepher/loader/usd_loader.py +49 -0
  33. nepher/storage/__init__.py +8 -0
  34. nepher/storage/bundle.py +78 -0
  35. nepher/storage/cache.py +145 -0
  36. nepher/storage/manifest.py +80 -0
  37. nepher/utils/__init__.py +12 -0
  38. nepher/utils/fast_spawn_sampler.py +334 -0
  39. nepher/utils/free_zone_finder.py +239 -0
  40. nepher-0.1.0.dist-info/METADATA +235 -0
  41. nepher-0.1.0.dist-info/RECORD +45 -0
  42. nepher-0.1.0.dist-info/WHEEL +5 -0
  43. nepher-0.1.0.dist-info/entry_points.txt +2 -0
  44. nepher-0.1.0.dist-info/licenses/LICENSE +97 -0
  45. nepher-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,45 @@
1
+ """Environment configuration definitions for navigation environments.
2
+
3
+ This module provides base classes for creating navigation environment configurations:
4
+
5
+ - AbstractNavigationEnvCfg: Abstract base class for all navigation environments
6
+ - PresetNavigationEnvCfg: Base class for preset environments with obstacle definitions
7
+ - ObstacleConfig: Configuration dataclass for individual obstacles
8
+ - UsdNavigationEnvCfg: Base class for USD-based environments loaded from scene files
9
+ - SpawnAreaConfig: Configuration dataclass for spawn areas in USD environments
10
+ - ExclusionZoneConfig: Configuration dataclass for exclusion zones in USD environments
11
+ """
12
+
13
+ from nepher.env_cfgs.navigation.abstract_nav_cfg import (
14
+ AbstractNavigationEnvCfg,
15
+ AbstractEnvironmentCfg, # Alias for backward compatibility
16
+ )
17
+ from nepher.env_cfgs.navigation.preset_nav_cfg import (
18
+ ObstacleConfig,
19
+ PresetNavigationEnvCfg,
20
+ ObstacleEnvironmentPresetCfg, # Alias for backward compatibility
21
+ )
22
+ from nepher.env_cfgs.navigation.usd_nav_cfg import (
23
+ ExclusionZoneConfig,
24
+ SpawnAreaConfig,
25
+ UsdNavigationEnvCfg,
26
+ UsdEnvironmentCfg, # Alias for backward compatibility
27
+ )
28
+
29
+ # Register config classes in the registry
30
+ from nepher.env_cfgs.registry import register_config_class
31
+
32
+ register_config_class("navigation", "usd", UsdNavigationEnvCfg)
33
+ register_config_class("navigation", "preset", PresetNavigationEnvCfg)
34
+
35
+ __all__ = [
36
+ "AbstractNavigationEnvCfg",
37
+ "AbstractEnvironmentCfg", # Backward compatibility alias
38
+ "ExclusionZoneConfig",
39
+ "ObstacleConfig",
40
+ "ObstacleEnvironmentPresetCfg", # Backward compatibility alias
41
+ "PresetNavigationEnvCfg",
42
+ "SpawnAreaConfig",
43
+ "UsdEnvironmentCfg", # Backward compatibility alias
44
+ "UsdNavigationEnvCfg",
45
+ ]
@@ -0,0 +1,159 @@
1
+ # Copyright (c) 2025, Nepher Team
2
+ # All rights reserved.
3
+ #
4
+ # SPDX-License-Identifier: BSD-3-Clause
5
+
6
+ """Abstract base environment configuration for navigation environments."""
7
+
8
+ from __future__ import annotations
9
+
10
+ import torch
11
+ from isaaclab.assets import AssetBaseCfg
12
+ from isaaclab.terrains import TerrainImporterCfg
13
+ from isaaclab.utils import configclass
14
+
15
+ from nepher.env_cfgs.base import BaseEnvCfg
16
+
17
+
18
+ @configclass
19
+ class AbstractNavigationEnvCfg(BaseEnvCfg):
20
+ """Base configuration for navigation environments.
21
+
22
+ Subclasses must override methods that raise NotImplementedError.
23
+
24
+ This class extends BaseEnvCfg with navigation-specific functionality.
25
+ """
26
+
27
+ # Environment identification
28
+ name: str = "abstract"
29
+ description: str = "Abstract navigation environment"
30
+ category: str = "navigation"
31
+
32
+ # Task semantics
33
+ success_tolerance: float = 0.5 # meters
34
+ goal_z_offset: float = 0.0
35
+ min_start_goal_dist: float = 1.0
36
+ max_start_goal_dist: float = 10.0
37
+ robot_radius: float = 0.3
38
+ max_episode_length_s: float = 30.0
39
+
40
+ # ========== Required Methods (from BaseEnvCfg) ==========
41
+
42
+ def get_terrain_cfg(self) -> TerrainImporterCfg:
43
+ """Return terrain configuration."""
44
+ raise NotImplementedError("Subclass must implement get_terrain_cfg()")
45
+
46
+ def get_scene_cfg(self) -> object:
47
+ """Return scene configuration.
48
+
49
+ For navigation environments, this returns the config itself as the scene config.
50
+ """
51
+ return self
52
+
53
+ # ========== Required Methods (Navigation-Specific) ==========
54
+
55
+ def get_obstacle_cfgs(self) -> dict[str, AssetBaseCfg]:
56
+ """Return obstacle asset configurations dict."""
57
+ raise NotImplementedError("Subclass must implement get_obstacle_cfgs()")
58
+
59
+ def gen_goal_random_pos(
60
+ self, env_ids: torch.Tensor, env_origins: torch.Tensor,
61
+ device: str | torch.device = "cpu", **kwargs,
62
+ ) -> torch.Tensor:
63
+ """Generate goal positions (len(env_ids), 3)."""
64
+ raise NotImplementedError("Subclass must implement gen_goal_random_pos()")
65
+
66
+ def gen_bot_random_pos(
67
+ self, env_ids: torch.Tensor, env_origins: torch.Tensor,
68
+ device: str | torch.device = "cpu", **kwargs,
69
+ ) -> tuple[torch.Tensor, torch.Tensor]:
70
+ """Generate robot positions (len(env_ids), 3) and yaws (len(env_ids),)."""
71
+ raise NotImplementedError("Subclass must implement gen_bot_random_pos()")
72
+
73
+ def validate_positions(
74
+ self, positions: torch.Tensor, env_origins: torch.Tensor,
75
+ device: str | torch.device = "cpu", **kwargs,
76
+ ) -> torch.Tensor:
77
+ """Return boolean tensor (N,) indicating valid positions."""
78
+ raise NotImplementedError("Subclass must implement validate_positions()")
79
+
80
+ # ========== Optional Hooks ==========
81
+
82
+ def get_robot_asset_cfg(self) -> AssetBaseCfg | None:
83
+ """Return robot asset config, or None to use default."""
84
+ return None
85
+
86
+ def get_sensor_cfgs(self) -> dict[str, object]:
87
+ """Return sensor configurations dict."""
88
+ return {}
89
+
90
+ def get_randomization_cfg(self) -> dict:
91
+ """Return domain randomization configuration."""
92
+ return {}
93
+
94
+ def get_metric_cfg(self) -> dict:
95
+ """Return metrics/logging configuration."""
96
+ return {}
97
+
98
+ def get_metric_names(self) -> list[str]:
99
+ """Return list of metric names to track."""
100
+ return self.get_metric_cfg().get("metric_names", [])
101
+
102
+ def get_light_cfgs(self) -> dict[str, AssetBaseCfg]:
103
+ """Return light configurations dict."""
104
+ return {}
105
+
106
+ def get_dynamic_obstacle_cfgs(self) -> dict[str, AssetBaseCfg]:
107
+ """Return dynamic obstacle configurations dict."""
108
+ return {}
109
+
110
+ def get_region_cfgs(self) -> dict[str, object]:
111
+ """Return semantic region configurations dict."""
112
+ return {}
113
+
114
+ def build_scene_cfg(self, **kwargs) -> object | None:
115
+ """Return complete scene config, or None to use individual components."""
116
+ return None
117
+
118
+ # ========== Goal/Waypoint Generation ==========
119
+
120
+ def update_goals_on_reached(
121
+ self, env_ids: torch.Tensor, current_goals: torch.Tensor,
122
+ env_origins: torch.Tensor, device: str | torch.device = "cpu", **kwargs,
123
+ ) -> torch.Tensor:
124
+ """Update goal positions when reached. Default: regenerate via gen_goal_random_pos."""
125
+ return self.gen_goal_random_pos(env_ids, env_origins, device=device, **kwargs)
126
+
127
+ def gen_random_waypoints(
128
+ self, env_ids: torch.Tensor, env_origins: torch.Tensor, num_waypoints: int,
129
+ device: str | torch.device = "cpu", min_waypoint_distance: float | None = None,
130
+ max_attempts_per_waypoint: int = 10, **kwargs,
131
+ ) -> torch.Tensor:
132
+ """Generate waypoint sequences (len(env_ids), num_waypoints, 3)."""
133
+ num_envs = len(env_ids)
134
+ waypoints = torch.zeros((num_envs, num_waypoints, 3), device=device)
135
+ waypoints[:, 0] = self.gen_goal_random_pos(env_ids, env_origins, device=device, **kwargs)
136
+
137
+ for wp_idx in range(1, num_waypoints):
138
+ if not min_waypoint_distance or min_waypoint_distance <= 0:
139
+ waypoints[:, wp_idx] = self.gen_goal_random_pos(
140
+ env_ids, env_origins, device=device, **kwargs
141
+ )
142
+ continue
143
+
144
+ prev_wp = waypoints[:, wp_idx - 1]
145
+ for attempt in range(max_attempts_per_waypoint):
146
+ candidates = self.gen_goal_random_pos(env_ids, env_origins, device=device, **kwargs)
147
+ distances = torch.norm(candidates[:, :2] - prev_wp[:, :2], dim=1)
148
+ valid = distances >= min_waypoint_distance
149
+
150
+ waypoints[valid, wp_idx] = candidates[valid]
151
+ if valid.all() or attempt == max_attempts_per_waypoint - 1:
152
+ waypoints[~valid, wp_idx] = candidates[~valid]
153
+ break
154
+
155
+ return waypoints
156
+
157
+ # Alias for backward compatibility
158
+ AbstractEnvironmentCfg = AbstractNavigationEnvCfg
159
+