Skip to content

Commit

Permalink
Merge pull request #8 from Arena-Rosnav/unity-simulator
Browse files Browse the repository at this point in the history
Unity simulator update
  • Loading branch information
TheZomb authored Dec 24, 2023
2 parents 5c0a64a + 29bc196 commit 29c5c72
Show file tree
Hide file tree
Showing 39 changed files with 25,278 additions and 18 deletions.
10 changes: 10 additions & 0 deletions .rosinstall
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
uri: https://github.com/Arena-Rosnav/flatland.git
version: master

- git:
local-name: ../arena-unity
uri: https://github.com/Arena-Rosnav/arena-unity.git
version: main

# - git:
# local-name: ../utils/arena-tools
# uri: https://github.com/Arena-Rosnav/arena-tools.git
Expand Down Expand Up @@ -41,6 +46,11 @@
local-name: ../utils-extern/ros/move_base_flex
uri: https://github.com/voshch/move_base_flex.git

- git:
local-name: ../utils-extern/ros/ros_tcp_endpoint
uri: https://github.com/Unity-Technologies/ROS-TCP-Endpoint.git
version: main

- git:
local-name: ../utils-extern/misc/robots
uri: https://github.com/Arena-Rosnav/3rd-party-robot-packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from typing import Callable, List

from task_generator.simulators.gazebo_simulator import GazeboSimulator
from task_generator.simulators.unity_simulator import UnitySimulator
from task_generator.utils import rosparam_get

from tf.transformations import quaternion_from_euler, euler_from_quaternion
Expand Down Expand Up @@ -528,7 +529,7 @@ def remove_obstacles(self, purge):

for obstacle_id, obstacle in self._known_obstacles.items():
if purge >= obstacle.layer:
if isinstance(self._simulator, GazeboSimulator):
if isinstance(self._simulator, GazeboSimulator) or isinstance(self._simulator, UnitySimulator):
# TODO remove this once actors can be deleted properly
if isinstance(obstacle.obstacle, DynamicObstacle):

Expand Down
36 changes: 19 additions & 17 deletions task_generator/task_generator/simulators/unity_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, namespace: str):
rospy.wait_for_service(self._namespace(
"unity", "set_model_state"), timeout=T)

# TODO: Proper Message Types
# TODO: Custom Message Types
self._spawn_walls_srv = rospy.ServiceProxy(
self._namespace("unity", "spawn_walls"), SpawnWalls
)
Expand Down Expand Up @@ -80,17 +80,17 @@ def spawn_entity(self, entity):
request.initial_pose = Pose(
position=Point(
x=entity.position[0],
y=0,
z=entity.position[1]
y=entity.position[1],
z=0.35
),
orientation=Quaternion(*quaternion_from_euler(0.0, entity.position[2], 0.0, axes="sxyz")
)
orientation=Quaternion(*quaternion_from_euler(0.0, 0.0, entity.position[2], axes="sxyz"))
)

rospy.set_param(request.robot_namespace(
"robot_description"), model.description)
rospy.set_param(request.robot_namespace(
"tf_prefix"), str(request.robot_namespace))
if isinstance(entity, Robot):
rospy.set_param(request.robot_namespace(
"robot_description"), model.description)
rospy.set_param(request.robot_namespace(
"tf_prefix"), str(request.robot_namespace))

res = self.spawn_model(model.type, request)
return res.success
Expand All @@ -102,13 +102,15 @@ def move_entity(self, name, position):
request.model_state = ModelState()

request.model_state.model_name = name
pose = Pose()
# Keep in mind that y axis is up
pose.position.x = position[0]
pose.position.y = 0.35
pose.position.z = position[1]
pose.orientation = Quaternion(
*quaternion_from_euler(0.0, position[2], 0.0, axes="sxyz")
pose = Pose(
position=Point(
x = position[0],
y = position[1],
z = 0.35
),
orientation=Quaternion(
*quaternion_from_euler(0.0, 0.0, position[2], axes="sxyz")
)
)
request.model_state.pose = pose
request.model_state.reference_frame = "world"
Expand Down Expand Up @@ -143,4 +145,4 @@ def spawn_walls(self, walls: WorldWalls):
request = SpawnWallsRequest()
request.walls_string = "/".join([f"{wall[0].x},{wall[0].y};{wall[1].x},{wall[1].y}" for wall in walls])

self._spawn_walls_srv(request)
self._spawn_walls_srv(request)
Binary file added utils/misc/unity_simulator/UnityPlayer.so
Binary file not shown.
Binary file added utils/misc/unity_simulator/unity_simulator.x86_64
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<configuration>
<dllmap dll="i:cygwin1.dll" target="libc.so.6" os="!windows" />
<dllmap dll="libc" target="libc.so.6" os="!windows"/>
<dllmap dll="intl" target="libc.so.6" os="!windows"/>
<dllmap dll="intl" name="bind_textdomain_codeset" target="libc.so.6" os="solaris"/>
<dllmap dll="libintl" name="bind_textdomain_codeset" target="libc.so.6" os="solaris"/>
<dllmap dll="libintl" target="libc.so.6" os="!windows"/>
<dllmap dll="i:libxslt.dll" target="libxslt.so" os="!windows"/>
<dllmap dll="i:odbc32.dll" target="libodbc.so.2" os="!windows"/>
<dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
<dllmap dll="oci" target="libclntsh.so" os="!windows"/>
<dllmap dll="db2cli" target="libdb2_36.so" os="!windows"/>
<dllmap dll="MonoPosixHelper" target="libMonoPosixHelper.so" os="!windows" />
<dllmap dll="System.Native" target="$mono_libdir/libmono-native.so" os="!windows" />
<dllmap dll="System.Net.Security.Native" target="$mono_libdir/libmono-native.so" os="!windows" />
<dllmap dll="System.Security.Cryptography.Native.Apple" target="$mono_libdir/libmono-native.so" os="osx" />
<dllmap dll="libmono-btls-shared" target="libmono-btls-shared.so" os="!windows" />
<dllmap dll="i:msvcrt" target="libc.so.6" os="!windows"/>
<dllmap dll="i:msvcrt.dll" target="libc.so.6" os="!windows"/>
<dllmap dll="sqlite" target="libsqlite.so.0" os="!windows"/>
<dllmap dll="sqlite3" target="libsqlite3.so.0" os="!windows"/>
<dllmap dll="libX11" target="libX11.so.6" os="!windows" />
<dllmap dll="libgdk-x11-2.0" target="libgdk-x11-2.0.so.0" os="!windows"/>
<dllmap dll="libgdk_pixbuf-2.0" target="libgdk_pixbuf-2.0.so.0" os="!windows"/>
<dllmap dll="libgtk-x11-2.0" target="libgtk-x11-2.0.so.0" os="!windows"/>
<dllmap dll="libglib-2.0" target="libglib-2.0.so.0" os="!windows"/>
<dllmap dll="libgobject-2.0" target="libgobject-2.0.so.0" os="!windows"/>
<dllmap dll="libgnomeui-2" target="libgnomeui-2.so.0" os="!windows"/>
<dllmap dll="librsvg-2" target="librsvg-2.so.2" os="!windows"/>
<dllmap dll="libXinerama" target="libXinerama.so.1" os="!windows" />
<dllmap dll="libasound" target="libasound.so.2" os="!windows" />
<dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
<dllmap dll="libcairo-2.dll" target="libcairo.2.dylib" os="osx"/>
<dllmap dll="libcups" target="libcups.so.2" os="!windows"/>
<dllmap dll="libcups" target="libcups.dylib" os="osx"/>
<dllmap dll="i:kernel32.dll">
<dllentry dll="__Internal" name="CopyMemory" target="mono_win32_compat_CopyMemory"/>
<dllentry dll="__Internal" name="FillMemory" target="mono_win32_compat_FillMemory"/>
<dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/>
<dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/>
</dllmap>
<dllmap dll="gdiplus" target="libgdiplus.so.0" os="!windows"/>
<dllmap dll="gdiplus.dll" target="libgdiplus.so.0" os="!windows"/>
<dllmap dll="gdi32" target="libgdiplus.so.0" os="!windows"/>
<dllmap dll="gdi32.dll" target="libgdiplus.so.0" os="!windows"/>

<!-- Some .net base class library code pinvokes into api-ms-win-core-threadpool-l1-2-0.dll. The only thing this library does is forward the call
to kernel32.dll (on windows desktop, versions on other platforms might forward elsewhere. Unfortunately this library did not ship with windows7.
We're using the dll remap functionality in this file to have mono directly route these calls into kernel32, just like the library would do so that
the BCL code that relies on this can work on windows7 again. This functionality that does not work without this workaround includes NamedServerPipeStream.
-->
<dllmap dll="api-ms-win-core-threadpool-l1-2-0.dll" target="kernel32.dll" os="windows"/>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
This file defines some of the browsers that Microsoft's implementation provides in
<windir>\Microsoft.NET\Framework\<ver>\CONFIG\Browsers\*.browser

It is not derived from any file distributed with Microsoft's implementation. Since
we can't distribute MS's browser files, we use browscap.ini to determine
browser capabilities. Then, if and only if the application contains App_Browser/*.browser
files and we are using .NET 2.0 or higher, we supplement the capabilities with the
information in those files and the files in this directory. The primary goal of this file
is provide browser definitions that might be referenced in App_Browser/*.browser files.
-->
<browsers>
<defaultBrowser id="Default">
</defaultBrowser>
<browser id="Default">
<identification>
<userAgent match="." />
</identification>
</browser>
<browser id="IE6to9" parentID="Default">
<identification>
<capability name="majorver" match="^[6-9]" />
<capability name="browser" match="^(IE|AOL)$" />
</identification>
</browser>
<browser id="Opera8to9" parentID="Default">
<identification>
<capability name="majorver" match="^[8-9]" />
<capability name="browser" match="^Opera$" />
</identification>
</browser>
<browser id="Safari" parentID="Default">
<identification>
<capability name="browser" match="^Safari$" />
</identification>
</browser>
<browser id="Mozilla" parentID="Default">
<identification>
<capability name="browser" match="^Mozilla" />
</identification>
</browser>
</browsers>
Loading

0 comments on commit 29c5c72

Please sign in to comment.