ir-sim 2.3.2__tar.gz → 2.3.4__tar.gz

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 (101) hide show
  1. {ir_sim-2.3.2 → ir_sim-2.3.4}/PKG-INFO +15 -8
  2. {ir_sim-2.3.2 → ir_sim-2.3.4}/README.md +10 -3
  3. {ir_sim-2.3.2 → ir_sim-2.3.4}/ir_sim.egg-info/PKG-INFO +15 -8
  4. {ir_sim-2.3.2 → ir_sim-2.3.4}/ir_sim.egg-info/requires.txt +2 -2
  5. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/env/env_base.py +26 -10
  6. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/env/env_plot.py +10 -4
  7. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/algorithm/rvo.py +1 -1
  8. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/handler/kinematics_handler.py +2 -1
  9. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/07render_world/render.py +3 -2
  10. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/object_base.py +8 -5
  11. {ir_sim-2.3.2 → ir_sim-2.3.4}/pyproject.toml +12 -11
  12. {ir_sim-2.3.2 → ir_sim-2.3.4}/tests/test_all_objects.py +16 -6
  13. {ir_sim-2.3.2 → ir_sim-2.3.4}/tests/test_all_objects_3d.py +15 -5
  14. {ir_sim-2.3.2 → ir_sim-2.3.4}/LICENSE +0 -0
  15. {ir_sim-2.3.2 → ir_sim-2.3.4}/ir_sim.egg-info/SOURCES.txt +0 -0
  16. {ir_sim-2.3.2 → ir_sim-2.3.4}/ir_sim.egg-info/dependency_links.txt +0 -0
  17. {ir_sim-2.3.2 → ir_sim-2.3.4}/ir_sim.egg-info/top_level.txt +0 -0
  18. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/__init__.py +0 -0
  19. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/env/__init__.py +0 -0
  20. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/env/env_base3d.py +0 -0
  21. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/env/env_config.py +0 -0
  22. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/env/env_logger.py +0 -0
  23. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/env/env_plot3d.py +0 -0
  24. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/global_param/env_param.py +0 -0
  25. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/global_param/path_param.py +0 -0
  26. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/global_param/world_param.py +0 -0
  27. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/__init__.py +0 -0
  28. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/algorithm/generation.py +0 -0
  29. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/algorithm/kinematics.py +0 -0
  30. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/behavior/behavior.py +0 -0
  31. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/behavior/behavior_methods.py +0 -0
  32. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/behavior/behavior_registry.py +0 -0
  33. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/lib/handler/geometry_handler.py +0 -0
  34. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/01empty_world/empty_world.py +0 -0
  35. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/01empty_world/empty_world.yaml +0 -0
  36. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/02robot_world/car_world.yaml +0 -0
  37. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/02robot_world/robot_omni_world.yaml +0 -0
  38. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/02robot_world/robot_polygon_world.yaml +0 -0
  39. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/02robot_world/robot_world.py +0 -0
  40. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/02robot_world/robot_world.yaml +0 -0
  41. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/03obstacle_world/obstacle_world.py +0 -0
  42. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/03obstacle_world/obstacle_world.yaml +0 -0
  43. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/04collision_world/collision_world.py +0 -0
  44. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/04collision_world/collision_world.yaml +0 -0
  45. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/05lidar_world/lidar_world.py +0 -0
  46. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/05lidar_world/lidar_world.yaml +0 -0
  47. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/05lidar_world/lidar_world_noise.yaml +0 -0
  48. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/06multi_objects_world/multi_objects_world.py +0 -0
  49. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/06multi_objects_world/multi_objects_world.yaml +0 -0
  50. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/07render_world/render.yaml +0 -0
  51. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/07render_world/render_save_figure.py +0 -0
  52. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/08random_obstacle/random_obstacle.py +0 -0
  53. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/08random_obstacle/random_obstacle.yaml +0 -0
  54. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/09keyboard_control/keyboard_control.py +0 -0
  55. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/09keyboard_control/keyboard_control.yaml +0 -0
  56. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/10grid_map/cave.png +0 -0
  57. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/10grid_map/grid_map.py +0 -0
  58. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/10grid_map/grid_map.yaml +0 -0
  59. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/11collision_avoidance/collision_avoidance.py +0 -0
  60. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/11collision_avoidance/collision_avoidance.yaml +0 -0
  61. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/12dynamic_obstacle/dynamic_obstacle.py +0 -0
  62. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/12dynamic_obstacle/dynamic_obstacle.yaml +0 -0
  63. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/13custom_behavior/custom_behavior.py +0 -0
  64. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/13custom_behavior/custom_behavior.yaml +0 -0
  65. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/13custom_behavior/custom_behavior_methods.py +0 -0
  66. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/14world_3d_plot/car_world.yaml +0 -0
  67. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/14world_3d_plot/robot_omni_world.yaml +0 -0
  68. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/14world_3d_plot/robot_polygon_world.yaml +0 -0
  69. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/14world_3d_plot/robot_world_3d.py +0 -0
  70. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/14world_3d_plot/robot_world_3d.yaml +0 -0
  71. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/15fov_world/fov_world.py +0 -0
  72. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/15fov_world/fov_world.yaml +0 -0
  73. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/16noise_world/noise_world.py +0 -0
  74. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/usage/16noise_world/noise_world.yaml +0 -0
  75. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/util/util.py +0 -0
  76. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/version.py +0 -0
  77. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/__init__.py +0 -0
  78. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/arm_base.py +0 -0
  79. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/description/car_blue.png +0 -0
  80. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/description/car_green.png +0 -0
  81. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/description/car_red.png +0 -0
  82. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/description/diff_robot0.png +0 -0
  83. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/description/diff_robot1.png +0 -0
  84. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/map/cave.png +0 -0
  85. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/map/obstacle_map.py +0 -0
  86. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/object_base_3d.py +0 -0
  87. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/object_factory.py +0 -0
  88. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/obstacles/obstacle_acker.py +0 -0
  89. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/obstacles/obstacle_diff.py +0 -0
  90. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/obstacles/obstacle_omni.py +0 -0
  91. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/obstacles/obstacle_static.py +0 -0
  92. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/robots/robot_acker.py +0 -0
  93. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/robots/robot_arm.py +0 -0
  94. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/robots/robot_diff.py +0 -0
  95. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/robots/robot_omni.py +0 -0
  96. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/robots/robot_rigid3d.py +0 -0
  97. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/sensors/lidar2d.py +0 -0
  98. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/sensors/sensor_factory.py +0 -0
  99. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/world.py +0 -0
  100. {ir_sim-2.3.2 → ir_sim-2.3.4}/irsim/world/world3d.py +0 -0
  101. {ir_sim-2.3.2 → ir_sim-2.3.4}/setup.cfg +0 -0
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ir-sim
3
- Version: 2.3.2
4
- Summary: Open-source, lightweight robot 2D simulator based on Python, specifically designed for intelligent robotics navigation and learning.
3
+ Version: 2.3.4
4
+ Summary: an open-source, lightweight robot simulator based on Python, specifically designed for intelligent robotics navigation and learning. Primarily intended for research and educational purposes, it is user-friendly and easily customizable.
5
5
  Author-email: Han Ruihua <hanrh@connect.hku.hk>
6
6
  Project-URL: Homepage, https://github.com/hanruihua/ir-sim
7
7
  Classifier: Programming Language :: Python :: 3
8
8
  Classifier: License :: OSI Approved :: MIT License
9
9
  Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.7
10
+ Requires-Python: >=3.8
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: matplotlib==3.9.0
14
- Requires-Dist: shapely==2.0.6
13
+ Requires-Dist: matplotlib<3.10.0
14
+ Requires-Dist: shapely>=2.0.3
15
15
  Requires-Dist: numpy
16
16
  Requires-Dist: pyyaml
17
17
  Requires-Dist: imageio
@@ -62,7 +62,7 @@ It provides the following features:
62
62
 
63
63
  ## Prerequisite
64
64
 
65
- - Python: >= 3.7
65
+ - Python: >= 3.8
66
66
 
67
67
  ## Installation
68
68
 
@@ -130,15 +130,22 @@ robot:
130
130
  color: 'g' # green
131
131
  ```
132
132
 
133
-
134
133
  ### Advanced Usage
135
134
 
136
135
  The advanced usages are listed in the [irsim/usage](https://github.com/hanruihua/ir-sim/tree/main/irsim/usage)
137
136
 
138
137
  ## Academic Cases
139
138
  - [rl-rvo-nav](https://github.com/hanruihua/rl_rvo_nav) (RAL & ICRA2023)
140
- - [RDA_planner](https://github.com/hanruihua/RDA_planner)RAL & IROS2023
139
+ - [RDA_planner](https://github.com/hanruihua/RDA_planner) (RAL & IROS2023)
140
+
141
+ ## Contributing
142
+
143
+ This project is under development. I appreciate and welcome all contributions. Just open an issue or a pull request. Here are some simple ways to start contributing:
141
144
 
145
+ - Enhance the website documentation, such as the API and tutorials.
146
+ - Add new sensors, behaviors, robot models, and functional interfaces.
147
+ - Add new usage examples and benchmarks.
148
+ - Report bugs and issues.
142
149
 
143
150
  ## Acknowledgement
144
151
 
@@ -38,7 +38,7 @@ It provides the following features:
38
38
 
39
39
  ## Prerequisite
40
40
 
41
- - Python: >= 3.7
41
+ - Python: >= 3.8
42
42
 
43
43
  ## Installation
44
44
 
@@ -106,15 +106,22 @@ robot:
106
106
  color: 'g' # green
107
107
  ```
108
108
 
109
-
110
109
  ### Advanced Usage
111
110
 
112
111
  The advanced usages are listed in the [irsim/usage](https://github.com/hanruihua/ir-sim/tree/main/irsim/usage)
113
112
 
114
113
  ## Academic Cases
115
114
  - [rl-rvo-nav](https://github.com/hanruihua/rl_rvo_nav) (RAL & ICRA2023)
116
- - [RDA_planner](https://github.com/hanruihua/RDA_planner)RAL & IROS2023
115
+ - [RDA_planner](https://github.com/hanruihua/RDA_planner) (RAL & IROS2023)
116
+
117
+ ## Contributing
118
+
119
+ This project is under development. I appreciate and welcome all contributions. Just open an issue or a pull request. Here are some simple ways to start contributing:
117
120
 
121
+ - Enhance the website documentation, such as the API and tutorials.
122
+ - Add new sensors, behaviors, robot models, and functional interfaces.
123
+ - Add new usage examples and benchmarks.
124
+ - Report bugs and issues.
118
125
 
119
126
  ## Acknowledgement
120
127
 
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ir-sim
3
- Version: 2.3.2
4
- Summary: Open-source, lightweight robot 2D simulator based on Python, specifically designed for intelligent robotics navigation and learning.
3
+ Version: 2.3.4
4
+ Summary: an open-source, lightweight robot simulator based on Python, specifically designed for intelligent robotics navigation and learning. Primarily intended for research and educational purposes, it is user-friendly and easily customizable.
5
5
  Author-email: Han Ruihua <hanrh@connect.hku.hk>
6
6
  Project-URL: Homepage, https://github.com/hanruihua/ir-sim
7
7
  Classifier: Programming Language :: Python :: 3
8
8
  Classifier: License :: OSI Approved :: MIT License
9
9
  Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.7
10
+ Requires-Python: >=3.8
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: matplotlib==3.9.0
14
- Requires-Dist: shapely==2.0.6
13
+ Requires-Dist: matplotlib<3.10.0
14
+ Requires-Dist: shapely>=2.0.3
15
15
  Requires-Dist: numpy
16
16
  Requires-Dist: pyyaml
17
17
  Requires-Dist: imageio
@@ -62,7 +62,7 @@ It provides the following features:
62
62
 
63
63
  ## Prerequisite
64
64
 
65
- - Python: >= 3.7
65
+ - Python: >= 3.8
66
66
 
67
67
  ## Installation
68
68
 
@@ -130,15 +130,22 @@ robot:
130
130
  color: 'g' # green
131
131
  ```
132
132
 
133
-
134
133
  ### Advanced Usage
135
134
 
136
135
  The advanced usages are listed in the [irsim/usage](https://github.com/hanruihua/ir-sim/tree/main/irsim/usage)
137
136
 
138
137
  ## Academic Cases
139
138
  - [rl-rvo-nav](https://github.com/hanruihua/rl_rvo_nav) (RAL & ICRA2023)
140
- - [RDA_planner](https://github.com/hanruihua/RDA_planner)RAL & IROS2023
139
+ - [RDA_planner](https://github.com/hanruihua/RDA_planner) (RAL & IROS2023)
140
+
141
+ ## Contributing
142
+
143
+ This project is under development. I appreciate and welcome all contributions. Just open an issue or a pull request. Here are some simple ways to start contributing:
141
144
 
145
+ - Enhance the website documentation, such as the API and tutorials.
146
+ - Add new sensors, behaviors, robot models, and functional interfaces.
147
+ - Add new usage examples and benchmarks.
148
+ - Report bugs and issues.
142
149
 
143
150
  ## Acknowledgement
144
151
 
@@ -1,5 +1,5 @@
1
- matplotlib==3.9.0
2
- shapely==2.0.6
1
+ matplotlib<3.10.0
2
+ shapely>=2.0.3
3
3
  numpy
4
4
  pyyaml
5
5
  imageio
@@ -349,10 +349,10 @@ class EnvBase:
349
349
  """
350
350
 
351
351
  self._reset_all()
352
- self.reset_plot()
353
- self._world.reset()
354
352
  self.step(action=np.zeros((2, 1)))
355
-
353
+ self._world.reset()
354
+ self.reset_plot()
355
+
356
356
  def _reset_all(self):
357
357
  [obj.reset() for obj in self.objects]
358
358
 
@@ -364,9 +364,10 @@ class EnvBase:
364
364
  plt.cla()
365
365
  self._env_plot.init_plot(self._world.grid_map, self.objects)
366
366
 
367
+
367
368
  # region: environment change
368
369
  def random_obstacle_position(
369
- self, range_low=[0, 0, -3.14], range_high=[10, 10, 3.14]
370
+ self, range_low=[0, 0, -3.14], range_high=[10, 10, 3.14], ids=None, non_overlapping=False
370
371
  ):
371
372
  """
372
373
  Random obstacle positions in the environment.
@@ -374,21 +375,36 @@ class EnvBase:
374
375
  Args:
375
376
  range_low (list [x, y, theta]): Lower bound of the random range for the obstacle states. Default is [0, 0, -3.14].
376
377
  range_high (list [x, y, theta]): Upper bound of the random range for the obstacle states. Default is [10, 10, 3.14].
378
+ ids (list): A list of IDs of objects for which to set random positions. Default is None.
379
+ non_overlapping (bool): If set, the obstacles that will be reset to random obstacles will not overlap with other obstacles. Default is False.
377
380
  """
378
-
381
+ if ids is None:
382
+ ids = [obs.id for obs in self.obstacle_list]
379
383
  if isinstance(range_low, list):
380
384
  range_low = np.c_[range_low]
381
385
 
382
386
  if isinstance(range_high, list):
383
387
  range_high = np.c_[range_high]
384
388
 
385
- random_states = np.random.uniform(
386
- range_low, range_high, (3, self.obstacle_number)
387
- )
389
+ selected_obs = [obs for obs in self.obstacle_list if obs.id in ids]
390
+ existing_obj = [obj for obj in self.objects if obj.id not in ids]
388
391
 
389
- for i, obj in enumerate(self.obstacle_list):
390
- obj.set_state(random_states[:, i].reshape(3, 1), init=True)
392
+ for obj in selected_obs:
393
+
394
+ if not non_overlapping:
395
+ obj.set_state(np.random.uniform(range_low, range_high, (3, 1)), init=True)
396
+ else:
397
+ counter = 0
391
398
 
399
+ while counter < 100:
400
+ obj.set_state(np.random.uniform(range_low, range_high, (3, 1)), init=True)
401
+
402
+ if any([obj.check_collision(exi_obj) for exi_obj in existing_obj]):
403
+ counter += 1
404
+ else:
405
+ existing_obj.append(obj)
406
+ break
407
+
392
408
  self._env_plot.clear_components("all", self.obstacle_list)
393
409
  self._env_plot.draw_components("all", self.obstacle_list)
394
410
 
@@ -79,15 +79,19 @@ class EnvPlot:
79
79
  tight (bool, optional): Whether to show the axis tightly. Default is True.
80
80
  """
81
81
 
82
- self.ax.set_aspect("equal")
83
- self.ax.set_aspect("equal")
82
+ if isinstance(self.ax, Axes3D):
83
+ self.ax.set_box_aspect([1, 1, 1])
84
+ else:
85
+ self.ax.set_aspect("equal")
86
+ self.ax.set_aspect("equal")
87
+
84
88
  self.ax.set_xlim(self.x_range)
85
89
  self.ax.set_ylim(self.y_range)
86
90
 
87
91
  self.ax.set_xlabel("x [m]")
88
92
  self.ax.set_ylabel("y [m]")
89
93
 
90
- self.draw_components("static", objects)
94
+ self.draw_components("all", objects)
91
95
  self.draw_grid_map(grid_map)
92
96
 
93
97
  if no_axis:
@@ -306,7 +310,9 @@ class EnvPlot:
306
310
  kwargs: Additional arguments for saving the animation.
307
311
  See `format_gif <https://imageio.readthedocs.io/en/v2.8.0/format_gif-pil.html>`_ for details.
308
312
  """
309
- self.saved_ani_kwargs.update({"subrectangles": True, "loop": 0})
313
+ if suffix=='.gif':
314
+ self.saved_ani_kwargs.update({"subrectangles": True, "loop": 0})
315
+
310
316
  self.saved_ani_kwargs.update(kwargs)
311
317
 
312
318
  env_param.logger.info("Start to create animation")
@@ -372,7 +372,7 @@ class reciprocal_vel_obs:
372
372
  2 * vel[0] - self.state[2] - moving[2],
373
373
  2 * vel[1] - self.state[3] - moving[3],
374
374
  ]
375
- vel_trans_speed = np.sqrt(vel_trans[0] ** 2 + vel_trans[1] ** 2)
375
+ vel_trans_speed = np.sqrt(vel_trans[0] ** 2 + vel_trans[1] ** 2) + 1e-7
376
376
 
377
377
  tc = dis_vel / vel_trans_speed
378
378
 
@@ -49,7 +49,8 @@ class OmniKinematics(KinematicsHandler):
49
49
  super().__init__(name, noise, alpha)
50
50
 
51
51
  def step(self, state: np.ndarray, velocity: np.ndarray, step_time: float) -> np.ndarray:
52
- next_state = omni_kinematics(state, velocity, step_time, self.noise, self.alpha)
52
+ next_position = omni_kinematics(state[0:2], velocity, step_time, self.noise, self.alpha)
53
+ next_state = np.concatenate((next_position, state[2:]))
53
54
  return next_state
54
55
 
55
56
 
@@ -1,6 +1,6 @@
1
1
  import irsim
2
2
 
3
- env = irsim.make(save_ani=True, display=False, projection='3d')
3
+ env = irsim.make(save_ani=True, display=False)
4
4
 
5
5
  for i in range(300):
6
6
 
@@ -10,4 +10,5 @@ for i in range(300):
10
10
  if env.done():
11
11
  break
12
12
 
13
- env.end(3)
13
+ # env.end(3)
14
+ env.end(suffix='.mp4')
@@ -514,7 +514,7 @@ class ObjectBase:
514
514
 
515
515
  def mid_process(self, state):
516
516
  """
517
- Process state in the middle of a step.
517
+ Process state in the middle of a step. Make sure the state is within the desired dimension.
518
518
 
519
519
  Args:
520
520
  state (np.ndarray): State vector.
@@ -526,10 +526,13 @@ class ObjectBase:
526
526
  state[2, 0] = WrapToRegion(state[2, 0], self.info.angle_range)
527
527
 
528
528
  if state.shape[0] < self.state_dim:
529
- state = np.r_[
530
- state,
531
- np.zeros((self.state_dim - state.shape[0], state.shape[1])),
532
- ]
529
+ pad_value = self.state[self.state_dim - 1, 0] if self.state.shape[0] >= self.state_dim else 0
530
+
531
+ pad_rows = self.state_dim - state.shape[0]
532
+
533
+ padding = pad_value * np.ones((pad_rows, state.shape[1]))
534
+ state = np.concatenate((state, padding), axis=0)
535
+
533
536
  elif state.shape[0] > self.state_dim:
534
537
  state = state[: self.state_dim]
535
538
 
@@ -6,25 +6,26 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "ir-sim"
9
- version = "2.3.2"
9
+ version = "2.3.4"
10
10
  authors = [
11
11
  { name="Han Ruihua", email="hanrh@connect.hku.hk" },
12
12
  ]
13
- description = "Open-source, lightweight robot 2D simulator based on Python, specifically designed for intelligent robotics navigation and learning."
13
+ description = "an open-source, lightweight robot simulator based on Python, specifically designed for intelligent robotics navigation and learning. Primarily intended for research and educational purposes, it is user-friendly and easily customizable."
14
14
  readme = "README.md"
15
- requires-python = ">=3.7"
15
+ requires-python = ">=3.8"
16
16
  classifiers = [
17
17
  "Programming Language :: Python :: 3",
18
18
  "License :: OSI Approved :: MIT License",
19
19
  "Operating System :: OS Independent",
20
20
  ]
21
- dependencies = ['matplotlib==3.9.0',
22
- 'shapely==2.0.6',
23
- 'numpy',
24
- 'pyyaml',
25
- 'imageio',
26
- 'loguru',
27
- 'tabulate',
21
+ dependencies = [
22
+ 'matplotlib<3.10.0',
23
+ 'shapely>=2.0.3',
24
+ 'numpy',
25
+ 'pyyaml',
26
+ 'imageio',
27
+ 'loguru',
28
+ 'tabulate',
28
29
  ]
29
30
 
30
31
  [project.optional-dependencies]
@@ -39,4 +40,4 @@ exclude = ["doc*", "tests*"]
39
40
  "*" = ["*.png", "*.yaml"]
40
41
 
41
42
  [project.urls]
42
- "Homepage" = "https://github.com/hanruihua/ir-sim"
43
+ "Homepage" = "https://github.com/hanruihua/ir-sim"
@@ -6,9 +6,9 @@ import matplotlib.pyplot as plt
6
6
 
7
7
  plt.close('all')
8
8
 
9
+
9
10
  @time_it("test_all_objects")
10
11
  def test_all_objects():
11
-
12
12
  env1 = irsim.make("test_collision_avoidance.yaml", save_ani=False, full=False, display=False)
13
13
 
14
14
  for i in range(50):
@@ -16,12 +16,12 @@ def test_all_objects():
16
16
  env1.render(0.01)
17
17
 
18
18
  env1.draw_trajectory(env1.robot.trajectory, show_direction=True)
19
-
19
+
20
20
  if env1.done():
21
21
  print('done')
22
22
 
23
23
  env1.end()
24
-
24
+
25
25
  env2 = irsim.make('test_all_objects.yaml', display=False)
26
26
 
27
27
  env2.random_polygon_shape()
@@ -42,7 +42,7 @@ def test_all_objects():
42
42
  for i in range(3):
43
43
  env3.step()
44
44
  env3.render(0.01)
45
- env3.end()
45
+ env3.end(ani_name='test_animation')
46
46
 
47
47
  env4 = irsim.make('test_collision_world.yaml', save_ani=False, display=False)
48
48
 
@@ -95,7 +95,7 @@ def test_all_objects():
95
95
  for i in range(10):
96
96
  env8.step()
97
97
  env8.render(0.01)
98
-
98
+
99
99
  env8.end()
100
100
 
101
101
  env9 = irsim.make('test_fov_world.yaml', save_ani=False, display=False)
@@ -104,12 +104,22 @@ def test_all_objects():
104
104
  for obs in env9.obstacle_list:
105
105
  if obs.fov_detect_object(env9.robot):
106
106
  pass
107
-
107
+
108
108
  env9.step()
109
109
  env9.render(0.01)
110
110
  env9.end()
111
111
 
112
+ env10 = irsim.make('test_multi_objects_world.yaml', save_ani=False, display=False, projection='3d')
113
+
114
+ env10.random_obstacle_position(ids=[3, 4, 5, 6, 7], non_overlapping=True)
115
+
116
+ for i in range(5):
117
+ env10.step()
118
+ env10.render(0.01)
119
+ env10.end()
120
+
112
121
  plt.close('all')
113
122
 
123
+
114
124
  if __name__ == "__main__":
115
125
  test_all_objects()
@@ -6,9 +6,9 @@ import matplotlib.pyplot as plt
6
6
 
7
7
  plt.close('all')
8
8
 
9
+
9
10
  @time_it("test_all_objects")
10
11
  def test_all_objects():
11
-
12
12
  env1 = irsim.make("test_collision_avoidance.yaml", save_ani=False, full=False, display=False, projection='3d')
13
13
 
14
14
  for i in range(50):
@@ -16,12 +16,12 @@ def test_all_objects():
16
16
  env1.render(0.01)
17
17
 
18
18
  env1.draw_trajectory(env1.robot.trajectory, show_direction=True)
19
-
19
+
20
20
  if env1.done():
21
21
  print('done')
22
22
 
23
23
  env1.end()
24
-
24
+
25
25
  env2 = irsim.make('test_all_objects.yaml', display=False, projection='3d')
26
26
 
27
27
  env2.random_polygon_shape()
@@ -42,7 +42,7 @@ def test_all_objects():
42
42
  for i in range(3):
43
43
  env3.step()
44
44
  env3.render(0.01)
45
- env3.end()
45
+ env3.end(ani_name='test_animation')
46
46
 
47
47
  env4 = irsim.make('test_collision_world.yaml', save_ani=False, display=False, projection='3d')
48
48
 
@@ -95,10 +95,20 @@ def test_all_objects():
95
95
  for i in range(10):
96
96
  env8.step()
97
97
  env8.render(0.01)
98
-
98
+
99
99
  env8.end()
100
100
 
101
+ env9 = irsim.make('test_multi_objects_world.yaml', save_ani=False, display=False, projection='3d')
102
+
103
+ env9.random_obstacle_position(ids=[3, 4, 5, 6, 7])
104
+
105
+ for i in range(5):
106
+ env9.step()
107
+ env9.render(0.01)
108
+ env9.end()
109
+
101
110
  plt.close('all')
102
111
 
112
+
103
113
  if __name__ == "__main__":
104
114
  test_all_objects()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes