Skip to content

Commit

Permalink
added usd for isaac-sim
Browse files Browse the repository at this point in the history
  • Loading branch information
D-1shu authored and ggupta9777 committed Nov 7, 2024
1 parent acf4b1c commit 02329c8
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 37 deletions.
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ https://github.com/blackcoffeerobotics/bcr_bot/assets/13151010/0fc570a3-c70c-415

## About

This repository contains a Gazebo simulation for a differential drive robot, equipped with an IMU, a depth camera, stereo camera and a 2D LiDAR. The primary contriution of this project is to support multiple ROS and Gazebo distros. Currently, the project supports the following versions -
This repository contains a Gazebo and Isaac Sim simulation for a differential drive robot, equipped with an IMU, a depth camera, stereo camera and a 2D LiDAR. The primary contriution of this project is to support multiple ROS and Gazebo distros. Currently, the project supports the following versions -

1. [ROS Noetic + Gazebo Classic 11 (branch ros1)](#noetic--classic-ubuntu-2004)
2. [ROS2 Humble + Gazebo Classic 11 (branch ros2)](#humble--classic-ubuntu-2204)
3. [ROS2 Humble + Gazebo Fortress (branch ros2)](#humble--fortress-ubuntu-2204)
4. [ROS2 Humble + Gazebo Harmonic (branch ros2)](#humble--harmonic-ubuntu-2204)
5. [ROS2 Humble + Isaac Sim (branch ros2)](#humble--isaac-sim-ubuntu-2204)

Each of the following sections describes depedencies, build and run instructions for each of the above combinations

Expand Down Expand Up @@ -238,6 +239,35 @@ ros2 launch stereo_image_proc stereo_image_proc.launch.py left_namespace:=bcr_bo

**Warning:** `gz-harmonic` cannot be installed alongside gazebo-classic (eg. gazebo11) since both use the `gz` command line tool.

### Humble + Isaac Sim (Ubuntu 22.04)

### Dependencies

In addition to ROS2 Humble [Isaac Sim installation](https://docs.omniverse.nvidia.com/isaacsim/latest/installation/index.html) with ROS2 extension is required. Remainder of bcr_bot specific dependencies can be installed with [rosdep](http://wiki.ros.org/rosdep)

```bash
# From the root directory of the workspace. This will install everything mentioned in package.xml
rosdep install --from-paths src --ignore-src -r -y
```

### Build

```bash
colcon build --packages-select bcr_bot
```

### Run

To launch the robot in Isaac Sim:
- Open Isaac Sim and load the `bcr_bot` robot usd model from [here](usd).
- Start the Simulation: Run the simulation directly within Isaac Sim.

To view in rviz:
```bash
ros2 launch bcr_bot rviz.launch.py isaac_sim:=True
```
NOTE: The command to run mapping and navigation is common between all versions of gazebo and Isaac sim see [here](#mapping-with-slam-toolbox).

### Mapping with SLAM Toolbox

SLAM Toolbox is an open-source package designed to map the environment using laser scans and odometry, generating a map for autonomous navigation.
Expand All @@ -264,17 +294,19 @@ ros2 run nav2_map_server map_saver_cli -f bcr_map

Nav2 is an open-source navigation package that enables a robot to navigate through an environment easily. It takes laser scan and odometry data, along with the map of the environment, as inputs.

NOTE: The command to run navigation is common between all versions of gazebo.
NOTE: The command to run navigation is common between all versions of gazebo and Isaac sim.

To run Nav2 on bcr_bot:
```bash
ros2 launch bcr_bot nav2.launch.py
```


### Simulation and Visualization
1. Gz Sim (Ignition Gazebo) (small_warehouse World):
![](res/gz.jpg)

2. Rviz (Depth camera) (small_warehouse World):
2. Isaac Sim:
![](res/isaac.jpg)

3. Rviz (Depth camera) (small_warehouse World):
![](res/rviz.jpg)
84 changes: 51 additions & 33 deletions launch/rviz.launch.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,63 @@
#!/usr/bin/env python3

import os
import xacro

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration

from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.actions import DeclareLaunchArgument, GroupAction
from launch.conditions import IfCondition, UnlessCondition

def get_xacro_to_doc(xacro_file_path, mappings):
doc = xacro.parse(open(xacro_file_path))
xacro.process_doc(doc, mappings=mappings)
return doc
doc = xacro.parse(open(xacro_file_path))
xacro.process_doc(doc, mappings=mappings)
return doc

def generate_launch_description():

use_sim_time = LaunchConfiguration('use_sim_time', default='false')

xacro_path = os.path.join(get_package_share_directory('bcr_bot'), 'urdf', 'bcr_bot.xacro')
doc = get_xacro_to_doc(xacro_path, {"wheel_odom_topic": "odom"})

robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='screen',
parameters=[{'use_sim_time': use_sim_time}, {'robot_description': doc.toxml()}]
)

rviz = Node(
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen',
arguments=['-d', os.path.join(get_package_share_directory('bcr_bot'), 'rviz', 'entire_setup.rviz')]
)

return LaunchDescription([
DeclareLaunchArgument('use_sim_time', default_value='false'),
DeclareLaunchArgument('robot_description', default_value=doc.toxml()),
robot_state_publisher, rviz
# Launch configurations
use_sim_time = LaunchConfiguration('use_sim_time', default='false')
isaac_sim = LaunchConfiguration('isaac_sim')

# Process XACRO
xacro_path = os.path.join(get_package_share_directory('bcr_bot'), 'urdf', 'bcr_bot.xacro')
doc = get_xacro_to_doc(xacro_path, {"wheel_odom_topic": "odom"})

# Nodes
robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='screen',
parameters=[{'use_sim_time': use_sim_time}, {'robot_description': doc.toxml()}],
condition=UnlessCondition(isaac_sim) # Only start if isaac_sim is false
)

rviz = Node(
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen',
arguments=['-d', os.path.join(get_package_share_directory('bcr_bot'), 'rviz', 'entire_setup.rviz')]
)

return LaunchDescription([
# Declare arguments
DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation time if true'
),
DeclareLaunchArgument(
'isaac_sim',
default_value='false',
description='Set to true when using Isaac Sim'
),
DeclareLaunchArgument(
'robot_description',
default_value=doc.toxml(),
description='Robot description in URDF/XACRO format'
),
# Nodes
robot_state_publisher,
rviz
])
Binary file added res/isaac.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added usd/bcr_bot.usd
Binary file not shown.

0 comments on commit 02329c8

Please sign in to comment.