Skip to content

Commit 2c93772

Browse files
committed
Address comments - part 1
Signed-off-by: Steven Desvars <steven.desvars@ekumenlabs.com>
1 parent e855b7a commit 2c93772

File tree

5 files changed

+59
-22
lines changed

5 files changed

+59
-22
lines changed

ar4_isaac/launch/ar4_in_empty_world.launch.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,50 @@
3434
import os
3535
from ament_index_python.packages import get_package_share_directory
3636
from launch import LaunchDescription
37-
from launch.actions import ExecuteProcess
37+
from launch.actions import DeclareLaunchArgument, ExecuteProcess
38+
from launch.conditions import IfCondition, UnlessCondition
39+
from launch.substitutions import LaunchConfiguration
3840

3941

4042
def generate_launch_description():
41-
pkg_andino_isaac_path = get_package_share_directory('ar4_isaac')
42-
run_sim_path = os.path.join(pkg_andino_isaac_path, 'scripts', 'run_sim.py')
43+
headless = LaunchConfiguration('headless') # noqa F841
44+
declare_headless = DeclareLaunchArgument(
45+
'headless',
46+
default_value='false',
47+
description='Launch Isaac in headless mode',
48+
)
49+
50+
pkg_ar4_isaac = get_package_share_directory('ar4_isaac')
51+
run_sim_path = os.path.join(pkg_ar4_isaac, 'scripts', 'run_sim.py')
4352

4453
isaac_process = ExecuteProcess(
4554
cmd=[
4655
'/isaac-sim/python.sh',
4756
run_sim_path,
4857
'--robot_model_path',
49-
os.path.join(pkg_andino_isaac_path, 'usda', 'ar4.usda'),
58+
os.path.join(pkg_ar4_isaac, 'usda', 'ar4.usda'),
59+
],
60+
shell=True,
61+
output='screen',
62+
condition=UnlessCondition(LaunchConfiguration('headless')),
63+
)
64+
65+
isaac_process_headless = ExecuteProcess(
66+
cmd=[
67+
'/isaac-sim/python.sh',
68+
run_sim_path,
69+
'--robot_model_path',
70+
os.path.join(pkg_ar4_isaac, 'usda', 'ar4.usda'),
71+
'--headless',
5072
],
5173
shell=True,
5274
output='screen',
75+
condition=IfCondition(LaunchConfiguration('headless')),
5376
)
5477

5578
ld = LaunchDescription()
79+
ld.add_action(declare_headless)
5680
ld.add_action(isaac_process)
81+
ld.add_action(isaac_process_headless)
5782

5883
return ld

ar4_isaac/launch/moveit.launch.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@
4040
def generate_launch_description():
4141
"""Launch the AR4 robot in Isaac and MoveIt."""
4242
use_sim_time = LaunchConfiguration('use_sim_time')
43+
headless = LaunchConfiguration('headless')
4344
declare_use_sim_time_cmd = DeclareLaunchArgument(
4445
'use_sim_time',
4546
default_value='true',
4647
description='Use simulation (Isaac) clock if true',
4748
)
49+
declare_headless = DeclareLaunchArgument(
50+
'headless',
51+
default_value='false',
52+
description='Launch Isaac in headless mode',
53+
)
4854

4955
ar4_isaac_pkg = FindPackageShare('ar4_isaac')
5056
ar4_moveit_config_pkg = FindPackageShare('ar4_moveit_config')
@@ -58,7 +64,10 @@ def generate_launch_description():
5864
'ar4_in_empty_world.launch.py',
5965
]
6066
)
61-
)
67+
),
68+
launch_arguments={
69+
'headless': headless,
70+
}.items(),
6271
)
6372

6473
controllers_launch = IncludeLaunchDescription(
@@ -90,6 +99,7 @@ def generate_launch_description():
9099

91100
ld = LaunchDescription()
92101
ld.add_action(declare_use_sim_time_cmd)
102+
ld.add_action(declare_headless)
93103
ld.add_action(isaac_launch)
94104
ld.add_action(controllers_launch)
95105
ld.add_action(moveit_launch)

ar4_isaac/package.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
<package format="3">
33
<name>ar4_isaac</name>
44
<version>0.0.1</version>
5-
<description>
6-
Launch Isaac simulation with Ar4 robot.
7-
</description>
5+
<description>Launch Isaac simulation with Ar4 robot.</description>
86
<author email="santiago.mendez@creativa77.com.ar">Santiago Lopez mendez</author>
97
<maintainer email="steven.desvars@creativa77.com.ar">Steven Desvars</maintainer>
108
<maintainer email="santiago.mendez@creativa77.com.ar">Santiago Lopez mendez</maintainer>
@@ -14,6 +12,7 @@
1412

1513
<exec_depend>controller_manager</exec_depend>
1614
<exec_depend>topic_based_ros2_control</exec_depend>
15+
<exec_depend>ros2launch</exec_depend>
1716

1817
<export>
1918
<build_type>ament_cmake</build_type>

docker/Dockerfile.isaac

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ FROM nvcr.io/nvidia/isaac-sim:4.2.0
33
ENV DEBIAN_FRONTEND=noninteractive
44

55
# Add ROS 2 key
6-
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
7-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
6+
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
7+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
88

99
# Install base system dependencies and development dependencies
10-
RUN apt-get update && \
11-
apt-get install --no-install-recommends -y \
10+
RUN apt-get update \
11+
&& apt-get install --no-install-recommends -y \
1212
apt-utils \
1313
bash-completion \
1414
build-essential \
@@ -29,6 +29,7 @@ RUN apt-get update && \
2929
python3-rosdep \
3030
python3-setuptools \
3131
python3.10 \
32+
screen \
3233
software-properties-common \
3334
sudo \
3435
tmux && \
@@ -58,20 +59,23 @@ RUN pip install --no-cache-dir --extra-index-url https://pypi.nvidia.com \
5859
nest-asyncio
5960

6061
# Ensure cache folder is created, and symlink it to an easier to mount folder for persistance
61-
RUN mkdir -p /usr/local/lib/python3.10/dist-packages/omni/cache && \
62-
ln -s /usr/local/lib/python3.10/dist-packages/omni/cache /root/.isaac-sim-cache
62+
RUN mkdir -p /usr/local/lib/python3.10/dist-packages/omni/cache \
63+
&& ln -s /usr/local/lib/python3.10/dist-packages/omni/cache /root/.isaac-sim-cache
6364

6465
# Install ROS 2
65-
RUN apt-get update && apt-get install --no-install-recommends -y \
66-
ros-humble-desktop
66+
RUN apt-get update \
67+
&& apt-get install --no-install-recommends -y \
68+
ros-humble-desktop \
69+
&& rm -rf /var/lib/apt/lists/*
6770

6871
# Install ros dependencies, updating the apt cache is necessary.
6972
RUN --mount=type=bind,source=.,target=/tmp/ws \
70-
rosdep init && \
71-
apt-get update && \
72-
. /opt/ros/humble/setup.sh && \
73-
rosdep update && \
74-
rosdep install --from-paths /tmp/ws --ignore-src -r -y
73+
rosdep init \
74+
&& apt-get update \
75+
&& . /opt/ros/humble/setup.sh \
76+
&& rosdep update \
77+
&& rosdep install --from-paths /tmp/ws --ignore-src -r -y \
78+
&& rm -rf /var/lib/apt/lists/*
7579

7680
WORKDIR /workspace
7781

docker/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ services:
4646
PRIVACY_CONSENT: Y
4747
QT_X11_NO_MITSHM: 1
4848
RMW_IMPLEMENTATION: rmw_fastrtps_cpp
49-
ROS_DISTRO: humble
5049
XAUTHORITY: /tmp/.docker.xauth
5150
volumes:
5251
- /tmp/.X11-unix:/tmp/.X11-unix:rw

0 commit comments

Comments
 (0)