diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..02486f81 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ + +FROM ros:humble + +# Define a few key variables +ENV USERNAME=spaceros-user +ENV HOME_DIR=/home/spaceros-user +ENV DEMO_DIR=${HOME_DIR}/demo_ws +ENV ROSDISTRO=humble + + +# Disable prompting during package installation +ARG DEBIAN_FRONTEND=noninteractive + +# Get rosinstall_generator +# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that +# the cache won't make it into the built image but will be maintained between steps. +RUN sudo apt update && sudo apt install -y python3-pip \ + ros-${ROSDISTRO}-control-msgs \ + ros-${ROSDISTRO}-rviz-common \ + ros-${ROSDISTRO}-rmw-cyclonedds-cpp \ + ros-${ROSDISTRO}-geometry-msgs \ + ros-${ROSDISTRO}-sensor-msgs \ + ros-${ROSDISTRO}-std-msgs \ + ros-${ROSDISTRO}-rosidl-typesupport-fastrtps-cpp \ + ros-${ROSDISTRO}-rosidl-typesupport-fastrtps-c \ + ros-${ROSDISTRO}-rviz2 \ + && sudo rm -rf /var/lib/apt/lists/* + +RUN pip install vcstool +RUN mkdir -p ${DEMO_DIR}/src +WORKDIR ${DEMO_DIR} + + +# Get the source for the dependencies +COPY --chown=${USERNAME}:${USERNAME} demo_manual_pkgs.repos /tmp/ +RUN vcs import src < /tmp/demo_manual_pkgs.repos + +#RUN sudo apt-get update -y && rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO} + + +# Build the demo +RUN /bin/bash -c 'source /opt/ros/${ROSDISTRO}/setup.bash \ + && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -Wno-dev' + +# Setup the entrypoint +COPY ./entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] +CMD ["bash"] diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..80d04955 --- /dev/null +++ b/build.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +ORG=openrobotics +IMAGE=space_robots_demo +TAG=latest + +VCS_REF="" +VERSION=preview + +# Exit script with failure if build fails +set -eo pipefail + +echo "" +echo "##### Building Space ROS Demo Docker Image #####" +echo "" + +docker build -t $ORG/$IMAGE:$TAG \ + --build-arg VCS_REF="$VCS_REF" \ + --build-arg VERSION="$VERSION" . + +echo "" +echo "##### Space ROS Demo Docker Image Build Completed! #####" + diff --git a/demo_manual_pkgs.repos b/demo_manual_pkgs.repos new file mode 100644 index 00000000..b4a43c1d --- /dev/null +++ b/demo_manual_pkgs.repos @@ -0,0 +1,9 @@ +repositories: + demos: + type: git + url: https://github.com/magnivia4Consulting/demos.git + version: main + simulation: + type: git + url: https://github.com/magnivia4Consulting/simulation.git + version: main diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..8b8873eb --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e + +# Setup the Demo environment +# source "${DEMO_DIR}/install/setup.bash" +source "/home/spaceros-user/demo_ws/install/setup.bash" +exec "$@" diff --git a/mars_rover_nvidia_isaac/README.md b/mars_rover_nvidia_isaac/README.md index 04b20e3e..d3de50ec 100644 --- a/mars_rover_nvidia_isaac/README.md +++ b/mars_rover_nvidia_isaac/README.md @@ -4,17 +4,29 @@ This pacakge reconfigures the controllers implemented in **mars_rover** package To run the demo with NVIDIA ISAAC, following steps need to be followed: -1. Clone the **simulation** repository of SpaceROS into a ROS2 workspace and follow the setup steps mendtioned in **simulation/curiosity_nvidia_isaac/README.md** to setup Nvidia ISAAC Simulation. -2. Once NVIDIA ISAAC is up and runnnig, clone the **demos** repository of SpaceROS in the same ROS2 workspace as in step 1. -3. Build the code using _colocon build_ following standard ROS2 build steps. This will build both **mars_rover_nvidia_isaac** and **mars_rover_teleop** pacakges along with any dependency in the simulation reository as well. -4. Open a new terminal, go to the created ROS2 workspace and execute the following commands to run the demo +1. **build.sh** script will create a docker image with name **openrobotics/space_robots_demo** + +2. To enable execution of UI applications in the container, execute the following command on the host PC: + ```bash + xhost + + ``` +3. Create a container from the docker image created in step 1, using the following command: + ```bash + docker run -it --env="DISPLAY=$DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --env="XAUTHORITY=$XAUTH" --volume="$XAUTH:$XAUTH" --net=host openrobotics/space_robots_demo bash + ``` +4. Container will start in the directory **/home/spaceros-user/demo_ws**. + +5. Follow the setup instructions mendtioned in **src/simulation/curiosity_nvidia_isaac/README.md** to setup Nvidia ISAAC Simulation. + +6. Once NVIDIA ISAAC is up and runnnig, execute the following commands (inside the container created in step 3) to run the demo ```bash - source install/local_setup.bash + cd /home/spaceros-user/demo_ws + source install/setup.bash ros2 launch mars_rover_nvidia_isaac mars_rover_nvidia_isaac_launch.py ``` -5. Above command will load all the supported controllers and launch RViz2(_half width and right aligned_) with the custom teleop plugin. _(Plugin will be located towards bottom-left on the rviz2 window)_ +7. Above command will load all the supported controllers and launch RViz2 with the custom teleop plugin, camera window and LIDAR data enabled.
- +
-6. At this point rover in Nvidia ISAAC simulation should move as per the tele-op command given. \ No newline at end of file +8. At this point rover in Nvidia ISAAC simulation should move as per the tele-op command given and sensor data from ISAAC should be visible on RViz2 \ No newline at end of file diff --git a/mars_rover_nvidia_isaac/documents/images/spaceROS_Rviz_Sensor.png b/mars_rover_nvidia_isaac/documents/images/spaceROS_Rviz_Sensor.png new file mode 100644 index 00000000..95af0ca6 Binary files /dev/null and b/mars_rover_nvidia_isaac/documents/images/spaceROS_Rviz_Sensor.png differ diff --git a/mars_rover_nvidia_isaac/launch/mars_rover_nvidia_isaac_launch.py b/mars_rover_nvidia_isaac/launch/mars_rover_nvidia_isaac_launch.py index e51f03a7..cdcf73f6 100644 --- a/mars_rover_nvidia_isaac/launch/mars_rover_nvidia_isaac_launch.py +++ b/mars_rover_nvidia_isaac/launch/mars_rover_nvidia_isaac_launch.py @@ -54,7 +54,7 @@ def generate_launch_description(): nodes.append(run_node) rviz_teleop_pkg_path = get_package_share_directory('mars_rover_teleop') - rviz_config_file = Path(rviz_teleop_pkg_path, 'config', 'rviz_with_teleop.rviz') + rviz_config_file = Path(rviz_teleop_pkg_path, 'config', 'rviz_teleop_sensors.rviz') logger.info("RVIZ config file:: {}".format(rviz_config_file)) rviz_node = Node( diff --git a/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/arm_joint_trajectory_controller.py b/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/arm_joint_trajectory_controller.py index 820b8e96..80ab7a56 100755 --- a/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/arm_joint_trajectory_controller.py +++ b/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/arm_joint_trajectory_controller.py @@ -20,7 +20,7 @@ def __init__(self, joints): self.joints_ = joints.split(",") # Publisher for JointState - self.arm_publisher_ = self.create_publisher(JointState, '/arm_joint_position', 10) + self.arm_publisher_ = self.create_publisher(JointState, '/arm_joint_state_controller/commands', 10) # Services for controlling the arm self.open_srv = self.create_service(Empty, 'open_arm', self.open_arm_callback) diff --git a/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/mast_joint_trajectory_controller.py b/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/mast_joint_trajectory_controller.py index bf438bad..6c00afde 100755 --- a/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/mast_joint_trajectory_controller.py +++ b/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/mast_joint_trajectory_controller.py @@ -21,7 +21,7 @@ def __init__(self, joints): self.joints_ = joints.split(",") # Publisher for JointState - self.mast_publisher_ = self.create_publisher(JointState, '/mast_joint_position', 10) + self.mast_publisher_ = self.create_publisher(JointState, '/mast_joint_state_controller/commands', 10) # Services for controlling the mast self.mast_open_srv = self.create_service(Empty, 'mast_open', self.mast_open_callback) diff --git a/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/steer_position_controller.py b/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/steer_position_controller.py index ccc94df8..a262a79c 100755 --- a/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/steer_position_controller.py +++ b/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/steer_position_controller.py @@ -21,7 +21,7 @@ def __init__(self, joints): self.joints_ = joints.split(",") # self.get_logger().info("TESTING STEER...") - self.steer_publisher_ = self.create_publisher(JointState, '/steer_position', 10) + self.steer_publisher_ = self.create_publisher(JointState, '/steer_position_controller/commands', 10) timer_period = 0.1 # seconds self.timer = self.create_timer(timer_period, self.timer_callback) diff --git a/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/wheel_tree_position_controller.py b/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/wheel_tree_position_controller.py index e731dae5..a175846f 100755 --- a/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/wheel_tree_position_controller.py +++ b/mars_rover_nvidia_isaac/mars_rover_nvidia_isaac/nodes/wheel_tree_position_controller.py @@ -16,7 +16,7 @@ def __init__(self, joints): self.joints_ = joints.split(",") - self.suspension_publisher_ = self.create_publisher(JointState, '/wheel_tree_position',10) + self.suspension_publisher_ = self.create_publisher(JointState, '/wheel_tree_position_controller/commands',10) timer_period = 0.1 # seconds self.timer = self.create_timer(timer_period, self.timer_callback) diff --git a/mars_rover_teleop/README.md b/mars_rover_teleop/README.md index f18b950e..3935a335 100644 --- a/mars_rover_teleop/README.md +++ b/mars_rover_teleop/README.md @@ -5,7 +5,7 @@ ```bash rviz2 -d