Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unity world launching #161

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arena_bringup/launch/start_arena.launch
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
<!--<arg name="world" default="$(arg world_file)" />-->
<arg name="development_mode" value="$(arg development_mode)" />
<arg name="headless" value="$(arg headless_unity)" />
<arg name="map_file" value="$(arg map_file)" />
</include>

<!-- map server-->
Expand Down
4 changes: 3 additions & 1 deletion arena_bringup/launch/testing/simulators/unity.launch
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

<arg name="development_mode" default="false" />
<arg name="headless" default="false"/>
<arg name="map_file" default="map_empty" />

<node name="unity_sim_node" pkg="unity_launcher" type="launch_unity_sim.py" output="screen">
<param name="development_mode" value="$(arg development_mode)" />
<param name="headless" value="$(arg headless)" />
<param name="map_file" value="$(arg map_file)" />
</node>

</launch>
</launch>
3 changes: 2 additions & 1 deletion task_generator/task_generator/manager/obstacle_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from task_generator.manager.world_manager import WorldManager
from task_generator.shared import DynamicObstacle, Obstacle
from task_generator.simulators.base_simulator import BaseSimulator
from task_generator.utils import Utils


class ObstacleManager:
Expand Down Expand Up @@ -38,7 +39,7 @@ def spawn_world_obstacles(self, world: World):
self._entity_manager.spawn_walls(
walls=world.entities.walls, heightmap=world.map)

if isinstance(self._simulator, UnitySimulator):
if isinstance(self._simulator, UnitySimulator) and not Utils.is_unity_map():
self._simulator.spawn_walls(world.entities.walls)

self._entity_manager.spawn_obstacles(
Expand Down
4 changes: 4 additions & 0 deletions task_generator/task_generator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def get_arena_type() -> Constants.ArenaType:
def is_synthetic_map() -> bool:
return rosparam_get(str, "map_file") in ["dynamic_map"]

@staticmethod
def is_unity_map() -> bool:
return "_unity".casefold() in rosparam_get(str, "map_file").casefold()

@staticmethod
def generate_map_inner_border(free_space_indices, map_: nav_msgs.OccupancyGrid):
"""generate map border (four vertices of the map)
Expand Down
7 changes: 5 additions & 2 deletions utils/misc/unity_launcher/src/launch_unity_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def launch_unity():
rospy.init_node('unity_sim_node', anonymous=True)

dev = rospy.get_param('~development_mode', False)
map = rospy.get_param('~map_file', "map_empty")
if isinstance(dev, bool) and dev:
# Unity should be launched trough Unity Editor in dev mode
return
Expand All @@ -33,8 +34,10 @@ def launch_unity():

# test
args += ["-force-vulkan"]




args += ["-map", map]

subprocess.run([unity_executable_path] + args, check=True)


Expand Down