Skip to content

Commit 1bcdcb1

Browse files
authored
Merge pull request #45 from NVIDIA-ISAAC-ROS/release-3.0
Isaac ROS 3.0.0
2 parents 1603d1f + 886fa37 commit 1bcdcb1

32 files changed

+834
-318
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Isaac ROS Argus Camera
22

3-
ROS 2 packages based on NVIDIA `libArgus` library for hardware-accelerated CSI camera support.
3+
ROS 2 packages based on NVIDIA `libArgus` library for NVIDIA-accelerated CSI camera support.
44

55
<div align="center"><img src="https://media.githubusercontent.com/media/NVIDIA-ISAAC-ROS/.github/main/resources/isaac_ros_docs/repositories_and_packages/isaac_ros_argus_camera/isaac_ros_argus_sample_raw.png/" width="300px" title="raw image"/>
66
<img src="https://media.githubusercontent.com/media/NVIDIA-ISAAC-ROS/.github/main/resources/isaac_ros_docs/repositories_and_packages/isaac_ros_argus_camera/isaac_ros_argus_sample_isp.png/" width="300px" title="isp processed image"/></div>
@@ -87,4 +87,4 @@ Please visit the [Isaac ROS Documentation](https://nvidia-isaac-ros.github.io/re
8787

8888
## Latest
8989

90-
Update 2023-10-18: Updated for Isaac ROS 2.0.0.
90+
Update 2024-05-30: Update to be compatible with JetPack 6.0
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
2+
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
cmake_minimum_required(VERSION 3.22.1)
19+
project(gxf_isaac_camera_utils LANGUAGES C CXX)
20+
21+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
22+
add_compile_options(-Wall -Wextra -Wpedantic)
23+
endif()
24+
25+
find_package(ament_cmake_auto REQUIRED)
26+
ament_auto_find_build_dependencies()
27+
28+
# Dependencies
29+
find_package(CUDAToolkit REQUIRED)
30+
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
31+
find_package(yaml-cpp)
32+
33+
# Camera utils extension
34+
ament_auto_add_library(${PROJECT_NAME} SHARED
35+
gxf/extensions/camera_utils/camera_utils.cpp
36+
gxf/extensions/camera_utils/stereo_camera_synchronizer.cpp
37+
gxf/extensions/camera_utils/stereo_camera_synchronizer.hpp
38+
)
39+
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/gxf")
40+
target_link_libraries(${PROJECT_NAME}
41+
Eigen3::Eigen
42+
yaml-cpp
43+
)
44+
set_target_properties(${PROJECT_NAME} PROPERTIES
45+
BUILD_WITH_INSTALL_RPATH TRUE
46+
BUILD_RPATH_USE_ORIGIN TRUE
47+
INSTALL_RPATH_USE_LINK_PATH TRUE
48+
)
49+
50+
# Install the binary file
51+
install(TARGETS ${PROJECT_NAME} DESTINATION share/${PROJECT_NAME}/gxf/lib)
52+
53+
ament_auto_package(INSTALL_TO_SHARE)

isaac_ros_argus_camera/gxf/utils/extensions/utils/utils.cpp renamed to gxf_isaac_camera_utils/gxf/extensions/camera_utils/camera_utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
2-
// Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -14,13 +14,13 @@
1414
// limitations under the License.
1515
//
1616
// SPDX-License-Identifier: Apache-2.0
17-
#include "extensions/utils/stereo_camera_synchronizer.hpp"
17+
#include "extensions/camera_utils/stereo_camera_synchronizer.hpp"
1818
#include "gxf/std/extension_factory_helper.hpp"
1919

2020
GXF_EXT_FACTORY_BEGIN()
2121

22-
GXF_EXT_FACTORY_SET_INFO(0xa722f33021690730, 0x8efa17986d37641d, "NvIsaacUtilsExtension",
23-
"Extension containing miscellaneous utility components", "Isaac SDK",
22+
GXF_EXT_FACTORY_SET_INFO(0xa722f33021690730, 0x8efa17986d37641d, "NvIsaacCameraUtilsExtension",
23+
"Extension containing miscellaneous camera utility components", "Isaac SDK",
2424
"2.0.0", "LICENSE");
2525

2626
GXF_EXT_FACTORY_ADD(0x8760c3e2306c1ff6, 0xb9f0fb97cef0110f,
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
2+
// Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
// SPDX-License-Identifier: Apache-2.0
17+
18+
#include "extensions/camera_utils/stereo_camera_synchronizer.hpp"
19+
#include "gems/gxf_helpers/expected_macro_gxf.hpp"
20+
#include "gxf/std/timestamp.hpp"
21+
22+
namespace nvidia {
23+
namespace isaac {
24+
25+
gxf_result_t StereoCameraSynchronizer::registerInterface(gxf::Registrar* registrar) {
26+
gxf::Expected<void> result;
27+
result &= registrar->parameter(
28+
rx_right_camera_, "rx_right_camera", "RX Right Camera Message",
29+
"Input for Right CameraMessage entities");
30+
result &= registrar->parameter(
31+
rx_left_camera_, "rx_left_camera", "RX Left Camera Message",
32+
"Input for Left CameraMessage entities");
33+
result &= registrar->parameter(
34+
tx_right_camera_, "tx_right_camera", "TX Right Camera Message",
35+
"Input for Right CameraMessage entities");
36+
result &= registrar->parameter(
37+
tx_left_camera_, "tx_left_camera", "TX Left Camera Message",
38+
"Input for Left CameraMessage entities");
39+
result &= registrar->parameter(
40+
max_timestamp_diff_, "max_timestamp_diff", "Max difference timestamps nanoseconds",
41+
"Max difference between timestamps in nanoseconds",
42+
static_cast<int64_t>(200000)); // 200 micro seconds
43+
return gxf::ToResultCode(result);
44+
}
45+
46+
gxf_result_t StereoCameraSynchronizer::start() {
47+
// Set all previous timestamps to minimum value of int64_t
48+
// This ensures that the first message received does NOT trigger the
49+
// "not monotonically increasing" error
50+
prev_left_unnamed_timestamp_ = std::numeric_limits<int64_t>::min();
51+
prev_right_unnamed_timestamp_ = std::numeric_limits<int64_t>::min();
52+
prev_left_named_timestamp_ = std::numeric_limits<int64_t>::min();
53+
prev_right_named_timestamp_ = std::numeric_limits<int64_t>::min();
54+
return GXF_SUCCESS;
55+
}
56+
57+
gxf_result_t StereoCameraSynchronizer::tick() {
58+
auto left_camera_entity = UNWRAP_OR_RETURN(rx_left_camera_->receive());
59+
auto right_camera_entity = UNWRAP_OR_RETURN(rx_right_camera_->receive());
60+
auto left_unnamed_timestamp = UNWRAP_OR_RETURN(left_camera_entity.get<gxf::Timestamp>());
61+
auto right_unnamed_timestamp = UNWRAP_OR_RETURN(right_camera_entity.get<gxf::Timestamp>());
62+
auto left_named_timestamp = UNWRAP_OR_RETURN(left_camera_entity.get<gxf::Timestamp>("timestamp"));
63+
auto right_named_timestamp = UNWRAP_OR_RETURN(right_camera_entity.get<gxf::Timestamp>("timestamp"));
64+
65+
const int64_t unnamed_diff = std::abs(left_unnamed_timestamp->acqtime - right_unnamed_timestamp->acqtime);
66+
if (unnamed_diff > max_timestamp_diff_) {
67+
GXF_LOG_ERROR("L/R frames are not synchronized, unnamed timestamp diff = %ld ns", unnamed_diff);
68+
return GXF_FAILURE;
69+
}
70+
71+
const int64_t named_diff = std::abs(left_named_timestamp->acqtime - right_named_timestamp->acqtime);
72+
if (named_diff > max_timestamp_diff_) {
73+
GXF_LOG_ERROR("L/R frames are not synchronized, named timestamp diff = %ld ns", named_diff);
74+
return GXF_FAILURE;
75+
}
76+
// Set right input timestamp to left input timestamp
77+
right_unnamed_timestamp->acqtime = left_unnamed_timestamp->acqtime;
78+
right_named_timestamp->acqtime = left_named_timestamp->acqtime;
79+
80+
81+
// Check if previous timestamp is lower than current timestamp
82+
if (prev_left_unnamed_timestamp_ > left_unnamed_timestamp->acqtime) {
83+
GXF_LOG_ERROR("Left unnamed timestamp is not monotonically increasing");
84+
return GXF_FAILURE;
85+
}
86+
if (prev_right_unnamed_timestamp_ > right_unnamed_timestamp->acqtime) {
87+
GXF_LOG_ERROR("Right unnamed timestamp is not monotonically increasing");
88+
return GXF_FAILURE;
89+
}
90+
if (prev_left_named_timestamp_ > left_named_timestamp->acqtime) {
91+
GXF_LOG_ERROR("Left named timestamp is not monotonically increasing");
92+
return GXF_FAILURE;
93+
}
94+
if (prev_right_named_timestamp_ > right_named_timestamp->acqtime) {
95+
GXF_LOG_ERROR("Right named timestamp is not monotonically increasing");
96+
return GXF_FAILURE;
97+
}
98+
99+
prev_left_unnamed_timestamp_ = left_unnamed_timestamp->acqtime;
100+
prev_right_unnamed_timestamp_ = right_unnamed_timestamp->acqtime;
101+
prev_left_named_timestamp_ = left_named_timestamp->acqtime;
102+
prev_right_named_timestamp_ = right_named_timestamp->acqtime;
103+
104+
RETURN_IF_ERROR(tx_left_camera_->publish(left_camera_entity));
105+
RETURN_IF_ERROR(tx_right_camera_->publish(right_camera_entity));
106+
107+
return GXF_SUCCESS;
108+
}
109+
110+
} // namespace isaac
111+
} // namespace nvidia

isaac_ros_argus_camera/gxf/utils/extensions/utils/stereo_camera_synchronizer.hpp renamed to gxf_isaac_camera_utils/gxf/extensions/camera_utils/stereo_camera_synchronizer.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
2-
// Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ namespace isaac {
2929
// even though in reality matched frames can differ by a few microseconds.
3030
class StereoCameraSynchronizer : public gxf::Codelet {
3131
gxf_result_t registerInterface(gxf::Registrar* registrar) override;
32-
gxf_result_t start() override { return GXF_SUCCESS; }
32+
gxf_result_t start() override;
3333
gxf_result_t tick() override;
3434
gxf_result_t stop() override { return GXF_SUCCESS; }
3535

@@ -39,6 +39,8 @@ class StereoCameraSynchronizer : public gxf::Codelet {
3939
gxf::Parameter<gxf::Handle<gxf::Transmitter>> tx_right_camera_;
4040
gxf::Parameter<gxf::Handle<gxf::Transmitter>> tx_left_camera_;
4141
gxf::Parameter<int64_t> max_timestamp_diff_;
42+
int64_t prev_left_unnamed_timestamp_, prev_right_unnamed_timestamp_;
43+
int64_t prev_left_named_timestamp_, prev_right_named_timestamp_;
4244
};
4345

4446
} // namespace isaac

gxf_isaac_camera_utils/package.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0"?>
2+
3+
<!--
4+
SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
SPDX-License-Identifier: Apache-2.0
19+
-->
20+
21+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
22+
<package format="3">
23+
<name>gxf_isaac_camera_utils</name>
24+
<version>3.0.0</version>
25+
<description>NvIsaacCameraUtilsExtension</description>
26+
27+
<maintainer email="[email protected]">Isaac ROS Maintainers</maintainer>
28+
<license>Apache-2.0</license>
29+
<url type="website">https://developer.nvidia.com/isaac-ros-gems/</url>
30+
<author>CY Chen</author>
31+
32+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
33+
34+
<depend>isaac_ros_common</depend>
35+
<depend>isaac_ros_gxf</depend>
36+
<depend>gxf_isaac_messages</depend>
37+
38+
<build_depend>gxf_isaac_gems</build_depend>
39+
40+
<test_depend>ament_lint_auto</test_depend>
41+
<test_depend>ament_lint_common</test_depend>
42+
43+
<export>
44+
<build_type>ament_cmake</build_type>
45+
</export>
46+
</package>

isaac_ros_argus_camera/CMakeLists.txt

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
2-
# Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -29,18 +29,31 @@ find_package(ament_cmake_auto REQUIRED)
2929
ament_auto_find_build_dependencies()
3030

3131
ament_auto_add_library(argus_nitros_context SHARED src/argus_nitros_context.cpp)
32+
3233
ament_auto_add_library(base_node SHARED src/argus_camera_node.cpp)
34+
set_target_properties(base_node PROPERTIES
35+
BUILD_WITH_INSTALL_RPATH TRUE
36+
BUILD_RPATH_USE_ORIGIN TRUE
37+
INSTALL_RPATH_USE_LINK_PATH TRUE
38+
)
39+
3340
ament_auto_add_library(mono_node SHARED src/argus_camera_mono_node.cpp)
3441
rclcpp_components_register_nodes(mono_node "nvidia::isaac_ros::argus::ArgusMonoNode")
3542
set(node_plugins "${node_plugins}nvidia::isaac_ros::argus::ArgusMonoNode;$<TARGET_FILE:mono_node>\n")
43+
set_target_properties(mono_node PROPERTIES
44+
BUILD_WITH_INSTALL_RPATH TRUE
45+
BUILD_RPATH_USE_ORIGIN TRUE
46+
INSTALL_RPATH_USE_LINK_PATH TRUE
47+
)
3648

3749
ament_auto_add_library(stereo_node SHARED src/argus_camera_stereo_node.cpp)
3850
rclcpp_components_register_nodes(stereo_node "nvidia::isaac_ros::argus::ArgusStereoNode")
3951
set(node_plugins "${node_plugins}nvidia::isaac_ros::argus::ArgusStereoNode;$<TARGET_FILE:stereo_node>\n")
40-
41-
# Utils(for StereoCameraSynchronizer)
42-
add_subdirectory(gxf/utils)
43-
install(TARGETS gxf_utils DESTINATION share/${PROJECT_NAME}/gxf/lib/utils)
52+
set_target_properties(stereo_node PROPERTIES
53+
BUILD_WITH_INSTALL_RPATH TRUE
54+
BUILD_RPATH_USE_ORIGIN TRUE
55+
INSTALL_RPATH_USE_LINK_PATH TRUE
56+
)
4457

4558
if(BUILD_TESTING)
4659
find_package(ament_lint_auto REQUIRED)
@@ -58,8 +71,8 @@ if(BUILD_TESTING)
5871
add_launch_test(test/isaac_ros_argus_camera_mono_test.py)
5972
add_launch_test(test/isaac_ros_argus_camera_stereo_test.py)
6073
add_launch_test(test/isaac_ros_argus_camera_stereo_oss_rectify_compare.py)
74+
add_launch_test(test/isaac_ros_argus_camera_stereo_wide_fov_test.py)
6175
endif() # aarch64
6276
endif()
6377

64-
65-
ament_auto_package(INSTALL_TO_SHARE config launch)
78+
ament_auto_package(INSTALL_TO_SHARE config launch test)

0 commit comments

Comments
 (0)