Skip to content

Commit

Permalink
Merge pull request #18 from stereolabs/4.0.5
Browse files Browse the repository at this point in the history
4.0.5
  • Loading branch information
Bvallon-sl authored Jul 5, 2023
2 parents 5d4f71f + 5b9c0e5 commit 8a4a5bd
Show file tree
Hide file tree
Showing 28 changed files with 102 additions and 55 deletions.
Binary file modified UnrealProject/Content/Maps/LiveLinkMap.umap
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@ void ULiveLinkOrientationsRemapAsset::BuildPoseFromZEDAnimationData(float DeltaT
Keypoints = Keypoints38;
ParentsIdx = parents38Idx;
}
#if 0
else if (InFrameData->Transforms.Num() == Keypoints70.Num() * 2)// BODY_70
{
NbKeypoints = 70;
Keypoints = Keypoints70;
ParentsIdx = parents70Idx;
}
#endif
else if (InFrameData->Transforms.Num() == Keypoints34.Num() * 2)// BODY_34
{
NbKeypoints = 34;
Expand Down Expand Up @@ -184,7 +186,7 @@ void ULiveLinkOrientationsRemapAsset::BuildPoseFromZEDAnimationData(float DeltaT
LeftFootPosition = SkeletalMesh->GetBoneLocation(TransformedBoneNames[21]);
RightFootPosition = SkeletalMesh->GetBoneLocation(TransformedBoneNames[25]);
}
else // body 38 or 70
else // body 38
{
LeftFootPosition = SkeletalMesh->GetBoneLocation(TransformedBoneNames[24]);
RightFootPosition = SkeletalMesh->GetBoneLocation(TransformedBoneNames[25]);
Expand Down
87 changes: 46 additions & 41 deletions UnrealProject/Source/ZEDUnrealLiveLink/Util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,50 @@ const TArray<int> parents38Idx = {
17
};

static TMap<int, FName> Keypoints38 = TMap<int, FName>{
{0, "PELVIS"},
{1, "SPINE_1"},
{2, "SPINE_2"},
{3, "SPINE_3"},
{4, "NECK"},
{5, "NOSE"},
{6, "LEFT_EYE"},
{7, "RIGHT_EYE"},
{8, "LEFT_EAR"},
{9, "RIGHT_EAR"},
{10, "LEFT_CLAVICLE"},
{11, "RIGHT_CLAVICLE"},
{12, "LEFT_SHOULDER"},
{13, "RIGHT_SHOULDER"},
{14, "LEFT_ELBOW"},
{15, "RIGHT_ELBOW"},
{16, "LEFT_WRIST"},
{17, "RIGHT_WRIST"},
{18, "LEFT_HIP"},
{19, "RIGHT_HIP"},
{20, "LEFT_KNEE"},
{21, "RIGHT_KNEE"},
{22, "LEFT_ANKLE"},
{23, "RIGHT_ANKLE"},
{24, "LEFT_BIG_TOE"},
{25, "RIGHT_BIG_TOE"},
{26, "LEFT_SMALL_TOE"},
{27, "RIGHT_SMALL_TOE"},
{28, "LEFT_HEEL"},
{29, "RIGHT_HEEL"},
{30, "LEFT_HAND_THUMB_4"},
{31, "RIGHT_HAND_THUMB_4"},
{32, "LEFT_HAND_INDEX_1"},
{33, "RIGHT_HAND_INDEX_1"},
{34, "LEFT_HAND_MIDDLE_4"},
{35, "RIGHT_HAND_MIDDLE_4"},
{36, "LEFT_HAND_PINKY_1"},
{37, "RIGHT_HAND_PINKY_1"},
};

#if 0


const TArray<int> parents70Idx = {
-1,
0,
Expand Down Expand Up @@ -153,47 +197,6 @@ const TArray<int> parents70Idx = {
52
};

static TMap<int, FName> Keypoints38 = TMap<int, FName>{
{0, "PELVIS"},
{1, "SPINE_1"},
{2, "SPINE_2"},
{3, "SPINE_3"},
{4, "NECK"},
{5, "NOSE"},
{6, "LEFT_EYE"},
{7, "RIGHT_EYE"},
{8, "LEFT_EAR"},
{9, "RIGHT_EAR"},
{10, "LEFT_CLAVICLE"},
{11, "RIGHT_CLAVICLE"},
{12, "LEFT_SHOULDER"},
{13, "RIGHT_SHOULDER"},
{14, "LEFT_ELBOW"},
{15, "RIGHT_ELBOW"},
{16, "LEFT_WRIST"},
{17, "RIGHT_WRIST"},
{18, "LEFT_HIP"},
{19, "RIGHT_HIP"},
{20, "LEFT_KNEE"},
{21, "RIGHT_KNEE"},
{22, "LEFT_ANKLE"},
{23, "RIGHT_ANKLE"},
{24, "LEFT_BIG_TOE"},
{25, "RIGHT_BIG_TOE"},
{26, "LEFT_SMALL_TOE"},
{27, "RIGHT_SMALL_TOE"},
{28, "LEFT_HEEL"},
{29, "RIGHT_HEEL"},
{30, "LEFT_HAND_THUMB_4"},
{31, "RIGHT_HAND_THUMB_4"},
{32, "LEFT_HAND_INDEX_1"},
{33, "RIGHT_HAND_INDEX_1"},
{34, "LEFT_HAND_MIDDLE_4"},
{35, "RIGHT_HAND_MIDDLE_4"},
{36, "LEFT_HAND_PINKY_1"},
{37, "RIGHT_HAND_PINKY_1"},
};

static TMap<int, FName> Keypoints70 = TMap<int, FName>{
{0, "PELVIS"},
{1, "SPINE_1"},
Expand Down Expand Up @@ -267,6 +270,8 @@ static TMap<int, FName> Keypoints70 = TMap<int, FName>{
{69, "RIGHT_HAND_PINKY_4"}
};

#endif

static TMap<int, FName> Keypoints34 = TMap<int, FName>{
{0, "PELVIS"},
{1, "NAVAL_SPINE"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{
"resolution": "HD720",
"fps": 30,
"depth_mode": "ULTRA"
"depth_mode": "ULTRA",
"grab_compute_capping_fps": 0
},
"BodyTrackingParameters":
{
Expand Down
Binary file modified zed-livelink-fusion/Release/linux/ZEDLiveLinkFusion
Binary file not shown.
Binary file modified zed-livelink-fusion/Release/linux/libsl_zed_c.so
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{
"resolution": "HD720",
"fps": 30,
"depth_mode": "ULTRA"
"depth_mode": "ULTRA",
"grab_compute_capping_fps": 0
},
"BodyTrackingParameters":
{
Expand Down
Binary file modified zed-livelink-fusion/Release/win64/ZEDLiveLinkFusion.exe
Binary file not shown.
Binary file modified zed-livelink-fusion/Release/win64/sl_zed_c.dll
Binary file not shown.
1 change: 1 addition & 0 deletions zed-livelink-fusion/Source/Private/SenderRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bool SenderRunner::open(SL_FusionConfiguration z_input, int cam_id, ZEDFusionCon
init_params.camera_resolution = zed_fusion_config.sender_resolution;
init_params.svo_real_time_mode = true;
init_params.input_type = fusion_config.input.input_type;
init_params.grab_compute_capping_fps = zed_fusion_config.grab_compute_capping_fps;
std::cout << init_params.input_type << std::endl;
if (fusion_config.input.input_type == sl::INPUT_TYPE::USB)
init_params.camera_device_id = cam_id;
Expand Down
2 changes: 2 additions & 0 deletions zed-livelink-fusion/Source/Private/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,13 @@ int main(int argc, char **argv)
targetBone = targetBone38;
parentsIdx = parents38Idx;
}
#if 0
else if (zed_fusion_config.sender_body_format == sl::BODY_FORMAT::BODY_70)
{
targetBone = targetBone70;
parentsIdx = parents70Idx;
}
#endif
else if (zed_fusion_config.sender_body_format == sl::BODY_FORMAT::BODY_18)
{
std::cout << "Body 18 is not compatible. Please use Body 34/38 or 70" << std::endl;
Expand Down
6 changes: 6 additions & 0 deletions zed-livelink-fusion/Source/Public/Utils/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ sl::BODY_FORMAT toBodyFormat(std::string value)
else if (value == "BODY_38") {
format = sl::BODY_FORMAT::BODY_38;
}
#if 0
else if (value == "BODY_70") {
format = sl::BODY_FORMAT::BODY_70;
}
#endif
else
format = sl::BODY_FORMAT::BODY_34;

Expand Down Expand Up @@ -159,6 +161,7 @@ struct ZEDFusionConfig {
sl::BODY_KEYPOINTS_SELECTION sender_body_selection;
float sender_confidence;
float sender_max_range;
float grab_compute_capping_fps = 0;

void read(nlohmann::json& injson) {

Expand All @@ -173,6 +176,9 @@ struct ZEDFusionConfig {
sender_depth_mode = toDepthMode(injson["InitParameters"]["depth_mode"]);
std::cout << "depth_mode : " << sender_depth_mode << std::endl;

grab_compute_capping_fps = injson["InitParameters"]["grab_compute_capping_fps"];
std::cout << "grab_compute_capping_fps : " << grab_compute_capping_fps << std::endl;

sender_detection_model = toDetectionModel(injson["BodyTrackingParameters"]["detection_model"]);
std::cout << "detection_model : " << sender_detection_model << std::endl;

Expand Down
3 changes: 3 additions & 0 deletions zed-livelink-fusion/Source/Public/ZEDStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ struct SL_InitParameters

bool async_grab_camera_recovery;

float grab_compute_capping_fps;

SL_InitParameters() {
input_type = sl::INPUT_TYPE::USB;
camera_resolution = sl::RESOLUTION::HD720;
Expand All @@ -121,6 +123,7 @@ struct SL_InitParameters
enable_image_enhancement = true;
open_timeout_sec = 5.0f;
async_grab_camera_recovery = false;
grab_compute_capping_fps = 0;
}
};

Expand Down
3 changes: 2 additions & 1 deletion zed-livelink-fusion/ZEDFusionLiveLinkConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{
"resolution": "HD720",
"fps": 30,
"depth_mode": "ULTRA"
"depth_mode": "ULTRA",
"grab_compute_capping_fps": 0
},
"BodyTrackingParameters":
{
Expand Down
Binary file modified zed-livelink-fusion/lib/linux/libsl_zed_c.so
Binary file not shown.
Binary file modified zed-livelink-fusion/lib/win64/sl_zed_c.dll
Binary file not shown.
Binary file modified zed-livelink-mono/Releases/linux/ZEDLiveLink
Binary file not shown.
3 changes: 2 additions & 1 deletion zed-livelink-mono/Releases/linux/ZEDLiveLinkConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"input_path": 0,
"resolution": "HD720",
"fps": 60,
"depth_mode": "ULTRA"
"depth_mode": "ULTRA",
"grab_compute_capping_fps": 0
},
"PositionalTrackingParameters":
{
Expand Down
Binary file modified zed-livelink-mono/Releases/linux/libsl_zed_c.so
Binary file not shown.
Binary file modified zed-livelink-mono/Releases/win64/ZEDLiveLink.exe
Binary file not shown.
3 changes: 2 additions & 1 deletion zed-livelink-mono/Releases/win64/ZEDLiveLinkConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"input_path": 0,
"resolution": "HD720",
"fps": 60,
"depth_mode": "ULTRA"
"depth_mode": "ULTRA",
"grab_compute_capping_fps": 0
},
"PositionalTrackingParameters":
{
Expand Down
Binary file modified zed-livelink-mono/Releases/win64/sl_zed_c.dll
Binary file not shown.
5 changes: 4 additions & 1 deletion zed-livelink-mono/Source/Private/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,16 @@ int main(int argc, char **argv)
targetBone = targetBone38;
parentsIdx = parents38Idx;
}
#if 0
else if (zed_config.body_format == sl::BODY_FORMAT::BODY_70)
{
targetBone = targetBone70;
parentsIdx = parents70Idx;
}
#endif
else if (zed_config.body_format == sl::BODY_FORMAT::BODY_18)
{
std::cout << "Body 18 is not compatible. Please use Body 34/38 or 70" << std::endl;
std::cout << "Body 18 is not compatible. Please use Body 34/38 " << std::endl;
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -234,6 +236,7 @@ ERROR_CODE InitCamera(int argc, char **argv, ZEDConfig& config)
init_params.depth_mode = config.depth_mode;
init_params.sdk_verbose = 1;
init_params.input_type = config.input_type;
init_params.grab_compute_capping_fps = config.grab_compute_capping_fps;
//parseArgs(argc, argv, init_params, pathSVO, ip, port);
ERROR_CODE err = zed->Open(init_params, config.serial_number, pathSVO.c_str(), ip.c_str(), port);

Expand Down
9 changes: 9 additions & 0 deletions zed-livelink-mono/Source/Public/Utils/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ sl::BODY_FORMAT toBodyFormat(std::string value)
else if (value == "BODY_38") {
format = sl::BODY_FORMAT::BODY_38;
}
#if 0
else if (value == "BODY_70") {
format = sl::BODY_FORMAT::BODY_70;
}
#endif
else
format = sl::BODY_FORMAT::BODY_34;

Expand Down Expand Up @@ -163,6 +165,7 @@ struct ZEDConfig {
float max_range;
int minimum_keypoints_threshold;
float skeleton_smoothing;
float grab_compute_capping_fps = 0;

void read(nlohmann::json& injson) {

Expand All @@ -176,6 +179,9 @@ struct ZEDConfig {
depth_mode = toDepthMode(injson["InitParameters"]["depth_mode"]);
std::cout << "depth_mode : " << depth_mode << std::endl;

grab_compute_capping_fps = injson["InitParameters"]["grab_compute_capping_fps"];
std::cout << "grab_compute_capping_fps : " << grab_compute_capping_fps << std::endl;

enable_pose_smoothing = injson["PositionalTrackingParameters"]["enable_pose_smoothing"];
std::cout << "enable_pose_smoothing : " << enable_pose_smoothing << std::endl;

Expand Down Expand Up @@ -428,6 +434,7 @@ const TArray<int> parents38Idx = {
17
};

#if 0
const TArray<FString> targetBone70 = {
"PELVIS",
"SPINE_1",
Expand Down Expand Up @@ -715,6 +722,8 @@ const TArray<int> parents70Idx = {
52,
};

#endif

const TArray<FString> targetBone34 = {
"PELVIS",
"NAVAL_SPINE",
Expand Down
22 changes: 16 additions & 6 deletions zed-livelink-mono/Source/Public/ZEDStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ struct SL_InitParameters
float open_timeout_sec;

bool async_grab_camera_recovery;
/**
Define a computation upper limit to the grab frequency.
This can be useful to get a known constant fixed rate or limit the computation load while keeping a short exposure time by setting a high camera capture framerate.
\n The value should be inferior to the InitParameters::camera_fps and strictly positive. It has no effect when reading an SVO file.
\n This is an upper limit and won't make a difference if the computation is slower than the desired compute capping fps.
\note Internally the grab function always tries to get the latest available image while respecting the desired fps as much as possible.
default is 0.
*/
float grab_compute_capping_fps;

SL_InitParameters() {
input_type = sl::INPUT_TYPE::USB;
Expand All @@ -113,6 +122,7 @@ struct SL_InitParameters
enable_image_enhancement = true;
open_timeout_sec = 5.0f;
async_grab_camera_recovery = false;
grab_compute_capping_fps = 0;
}
};

Expand Down Expand Up @@ -440,12 +450,12 @@ struct SL_BodyData
sl::float3 bounding_box[8];
sl::float3 head_bounding_box[8];
sl::float2 head_bounding_box_2d[4];
sl::float2 keypoint_2d[70];
sl::float3 keypoint[70];
float keypoint_confidence[70];
float keypoint_covariances[70][6];
sl::float3 local_position_per_joint[70];
sl::float4 local_orientation_per_joint[70];
sl::float2 keypoint_2d[38];
sl::float3 keypoint[38];
float keypoint_confidence[38];
float keypoint_covariances[38][6];
sl::float3 local_position_per_joint[38];
sl::float4 local_orientation_per_joint[38];
sl::float4 global_root_orientation;
};

Expand Down
3 changes: 2 additions & 1 deletion zed-livelink-mono/ZEDLiveLinkConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"input_path": 0,
"resolution": "HD720",
"fps": 60,
"depth_mode": "ULTRA"
"depth_mode": "ULTRA",
"grab_compute_capping_fps": 0
},
"PositionalTrackingParameters":
{
Expand Down
Binary file modified zed-livelink-mono/lib/linux/libsl_zed_c.so
Binary file not shown.
Binary file modified zed-livelink-mono/lib/win64/sl_zed_c.dll
Binary file not shown.

0 comments on commit 8a4a5bd

Please sign in to comment.