isaac_ros_bi3d_freespace

Source code on GitHub.

Quickstart

  1. Set up your development environment by following the instructions here.

  2. Clone isaac_ros_common and this repository under ${ISAAC_ROS_WS}/src.

    cd ${ISAAC_ROS_WS}/src
    
    git clone https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common.git
    
    git clone https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_freespace_segmentation.git
    
  3. Pull down a rosbag of sample data:

    git clone https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_depth_segmentation.git
    
    cd ${ISAAC_ROS_WS}/src/isaac_ros_depth_segmentation &&
    git lfs pull -X "" -I "resources/rosbags/bi3dnode_rosbag"
    
  4. Launch the Docker container using the run_dev.sh script:

    cd ${ISAAC_ROS_WS}/src/isaac_ros_common &&
    ./scripts/run_dev.sh
    
  5. Install this package’s dependencies.

sudo apt-get install -y ros-humble-isaac-ros-bi3d-freespace
  1. Download model files for Bi3D (refer to the Model Preparation section for more information):

    mkdir -p /tmp/models/bi3d &&
    cd /tmp/models/bi3d &&
    wget 'https://api.ngc.nvidia.com/v2/models/nvidia/isaac/bi3d_proximity_segmentation/versions/2.0.0/files/featnet.onnx' &&
    wget 'https://api.ngc.nvidia.com/v2/models/nvidia/isaac/bi3d_proximity_segmentation/versions/2.0.0/files/segnet.onnx'
    
  2. Convert the .onnx model files to TensorRT engine plan files (refer to the Model Preparation section for more information):

    If using Jetson (Generate engine plans with DLA support enabled):

    /usr/src/tensorrt/bin/trtexec --saveEngine=/tmp/models/bi3d/bi3dnet_featnet.plan \
    --onnx=/tmp/models/bi3d/featnet.onnx \
    --int8 --useDLACore=0 --allowGPUFallback &&
    /usr/src/tensorrt/bin/trtexec --saveEngine=/tmp/models/bi3d/bi3dnet_segnet.plan \
    --onnx=/tmp/models/bi3d/segnet.onnx \
    --int8 --useDLACore=0 --allowGPUFallback
    

    If using x86_64:

    /usr/src/tensorrt/bin/trtexec --saveEngine=/tmp/models/bi3d/bi3dnet_featnet.plan \
    --onnx=/tmp/models/bi3d/featnet.onnx --int8 &&
    /usr/src/tensorrt/bin/trtexec --saveEngine=/tmp/models/bi3d/bi3dnet_segnet.plan \
    --onnx=/tmp/models/bi3d/segnet.onnx --int8
    

    Note

    The engine plans generated using the x86_64 commands will also work on Jetson, but performance will be reduced.

  3. Run the launch file to spin up a demo of this package:

    cd /workspaces/isaac_ros-dev
    
    ros2 launch isaac_ros_bi3d_freespace isaac_ros_bi3d_freespace.launch.py featnet_engine_file_path:=/tmp/models/bi3d/bi3dnet_featnet.plan \
    segnet_engine_file_path:=/tmp/models/bi3d/bi3dnet_segnet.plan \
    max_disparity_values:=10
    
  4. Open a second terminal inside the Docker container:

    cd ${ISAAC_ROS_WS}/src/isaac_ros_common && \
      ./scripts/run_dev.sh
    
  5. Visualize the occupancy grid in RViz.

    Start RViz:

    rviz2
    

    In the left pane, change Fixed Frame to base_link.

    In the left pane, click the Add button, then select By topic followed by Map to add the occupancy grid.

RViz Output

Try More Examples

To continue your exploration, check out the following suggested examples:

API

Usage

ros2 launch isaac_ros_bi3d_freespace isaac_ros_freespace_segmentation.launch.py base_link_frame:=<"name of base link"> camera_frame:=<"name of camera frame"> f_x:=<"focal length in pixels in x dimension"> f_y:=<"focal length in pixels in y dimension"> grid_width:=<"desired grid width"> grid_height:=<"desired grid height"> grid_resolution:=<"desired grid resolution">

ROS Parameters

ROS Parameter

Type

Default

Description

base_link_frame

std::string

base_link

The name of the tf2 frame attached to the robot base

camera_frame

std::string

camera

The name of the tf2 frame attached to the camera

f_x

double

0.0

The focal length in pixels in x dimension

f_y

double

0.0

The focal length in pixels in y dimension

grid_width

int

100

The width of the output occupancy grid, in number of cells

grid_height

int

100

The height of the output occupancy grid, in number of cells

grid_resolution

double

0.01

The resolution of the output occupancy grid, in meters per cell

ROS Topics Subscribed

ROS Topic

Interface

Description

freespace_segmentation/mask_in

stereo_msgs/DisparityImage

The input disparity image, with pixels corresponding to ground labeled as 0

Limitation: For all input images, both the height and width must be an even number of pixels.

ROS Topics Published

ROS Topic

Interface

Description

freespace_segmentation/occupancy_grid

nav_msgs/OccupancyGrid

The output occupancy grid, with cells marked as 0 if free