Skip to content

Commit

Permalink
Adder Docker build, Updated README.md and fixed controller topics
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinesh4bigdipper committed Sep 12, 2024
1 parent db71c71 commit 6515db2
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 14 deletions.
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
23 changes: 23 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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! #####"

9 changes: 9 additions & 0 deletions demo_manual_pkgs.repos
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
28 changes: 20 additions & 8 deletions mars_rover_nvidia_isaac/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<p align="center">
<img src="./documents/images/spaceROS_Rviz.png" alt="Controllers and RViz2 Plugin">
<img src="./documents/images/spaceROS_Rviz_Sensor.png" alt="Controllers and RViz2 Plugin">
</p>

6. At this point rover in Nvidia ISAAC simulation should move as per the tele-op command given.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion mars_rover_teleop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```bash
rviz2 -d <path/to/rviz_with_teleop.rviz>
```
3. Config file **config > rviz_teleop_sensors.rviz** loads RViz2 with the plugin as well as sensor data.
3. Config file **config > rviz_teleop_sensors.rviz** loads RViz2 with the teleop plugin, camera window as well as lidar data.
```bash
rviz2 -d <path/to/rviz_teleop_sensors.rviz>
```

0 comments on commit 6515db2

Please sign in to comment.