isaac_ros_data_replayer
Source code on GitHub.
Overview
The isaac_ros_data_replayer
package enables replaying sensor data recorded using the isaac_ros_data_recorder
package. This package also enables reliable extraction of stereo cameras in different formats,
including depth using AI-based perception. Supported formats include MP4, PNG, and PFM. Stereo camera
frames are extracted in synchronized pairs while depth frames are aligned to the left stereo imager.
Quickstart
Set Up Development Environment
Set up your development environment by following the instructions in getting started.
Clone
isaac_ros_common
under${ISAAC_ROS_WS}/src
.cd ${ISAAC_ROS_WS}/src && \ git clone -b release-3.2 https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common.git isaac_ros_common
(Optional) Install dependencies for any sensors you want to use by following the sensor-specific guides.
Note
We strongly recommend installing all sensor dependencies before starting any quickstarts. Some sensor dependencies require restarting the Isaac ROS Dev container during installation, which will interrupt the quickstart process.
Download Quickstart Assets
Download quickstart data from NGC:
Make sure required libraries are installed.
sudo apt-get install -y curl jq tar
Then, run these commands to download the asset from NGC:
NGC_ORG="nvidia" NGC_TEAM="isaac" PACKAGE_NAME="isaac_ros_data_replayer" NGC_RESOURCE="isaac_ros_data_replayer_assets" NGC_FILENAME="quickstart.tar.gz" MAJOR_VERSION=3 MINOR_VERSION=2 VERSION_REQ_URL="https://catalog.ngc.nvidia.com/api/resources/versions?orgName=$NGC_ORG&teamName=$NGC_TEAM&name=$NGC_RESOURCE&isPublic=true&pageNumber=0&pageSize=100&sortOrder=CREATED_DATE_DESC" AVAILABLE_VERSIONS=$(curl -s \ -H "Accept: application/json" "$VERSION_REQ_URL") LATEST_VERSION_ID=$(echo $AVAILABLE_VERSIONS | jq -r " .recipeVersions[] | .versionId as \$v | \$v | select(test(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+$\")) | split(\".\") | {major: .[0]|tonumber, minor: .[1]|tonumber, patch: .[2]|tonumber} | select(.major == $MAJOR_VERSION and .minor <= $MINOR_VERSION) | \$v " | sort -V | tail -n 1 ) if [ -z "$LATEST_VERSION_ID" ]; then echo "No corresponding version found for Isaac ROS $MAJOR_VERSION.$MINOR_VERSION" echo "Found versions:" echo $AVAILABLE_VERSIONS | jq -r '.recipeVersions[].versionId' else mkdir -p ${ISAAC_ROS_WS}/isaac_ros_assets && \ FILE_REQ_URL="https://api.ngc.nvidia.com/v2/resources/$NGC_ORG/$NGC_TEAM/$NGC_RESOURCE/\ versions/$LATEST_VERSION_ID/files/$NGC_FILENAME" && \ curl -LO --request GET "${FILE_REQ_URL}" && \ tar -xf ${NGC_FILENAME} -C ${ISAAC_ROS_WS}/isaac_ros_assets && \ rm ${NGC_FILENAME} fi
Build isaac_ros_data_replayer
Launch the Docker container using the
run_dev.sh
script:cd ${ISAAC_ROS_WS}/src/isaac_ros_common && \ ./scripts/run_dev.sh
Install the prebuilt Debian package:
sudo apt-get update
sudo apt-get install -y ros-humble-isaac-ros-data-replayer source /opt/ros/humble/setup.bash
Install the required assets:
sudo apt-get install -y ros-humble-isaac-ros-ess-models-install source /opt/ros/humble/setup.bash ros2 run isaac_ros_ess_models_install install_ess_models.sh --eula
Clone this repository under
${ISAAC_ROS_WS}/src
:cd ${ISAAC_ROS_WS}/src && \ git clone -b release-3.2 https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nova.git isaac_ros_nova
Launch the Docker container using the
run_dev.sh
script:cd ${ISAAC_ROS_WS}/src/isaac_ros_common && \ ./scripts/run_dev.sh
Use
rosdep
to install the package’s dependencies:sudo apt-get update
rosdep update && rosdep install -i -r --from-paths ${ISAAC_ROS_WS}/src/isaac_ros_nova/isaac_ros_data_replayer/ --rosdistro humble -y
Install the required assets:
sudo apt-get install -y ros-humble-isaac-ros-ess-models-install source /opt/ros/humble/setup.bash ros2 run isaac_ros_ess_models_install install_ess_models.sh --eula
Build the ROS package in the Docker container:
colcon build --symlink-install --packages-up-to isaac_ros_data_replayer source install/setup.bash
Run Launch File
ros2 launch isaac_ros_data_replayer data_replayer.launch.py \
rosbag:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_data_replayer/quickstart
Replay a single camera
ros2 launch isaac_ros_data_replayer data_replayer.launch.py \ rosbag:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_data_replayer/quickstart \ enabled_stereo_cameras:=front_stereo_camera enabled_fisheye_cameras:=None enable_3d_lidar:=False
Visualize
Open a new terminal inside the Docker container:
cd ${ISAAC_ROS_WS}/src/isaac_ros_common && \ ./scripts/run_dev.sh
Run RViz to visualize data:
rviz2
Data Extraction
To extract synchronized camera frames from a rosbag, run:
ros2 run isaac_ros_data_replayer data_extraction.py \
--rosbag ${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_data_replayer/quickstart \
--camera front_stereo_camera --output ${ISAAC_ROS_WS} \
--engine_file_path ${ISAAC_ROS_WS}/isaac_ros_assets/models/dnn_stereo_disparity/dnn_stereo_disparity_v4.1.0_onnx/ess.engine
ros2 run isaac_ros_data_replayer data_extraction.py \
--rosbag ${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_data_replayer/quickstart \
--camera front_stereo_camera --output ${ISAAC_ROS_WS} \
--engine_file_path ${ISAAC_ROS_WS}/isaac_ros_assets/models/dnn_stereo_disparity/dnn_stereo_disparity_v4.1.0_onnx/light_ess.engine
By default, rectified camera frames will be extracted alongside disparity and depth images generated by ESS. To extract rectified images without depth or disparity, run:
ros2 run isaac_ros_data_replayer data_extraction.py \
--rosbag ${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_data_replayer/quickstart \
--camera front_stereo_camera --output ${ISAAC_ROS_WS} \
--mode rectify
To extract raw images, run:
ros2 run isaac_ros_data_replayer data_extraction.py \
--rosbag ${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_data_replayer/quickstart \
--camera front_stereo_camera --output ${ISAAC_ROS_WS} \
--mode raw
Rosbag Conversion
The isaac_ros_data_recorder records camera streams as sensor_msgs/msg/CompressedImage messages encoded with H.264 encoding, and 3D LIDAR data as hesai_ros_driver/msg/UdpFrame.
The rosbag_converter
tool converts rosbags from isaac_ros_data_recorder
so that camera
streams are stored uncompressed as
sensor_msgs/msg/Image
messages and 3D LIDAR data as
sensor_msgs/msg/PointCloud2
messages (with fields x, y, z, intensity, ring, timestamp
).
For additional details refer to
isaac_ros_hesai
documentation.
ros2 run isaac_ros_data_replayer rosbag_converter.py \ -i ${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_data_replayer/quickstart \ -o ${ISAAC_ROS_WS}/uncompressed_rosbag/ \ --all
Note
Disk space requirements: The rosbag_converter
tool requires free disk space of at least
100 times the size of the original rosbag. Specific requirements may vary and depend on the
number of sensors recorded in the original rosbag, among other things.
Note
The rosbag_converter
tool is expected to be used on x86_64
, with sufficient disk space
under the /tmp
directory. The original rosbag needs to be copied to the x86_64
machine
where the conversion will be performed.
Troubleshooting
Isaac ROS Troubleshooting
For solutions to problems with Isaac ROS, see troubleshooting.
Not all camera frames extracted from recording
Data extraction extracts synchronized camera frames from a recording. If the number of frames from the left and right camera are not equal, then some frames will be ignored to keep the left and right cameras in sync.
Not enough free disk space to run the rosbag_converter
tool
Symptom
Execution of the rosbag_converter
tool crashes with a python error, including but not limited to:
RuntimeError: Exception on parsing info file: invalid node; first invalid key: "version"
[ros2run]: Process exited with failure 1
Solution
Free additional disk space before executing the
rosbag_converter
tool.Alternatively, consider reducing the size of the input rosbag, or consider converting only the subset of topics needed for your application. Note that the argument
-a
or--all
converts all the possible topics in the input rosbag, but the arguments--topics_decode_h264
and--topics_udp_to_pc2
allow for the conversion of specific topics.Make sure to use the tool on a
x86_64
machine.
API
Usage
ros2 launch isaac_ros_data_replayer data_replayer.launch.py rosbag:=<rosbag>
ROS Launch Arguments
ROS Launch Argument |
Default Value |
Description |
---|---|---|
|
None |
Path to recording. |
|
|
Stereo cameras enabled for replay. |
|
|
Fisheye cameras enabled for replay. |
|
|
Enable 3D lidar for replay. |
|
|
Loop replay. |
|
|
Extraction rate; 1.0 for real-time, <1.0 for sub-real-time, >1.0 for super-real-time. |
|
None |
Delay to start replay. |
|
|
Additional arguments for replay. |
ROS Topics Published
ROS Topic |
Interface |
Description |
---|---|---|
|
Console logs. |
|
|
Movable transforms on the robot. |
|
|
Fixed transforms on the robot. |
|
|
Front stereo camera left camera stream. |
|
|
Front stereo camera left camera intrinsics. |
|
|
Front stereo camera right camera stream. |
|
|
Front stereo camera right camera intrinsics. |
|
|
Back stereo camera left camera stream. |
|
|
Back stereo camera left camera intrinsics. |
|
|
Back stereo camera right camera stream. |
|
|
Back stereo camera right camera intrinsics. |
|
|
Left stereo camera left camera stream. |
|
|
Left stereo camera left camera intrinsics. |
|
|
Left stereo camera right camera stream. |
|
|
Left stereo camera right camera intrinsics. |
|
|
Right stereo camera left camera stream. |
|
|
Right stereo camera left camera intrinsics. |
|
|
Right stereo camera right camera stream. |
|
|
Right stereo camera right camera intrinsics. |
|
|
Front fisheye camera stream. |
|
|
Front fisheye camera intrinsics. |
|
|
Back fisheye camera stream. |
|
|
Back fisheye camera intrinsics. |
|
|
Left fisheye camera stream. |
|
|
Left fisheye camera intrinsics. |
|
|
Right fisheye camera stream. |
|
|
Right fisheye camera intrinsics. |
|
|
Front 2D lidar scan. |
|
|
Back 2D lidar scan. |
|
|
Front 3D lidar point cloud. |
|
|
Front stereo camera inertial measurement unit. |
|
|
Chassis inertial measurement unit. |
|
|
Chassis encoder count. |
|
|
Chassis odometry. |
|
|
Chassis battery state. |
Usage
ros2 run isaac_ros_data_replayer data_extraction.py --rosbag <rosbag> --camera <camera> --output <output>
ROS Run Arguments
ROS Run Argument |
Default Value |
Description |
---|---|---|
|
None |
Path to recording. |
|
None |
Camera to extract i.e. |
|
None |
Directory to store extracted data. |
|
|
Minimum disparity value for normalization. |
|
|
Maximum disparity value for normalization. |
|
|
ESS threshold. |
|
|
ESS engine file path. |
|
|
Image extraction mode (‘raw’, ‘rectify’, or ‘depth’) |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
Left camera stream. |
|
|
Left camera intrinsics. |
|
|
Right camera stream. |
|
|
Right camera intrinsics. |
Usage
ros2 run isaac_ros_data_replayer rosbag_converter.py --input_rosbag <input_rosbag> --output_rosbag <output_rosbag> --all
ROS Run Arguments
ROS Run Argument |
Default Value |
Description |
---|---|---|
|
None |
Path to the input rosbag (recording from the |
|
None |
Path to the output (converted) rosbag. |
|
None |
Whether to convert all possible topics in the input rosbag. If provided, it takes priority over other arguments listing topics. |
|
[] |
List of image topics with sensor_msgs/msg/CompressedImage h264 messages to be decoded as sensor_msgs/msg/Image. |
|
[] |
List of LIDAR topics with hesai_ros_driver/msg/UdpFrame packets to be converted to sensor_msgs/msg/PointCloud2. |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
Left camera stream. |
|
|
Left camera intrinsics. |
|
|
Right camera stream. |
|
|
Right camera intrinsics. |
|
|
LIDAR UDP packets. |