Skip to content

5.0.x #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build-natives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build-linux-x86_64:
runs-on: [self-hosted, ihmc-runner-nvidia]
container:
image: stereolabs/zed:4.2-devel-cuda12.1-ubuntu20.04
image: stereolabs/zed:5.0-devel-cuda12.8-ubuntu20.04
steps:
- name: Install dependencies
run: |
Expand All @@ -37,7 +37,7 @@ jobs:
build-linux-l4t:
runs-on: [self-hosted, ihmc-runner-nvidia]
container:
image: stereolabs/zed:4.2-devel-l4t-r35.3
image: stereolabs/zed:5.0-devel-l4t-r35.3
needs: [build-linux-x86_64]
steps:
- name: Install dependencies
Expand Down Expand Up @@ -100,8 +100,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install gdown
gdown https://drive.google.com/uc?id=1uDEVu8hOGVJdnO_GEVWJu25QJmdcuxn-
tar -xvf ZEDSDK-Windows-4.2.1.tar.gz -C "C:\\Program Files (x86)"
gdown https://drive.google.com/uc?id=1yFqOcx3FotWFV4evgbXAvM4azFyfhzW1
tar -xvf ZEDSDK-Windows-5.0.2.tar.gz -C "C:\\Program Files (x86)"
- uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: 2019
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# zed-java-api
zed-java-api provides Java JNI bindings for ZED SDK. The bindings are based on [zed-c-api](https://github.com/stereolabs/zed-c-api).

Currently compatible with ZED SDK **4.2.x**.
Currently compatible with ZED SDK **5.0.x**.

Allows you to use Stereolabs sensors such as ZED 2, ZED 2i, ZED X, ZED Mini, ZED X Mini from Java.
## Usage
Expand All @@ -16,7 +16,7 @@ Requires Java 17.
### Gradle
```
dependencies {
implementation("us.ihmc:zed-java-api:4.2.0_4")
implementation("us.ihmc:zed-java-api:5.0.0")
}
```
### Maven
Expand All @@ -25,7 +25,7 @@ dependencies {
<dependency>
<groupId>us.ihmc</groupId>
<artifactId>zed-java-api</artifactId>
<version>4.2.0_4</version>
<version>5.0.0</version>
</dependency>
</dependencies>
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "us.ihmc"
version = "4.2.0_5"
version = "5.0.0"

repositories {
mavenCentral()
Expand Down
11 changes: 5 additions & 6 deletions cppbuild.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ pushd .
mkdir cppbuild
cd cppbuild

ZED_C_API_VERSION=4.2.0
if [ ! -f "zed-c-api.tar.gz" ]; then
curl -o zed-c-api.tar.gz https://codeload.github.com/stereolabs/zed-c-api/tar.gz/refs/tags/v$ZED_C_API_VERSION
if [ ! -f "main.tar.gz" ]; then
curl -L -o main.tar.gz https://github.com/stereolabs/zed-c-api/archive/refs/heads/main.tar.gz
fi

tar -xvf zed-c-api.tar.gz
tar -xvf main.tar.gz

cp ../patches/CMakeLists.txt.zed_c_api.patch zed-c-api-$ZED_C_API_VERSION/CMakeLists.txt.zed_c_api.patch
cp ../patches/CMakeLists.txt.zed_c_api.patch zed-c-api-main/CMakeLists.txt.zed_c_api.patch

cd zed-c-api-$ZED_C_API_VERSION
cd zed-c-api-main

patch CMakeLists.txt CMakeLists.txt.zed_c_api.patch

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/us/ihmc/zed/SL_BarometerData.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class SL_BarometerData extends Pointer {
/** \brief Whether the barometer sensor is available in your camera.*/
public native @Cast("bool") boolean is_available(); public native SL_BarometerData is_available(boolean setter);
/** \brief Data acquisition timestamp in nanoseconds.*/
public native @Cast("unsigned long long") long timestamp_ns(); public native SL_BarometerData timestamp_ns(long setter);
public native @Cast("uint64_t") long timestamp_ns(); public native SL_BarometerData timestamp_ns(long setter);
/** \brief Ambient air pressure in hectopascal (hPa).*/
public native float pressure(); public native SL_BarometerData pressure(float setter);
/** \brief Relative altitude from first camera position (at \ref sl_open_camera() time).*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/us/ihmc/zed/SL_Bodies.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class SL_Bodies extends Pointer {
<p>
This value is especially useful for the async mode to synchronize the data.
*/
public native @Cast("unsigned long long") long timestamp(); public native SL_Bodies timestamp(long setter);
public native @Cast("uint64_t") long timestamp(); public native SL_Bodies timestamp(long setter);
/**
\brief Whether \ref body_list has already been retrieved or not.
*/
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/us/ihmc/zed/SL_BodyTrackingParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ public class SL_BodyTrackingParameters extends Pointer {
\note The value cannot be greater than SL_InitParameters.depth_maximum_distance and its unit is defined in SL_InitParameters.coordinate_unit.
*/
public native float max_range(); public native SL_BodyTrackingParameters max_range(float setter);

// #if 0
// #endif
/**
\brief Prediction duration of the ZED SDK when an object is not detected anymore before switching its state to \ref SL_OBJECT_TRACKING_STATE_SEARCHING.

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/us/ihmc/zed/SL_CameraIdentifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public class SL_CameraIdentifier extends Pointer {
return new SL_CameraIdentifier((Pointer)this).offsetAddress(i);
}

public native @Cast("unsigned long long int") long sn(); public native SL_CameraIdentifier sn(long setter);
public native @Cast("uint64_t") long sn(); public native SL_CameraIdentifier sn(long setter);
}
42 changes: 41 additions & 1 deletion src/main/java/us/ihmc/zed/SL_CustomBoxObjectData.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public class SL_CustomBoxObjectData extends Pointer {
/**
\brief Maximum tracking time threshold (in seconds) before dropping the tracked object when unseen for this amount of time.
By default, let the tracker decide internally based on the internal sub class of the tracked object.
Only valid for static object.
*/
public native float tracking_timeout(); public native SL_CustomBoxObjectData tracking_timeout(float setter);

Expand All @@ -98,4 +97,45 @@ public class SL_CustomBoxObjectData extends Pointer {
Only valid for static object.
*/
public native float tracking_max_dist(); public native SL_CustomBoxObjectData tracking_max_dist(float setter);

/**
\brief Maximum allowed 3D width.
<p>
Any prediction bigger than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float max_box_width_meters(); public native SL_CustomBoxObjectData max_box_width_meters(float setter);

/**
\brief Minimum allowed 3D width.
<p>
Any prediction smaller than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float min_box_width_meters(); public native SL_CustomBoxObjectData min_box_width_meters(float setter);

/**
\brief Maximum allowed 3D height.
<p>
Any prediction bigger than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float max_box_height_meters(); public native SL_CustomBoxObjectData max_box_height_meters(float setter);

/**
\brief Minimum allowed 3D height.
<p>
Any prediction smaller than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float min_box_height_meters(); public native SL_CustomBoxObjectData min_box_height_meters(float setter);

/**
\brief Manually override the acceleration preset.
If set, this value takes precedence over the selected preset, allowing for a custom maximum acceleration.
Takes precedence over the runtime parameter, if also set.
Unit is m/s^2.
Defaults: NaN
*/
public native float max_allowed_acceleration(); public native SL_CustomBoxObjectData max_allowed_acceleration(float setter);
}
44 changes: 42 additions & 2 deletions src/main/java/us/ihmc/zed/SL_CustomMaskObjectData.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public class SL_CustomMaskObjectData extends Pointer {
/**
\brief Maximum tracking time threshold (in seconds) before dropping the tracked object when unseen for this amount of time.
By default, let the tracker decide internally based on the internal sub class of the tracked object.
Only valid for static object.
*/
public native float tracking_timeout(); public native SL_CustomMaskObjectData tracking_timeout(float setter);

Expand All @@ -96,6 +95,47 @@ public class SL_CustomMaskObjectData extends Pointer {

/**
\brief 2D mask of the object inside its bounding box.
*/
*/
public native @Cast("unsigned char*") BytePointer box_mask(); public native SL_CustomMaskObjectData box_mask(BytePointer setter);

/**
\brief Maximum allowed 3D width.
<p>
Any prediction bigger than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float max_box_width_meters(); public native SL_CustomMaskObjectData max_box_width_meters(float setter);

/**
\brief Minimum allowed 3D width.
<p>
Any prediction smaller than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float min_box_width_meters(); public native SL_CustomMaskObjectData min_box_width_meters(float setter);

/**
\brief Maximum allowed 3D height.
<p>
Any prediction bigger than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float max_box_height_meters(); public native SL_CustomMaskObjectData max_box_height_meters(float setter);

/**
\brief Minimum allowed 3D height.
<p>
Any prediction smaller than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float min_box_height_meters(); public native SL_CustomMaskObjectData min_box_height_meters(float setter);

/**
\brief Manually override the acceleration preset.
If set, this value takes precedence over the selected preset, allowing for a custom maximum acceleration.
Takes precedence over the runtime parameter, if also set.
Unit is m/s^2.
Defaults: NaN
*/
public native float max_allowed_acceleration(); public native SL_CustomMaskObjectData max_allowed_acceleration(float setter);
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public class SL_CustomObjectDetectionProperties extends Pointer {
\brief Maximum tracking time threshold (in seconds) before dropping the tracked object when unseen for this amount of time.
<p>
By default, let the tracker decide internally based on the internal sub class of the tracked object.
Only valid for static object.
*/
public native float tracking_timeout(); public native SL_CustomObjectDetectionProperties tracking_timeout(float setter);

Expand Down Expand Up @@ -119,4 +118,62 @@ public class SL_CustomObjectDetectionProperties extends Pointer {
Default: -1 (no filtering)
*/
public native float min_box_height_normalized(); public native SL_CustomObjectDetectionProperties min_box_height_normalized(float setter);

/**
\brief Maximum allowed 3D width.
<p>
Any prediction bigger than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float max_box_width_meters(); public native SL_CustomObjectDetectionProperties max_box_width_meters(float setter);

/**
\brief Minimum allowed 3D width.
<p>
Any prediction smaller than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float min_box_width_meters(); public native SL_CustomObjectDetectionProperties min_box_width_meters(float setter);

/**
\brief Maximum allowed 3D height.
<p>
Any prediction bigger than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float max_box_height_meters(); public native SL_CustomObjectDetectionProperties max_box_height_meters(float setter);

/**
\brief Minimum allowed 3D height.
<p>
Any prediction smaller than that will be either discarded (if object is tracked and in SEARCHING state) or clamped.
Default: -1 (no filtering)
*/
public native float min_box_height_meters(); public native SL_CustomObjectDetectionProperties min_box_height_meters(float setter);

/**
\brief For increased accuracy, the native \ref sl::OBJECT_SUBCLASS mapping, if any.
<p>
Native objects have refined internal parameters for better 3D projection and tracking accuracy.
If one of the custom objects can be mapped to one the native \ref sl::OBJECT_SUBCLASS, this can help to boost the tracking accuracy.
<p>
Default: no mapping
*/
public native @Cast("SL_OBJECT_SUBCLASS") int native_mapped_class(); public native SL_CustomObjectDetectionProperties native_mapped_class(int setter);

/**
\brief Preset defining the expected maximum acceleration of the tracked object.
<p>
Determines how the ZED SDK interprets object acceleration, affecting tracking behavior and predictions.
*/
public native @Cast("SL_OBJECT_ACCELERATION_PRESET") int object_acceleration_preset(); public native SL_CustomObjectDetectionProperties object_acceleration_preset(int setter);

/**
\brief Manually override the acceleration preset.
<p>
If set, this value takes precedence over the selected preset, allowing for a custom maximum acceleration.
Unit is m/s^2.
Defaults: NaN
*/
public native float max_allowed_acceleration(); public native SL_CustomObjectDetectionProperties max_allowed_acceleration(float setter);
}
27 changes: 27 additions & 0 deletions src/main/java/us/ihmc/zed/SL_DeviceProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public class SL_DeviceProperties extends Pointer {
public native @Cast("unsigned char") byte path(int i); public native SL_DeviceProperties path(int i, byte setter);
@MemberGetter public native @Cast("unsigned char*") BytePointer path();
/**
\brief i2c port of the camera.
*/
public native int i2c_port(); public native SL_DeviceProperties i2c_port(int setter);
/**
\brief Model of the camera.
*/
public native @Cast("SL_MODEL") int camera_model(); public native SL_DeviceProperties camera_model(int setter);
Expand All @@ -67,7 +71,30 @@ public class SL_DeviceProperties extends Pointer {

public native @Cast("unsigned int") int sn(); public native SL_DeviceProperties sn(int setter);
/**
\brief [Cam model, eeprom version, white balance param]
*/
public native @Cast("unsigned char") byte identifier(int i); public native SL_DeviceProperties identifier(int i, byte setter);
@MemberGetter public native @Cast("unsigned char*") BytePointer identifier();
/**
\brief badge name (zedx_ar0234)
*/
public native @Cast("char*") BytePointer camera_badge(); public native SL_DeviceProperties camera_badge(BytePointer setter);

/**
\brief Name of sensor (zedx)
*/
public native @Cast("char*") BytePointer camera_sensor_model(); public native SL_DeviceProperties camera_sensor_model(BytePointer setter);
/**
\brief Name of Camera in DT (ZED_CAM1)
*/
public native @Cast("char*") BytePointer camera_name(); public native SL_DeviceProperties camera_name(BytePointer setter);
/**
\brief Input type of the camera.
*/
public native @Cast("SL_INPUT_TYPE") int input_type(); public native SL_DeviceProperties input_type(int setter);
/**
\brief sensor_address when available (ZED-X HDR/XOne HDR only)
*/
public native @Cast("unsigned char") byte sensor_address_left(); public native SL_DeviceProperties sensor_address_left(byte setter);
public native @Cast("unsigned char") byte sensor_address_right(); public native SL_DeviceProperties sensor_address_right(byte setter);
}
51 changes: 51 additions & 0 deletions src/main/java/us/ihmc/zed/SL_ENU.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Targeted by JavaCPP version 1.5.10: DO NOT EDIT THIS FILE

package us.ihmc.zed;

import org.bytedeco.cuda.cudart.CUctx_st;
import org.bytedeco.cuda.cudart.CUstream_st;
import java.nio.*;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;

import static us.ihmc.zed.global.zed.*;


/**
* \brief Represents a world position in ENU format.
*
*/
@Properties(inherit = us.ihmc.zed.ZEDJavaAPIConfig.class)
public class SL_ENU extends Pointer {
static { Loader.load(); }
/** Default native constructor. */
public SL_ENU() { super((Pointer)null); allocate(); }
/** Native array allocator. Access with {@link Pointer#position(long)}. */
public SL_ENU(long size) { super((Pointer)null); allocateArray(size); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public SL_ENU(Pointer p) { super(p); }
private native void allocate();
private native void allocateArray(long size);
@Override public SL_ENU position(long position) {
return (SL_ENU)super.position(position);
}
@Override public SL_ENU getPointer(long i) {
return new SL_ENU((Pointer)this).offsetAddress(i);
}

/**
* \brief East coordinate.
*
*/
public native double east(); public native SL_ENU east(double setter);
/**
* \brief North coordinate.
*
*/
public native double north(); public native SL_ENU north(double setter);
/**
* \brief Up coordinate.
*
*/
public native double up(); public native SL_ENU up(double setter);
}
Loading