Skip to content

Commit 699f133

Browse files
authored
Merge pull request #5 from stereolabs/support_release_4.1
Add support for ZED SDK 4.1
2 parents 8b6c86f + dc0e554 commit 699f133

File tree

13 files changed

+25
-17
lines changed

13 files changed

+25
-17
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.

exts/sl.sensor.camera/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[package]
33
# Semantic Versioning is used: https://semver.org/
4-
version = "1.0.3"
4+
version = "1.1.0"
55

66
# Lists people or organizations that are considered the "authors" of the package.
77
authors = ["Stereolabs"]

exts/sl.sensor.camera/docs/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44

5-
## [1.0.3] - 2024-02-28
5+
## [1.1.0] - 2024-04-04
6+
- Add support for ZED SDK 4.1
7+
8+
## [1.0.3] - 2024-02-16
69
- Add FPS and resolution parameters in Isaac Sim GUI
710
- Add throttling of data fetch to improve performance on low FPS
811

exts/sl.sensor.camera/sl/sensor/camera/nodes/SlCameraStreamer.ogn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
},
5050
"serial_number": {
5151
"type": "uint",
52-
"description": "Serial number (identification) of the camera to stream, can be left to default. It must be of one of the compatible values: 20976320, 29123828, 25626933, 27890353, 25263213, 21116066, 27800035, 27706147",
52+
"description": "Serial number (identification) of the camera to stream, can be left to default. It must be of one of the compatible values: 40976320, 41116066, 49123828, 45626933, 47890353, 45263213, 47800035, 47706147",
5353
"metadata": {
5454
"uiName": "Serial number"
5555
},
56-
"default" : 20976320
56+
"default" : 40976320
5757
},
5858
"use_system_time": {
5959
"type": "bool",

exts/sl.sensor.camera/sl/sensor/camera/nodes/SlCameraStreamer.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import copy
1616
from sl.sensor.camera.ogn.SlCameraStreamerDatabase import SlCameraStreamerDatabase
1717

18-
STREAM_PORT = 30000
1918
LEFT_CAMERA_PATH = "/base_link/ZED_X/CameraLeft"
2019
RIGHT_CAMERA_PATH = "/base_link/ZED_X/CameraRight"
2120
IMU_PRIM_PATH = "/base_link/ZED_X/Imu_Sensor"
@@ -226,7 +225,11 @@ def compute(db) -> bool:
226225
streamer_params.serial_number = serial_number
227226
streamer_params.port = port
228227
streamer_params.codec_type = 1
229-
db.internal_state.pyzed_streamer.init(streamer_params)
228+
229+
init_error = db.internal_state.pyzed_streamer.init(streamer_params)
230+
if not init_error:
231+
carb.log_error(f"Failed to initialize the ZED SDK streamer with serial number {serial_number}.")
232+
return False
230233

231234
# set state to initialized
232235
carb.log_info(f"Streaming camera {db.internal_state.camera_prim_name} at port {port} and using serial number {serial_number}.")
@@ -239,6 +242,7 @@ def compute(db) -> bool:
239242
ts : int = 0
240243
if db.internal_state.initialized is True:
241244
left, right = None, None
245+
# Get simulation time in seconds
242246
current_time = db.internal_state.core_nodes_interface.get_sim_time()
243247

244248
# Reset last_timestamp between different play sessions
@@ -276,13 +280,14 @@ def compute(db) -> bool:
276280
if db.internal_state.start_time == -1:
277281
carb.log_info(f"{db.internal_state.camera_prim_name} - Starting stream to the ZED SDK")
278282
if db.internal_state.start_time == -1 or current_time < db.internal_state.last_timestamp:
279-
db.internal_state.start_time = int(time.time() * 1000)
283+
db.internal_state.start_time = int(time.time_ns())
280284
carb.log_info(f"{db.internal_state.camera_prim_name} - Setting initial streaming time stamp to: {db.internal_state.start_time}")
281-
ts = int(db.internal_state.start_time + current_time * 1000)
285+
286+
ts = int(db.internal_state.start_time + current_time * 1000000000)
282287

283288
# override with system time
284289
if db.internal_state.override_simulation_time:
285-
ts = int(time.time() * 1000)
290+
ts = int(time.time_ns())
286291

287292
# fetch IMU data if the imu prim is there - this check allows user to basically delete
288293
# their IMUand still have access to the image functionality without issues in Isaac Sim

exts/sl.sensor.camera/sl/sensor/camera/ogn/SlCameraStreamerDatabase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SlCameraStreamerDatabase(og.Database):
3636
('inputs:exec_in', 'execution', 0, 'ExecIn', 'Triggers execution', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''),
3737
('inputs:resolution', 'token', 0, 'Resolution', 'Camera stream resolution. Can be either HD1080, HD720 or VGA', {ogn.MetadataKeys.DEFAULT: 'HD720'}, True, "HD720", False, ''),
3838
('inputs:fps', 'uint', 0, 'FPS', 'Camera stream frame rate. Can be either 60, 30 or 15', {ogn.MetadataKeys.DEFAULT: '30'}, True, '30', False, ''),
39-
('inputs:serial_number', 'uint', 0, 'Serial number', 'Serial number (identification) of the camera to stream, can be left to default. It must be of one of the compatible values: 20976320, 29123828, 25626933, 27890353, 25263213, 21116066, 27800035, 27706147', {ogn.MetadataKeys.DEFAULT: '20976320'}, True, 20976320, False, ''),
39+
('inputs:serial_number', 'uint', 0, 'Serial number', 'Serial number (identification) of the camera to stream, can be left to default. It must be of one of the compatible values: 40976320, 41116066, 49123828, 45626933, 47890353, 45263213, 47800035, 47706147', {ogn.MetadataKeys.DEFAULT: '40976320'}, True, 40976320, False, ''),
4040
('inputs:streaming_port', 'uint', 0, 'Streaming port', 'Streaming port - unique per camera', {ogn.MetadataKeys.DEFAULT: '30000'}, True, 30000, False, ''),
4141
('inputs:use_system_time', 'bool', 0, 'Use system time', 'Override simulation time with system time for image timestamps', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''),
4242
])
@@ -56,7 +56,7 @@ def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttr
5656
super().__init__(context, node, attributes, dynamic_attributes)
5757
self.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={})
5858
self._batchedReadAttributes = [self._attributes.exec_in, self._attributes.resolution, self._attributes.fps, self._attributes.serial_number, self._attributes.streaming_port, self._attributes.use_system_time]
59-
self._batchedReadValues = [0, "HD720", "30", 20976320, 30000, False]
59+
self._batchedReadValues = [0, "HD720", "30", 40976320, 30000, False]
6060

6161
@property
6262
def camera_prim(self) -> og.BundleContents:

exts/sl.sensor.camera/sl/sensor/camera/ogn/docs/SlCameraStreamer.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Streams ZED camera data to the ZED SDK
4242
sl.sensor.camera.ZED_Camera Inputs
4343
----------------------------------
4444
+------------------------+-----------+-----------------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
45-
| Name | Type | Default | Required? | Descripton |
45+
| Name | Type | Default | Required? | Description |
4646
+========================+===========+=================+===========+============================================================================================================================================================================================================+
4747
| inputs:camera_prim | bundle | None | **Y** | ZED Camera prim used to stream data |
4848
+------------------------+-----------+-----------------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -54,11 +54,11 @@ sl.sensor.camera.ZED_Camera Inputs
5454
+------------------------+-----------+-----------------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
5555
| | __default | 0 | | |
5656
+------------------------+-----------+-----------------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
57-
| inputs:serial_number | uint | 20976320 | **Y** | Serial number (identification) of the camera to stream, can be left to default. It must be of one of the compatible values: 20976320, 29123828, 25626933, 27890353, 25263213, 21116066, 27800035, 27706147 |
57+
| inputs:serial_number | uint | 40976320 | **Y** | Serial number (identification) of the camera to stream, can be left to default. It must be of one of the compatible values: 40976320, 41116066, 49123828, 45626933, 47890353, 45263213, 47800035, 47706147 |
5858
+------------------------+-----------+-----------------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
5959
| | uiName | Serial number | | |
6060
+------------------------+-----------+-----------------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
61-
| | __default | 20976320 | | |
61+
| | __default | 40976320 | | |
6262
+------------------------+-----------+-----------------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
6363
| inputs:streaming_port | uint | 30000 | **Y** | Streaming port - unique per camera |
6464
+------------------------+-----------+-----------------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

exts/sl.sensor.camera/sl/sensor/camera/ogn/tests/TestSlCameraStreamer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _attr_error(attribute: og.Attribute, usd_test: bool) -> str:
4040
self.assertTrue(test_node.get_attribute_exists("inputs:serial_number"))
4141
attribute = test_node.get_attribute("inputs:serial_number")
4242
db_value = database.inputs.serial_number
43-
expected_value = 20976320
43+
expected_value = 40976320
4444
actual_value = og.Controller.get(attribute)
4545
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
4646
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))

0 commit comments

Comments
 (0)