-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
583 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,11 @@ | |
Author: Ruihua Han ([email protected]) | ||
''' | ||
|
||
import yaml | ||
import matplotlib | ||
|
||
matplotlib.use("TkAgg") | ||
from irsim.env.env_config import EnvConfig | ||
from irsim.world import world | ||
from irsim.world import World | ||
from .env_plot import EnvPlot | ||
from irsim.global_param import world_param, env_param | ||
from irsim.world.object_factory import ObjectFactory | ||
|
@@ -58,9 +57,9 @@ def __init__( | |
|
||
self.env_config = EnvConfig(world_name) | ||
object_factory = ObjectFactory() | ||
|
||
# init objects (world, obstacle, robot) | ||
self._world = world(world_name, **self.env_config.parse["world"]) | ||
|
||
self._world = World(world_name, **self.env_config.parse["world"]) | ||
|
||
self._robot_collection = object_factory.create_from_parse( | ||
self.env_config.parse["robot"], "robot" | ||
|
@@ -71,9 +70,6 @@ def __init__( | |
self._map_collection = object_factory.create_from_map( | ||
self._world.obstacle_positions, self._world.buffer_reso | ||
) | ||
self._object_collection = ( | ||
self._robot_collection + self._obstacle_collection + self._map_collection | ||
) | ||
|
||
# env parameters | ||
self._env_plot = EnvPlot( | ||
|
@@ -83,6 +79,7 @@ def __init__( | |
self._world.y_range, | ||
**self.env_config.parse["plot"], | ||
) | ||
|
||
env_param.objects = self.objects | ||
|
||
if world_param.control_mode == "keyboard": | ||
|
@@ -609,7 +606,7 @@ def obstacle_list(self): | |
|
||
@property | ||
def objects(self): | ||
return self._object_collection | ||
return self._robot_collection + self._obstacle_collection + self._map_collection | ||
|
||
@property | ||
def step_time(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,30 @@ | ||
from .env_plot import EnvPlot | ||
import matplotlib.pyplot as plt | ||
|
||
|
||
class EnvPlot3D(EnvPlot): | ||
|
||
def __init__( | ||
self, | ||
grid_map=None, | ||
self,grid_map=None, | ||
objects=[], | ||
x_range=[0, 10], | ||
y_range=[0, 10], | ||
z_range=[0, 10], | ||
saved_figure=dict(), | ||
saved_ani=dict(), | ||
dpi: int = 100, | ||
figure_pixels: list = [1920, 1080], | ||
figure_pixels: list =[1920, 1080], | ||
**kwargs, | ||
): | ||
super().__init__( | ||
grid_map, | ||
objects, | ||
x_range, | ||
y_range, | ||
saved_figure, | ||
saved_ani, | ||
dpi, | ||
figure_pixels, | ||
**kwargs, | ||
) | ||
|
||
self.fig, self.ax = plt.subplots( | ||
figsize=(figure_pixels[0] / dpi, figure_pixels[1] / dpi), | ||
dpi=dpi, | ||
subplot_kw={"projection": "3d"}, | ||
) | ||
super().__init__(grid_map, objects, x_range, y_range, saved_figure, saved_ani, dpi, figure_pixels, **kwargs) | ||
|
||
self.clear_components() | ||
self.ax = self.fig.add_subplot(111, projection='3d') | ||
|
||
self.init_plot(grid_map, objects, **kwargs) | ||
self.ax.set_zlim(z_range) | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
world: | ||
height: 50 # the height of the world | ||
width: 50 # the height of the world | ||
step_time: 0.1 # 10Hz calculate each step | ||
sample_time: 0.1 # 10 Hz for render and data extraction | ||
offset: [0, 0] # the offset of the world on x and y | ||
|
||
robot: | ||
- kinematics: {name: 'acker'} # omni, diff, acker | ||
shape: {name: 'rectangle', length: 4.6, width: 1.6, wheelbase: 3} | ||
state: [1, 1, 0, 0] | ||
goal: [40, 40, 0] | ||
vel_max: [4, 1] | ||
behavior: {name: 'dash'} # move toward to the goal directly | ||
plot: | ||
show_trajectory: True | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
world: | ||
height: 10 # the height of the world | ||
width: 10 # the height of the world | ||
step_time: 0.1 # 10Hz calculate each step | ||
sample_time: 0.1 # 10 Hz for render and data extraction | ||
offset: [0, 0] # the offset of the world on x and y | ||
|
||
robot: | ||
- kinematics: {name: 'omni'} # omni, diff, acker | ||
# shape: {name: 'circle', radius: 0.2} # radius | ||
shape: {name: 'rectangle', length: 0.3, width: 1.0} | ||
state: [1, 1, 0] | ||
goal: [9, 9, 0] | ||
# acce: [3, .inf] # acce of [linear, angular] or [v_x, v_y] or [linear, steer] | ||
behavior: {name: 'dash'} # move toward to the goal directly | ||
color: 'g' | ||
state_dim: 3 | ||
plot: | ||
show_trajectory: True | ||
# description: 'diff_robot0.png' | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
world: | ||
height: 10 # the height of the world | ||
width: 10 # the height of the world | ||
step_time: 0.1 # 10Hz calculate each step | ||
sample_time: 0.1 # 10 Hz for render and data extraction | ||
offset: [0, 0] # the offset of the world on x and y | ||
|
||
robot: | ||
kinematics: {name: 'diff'} # omni, diff, acker | ||
shape: {name: 'polygon', vertices: [[0.1, 0.2], [-0.1, 0.3], [0, -0.3], [0.3, -0.2]]} # radius | ||
behavior: {name: 'dash'} # move toward to the goal directly | ||
state: [1, 1, 0] | ||
goal: [9, 9, 0] | ||
# acce: [3, .inf] # acce of [linear, angular] or [v_x, v_y] or [linear, steer] | ||
color: 'g' | ||
plot: | ||
show_trajectory: True | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ robot: | |
color: 'g' | ||
plot: | ||
show_trajectory: True | ||
show_trail: True | ||
# description: 'diff_robot0.png' | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
from irsim.world.world import world | ||
from irsim.world.world import World | ||
from irsim.world.sensors.sensor_factory import SensorFactory | ||
|
||
|
||
from irsim.world.object_base import ObjectBase | ||
from irsim.world.robots.robot_diff import RobotDiff | ||
from irsim.world.robots.robot_acker import RobotAcker | ||
from irsim.world.robots.robot_omni import RobotOmni | ||
|
||
from irsim.world.object_base_3d import ObjectBase3D | ||
from irsim.world.robots.robot_diff_3d import RobotDiff3D | ||
from irsim.world.robots.robot_acker_3d import RobotAcker3D | ||
from irsim.world.robots.robot_omni_3d import RobotOmni3D | ||
|
||
from irsim.world.obstacles.obstacle_diff import ObstacleDiff | ||
from irsim.world.obstacles.obstacle_omni import ObstacleOmni | ||
from irsim.world.obstacles.obstacle_acker import ObstacleAcker | ||
|
||
from irsim.world.obstacles.obstacle_diff_3d import ObstacleDiff3D | ||
from irsim.world.obstacles.obstacle_omni_3d import ObstacleOmni3D | ||
from irsim.world.obstacles.obstacle_acker_3d import ObstacleAcker3D | ||
|
||
from irsim.world.map.obstacle_map import ObstacleMap | ||
|
||
from irsim.world.obstacles.obstacle_static import ObjectStatic | ||
from irsim.world.obstacles.obstacle_static_3d import ObjectStatic3D | ||
|
||
from irsim.world.object_factory import ObjectFactory | ||
|
Oops, something went wrong.