Skip to content
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

Remove TM2 (T265) from LibRS #11287

Merged
merged 4 commits into from
Jan 4, 2023
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
12 changes: 6 additions & 6 deletions .github/workflows/buildsCI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
cd ${{env.WIN_BUILD_DIR}}
pwd
ls
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=true -DBUILD_TOOLS=true -DBUILD_WITH_TM2=false -DCHECK_FOR_UPDATES=true
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=true -DBUILD_TOOLS=true -DCHECK_FOR_UPDATES=true

- name: Build
# Build your program with the given configuration
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
run: |
LRS_SRC_DIR=$(pwd)
cd ${{env.WIN_BUILD_DIR}}
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=false -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DBUILD_WITH_TM2=false -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=true -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=false -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=true -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true

- name: Build
# Build your program with the given configuration
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
run: |
LRS_SRC_DIR=$(pwd)
cd ${{env.WIN_BUILD_DIR}}
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=false -DBUILD_WITH_TM2=false -DCHECK_FOR_UPDATES=false -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true -DFORCE_RSUSB_BACKEND=true -DBUILD_CSHARP_BINDINGS=true -DDOTNET_VERSION_LIBRARY="4.5" -DDOTNET_VERSION_EXAMPLES="4.5"
cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=false -DCHECK_FOR_UPDATES=false -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true -DFORCE_RSUSB_BACKEND=true -DBUILD_CSHARP_BINDINGS=true -DDOTNET_VERSION_LIBRARY="4.5" -DDOTNET_VERSION_EXAMPLES="4.5"

- name: Build
# Build your program with the given configuration
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
shell: bash
run: |
cd build
cmake .. -DBUILD_SHARED_LIBS=false -DBUILD_EXAMPLES=true -DBUILD_TOOLS=true -DBUILD_WITH_TM2=false -DCHECK_FOR_UPDATES=true -DBUILD_LEGACY_LIVE_TEST=true -DBUILD_PYTHON_BINDINGS=true -DPYTHON_EXECUTABLE=$(which python3)
cmake .. -DBUILD_SHARED_LIBS=false -DBUILD_EXAMPLES=true -DBUILD_TOOLS=true -DCHECK_FOR_UPDATES=true -DBUILD_LEGACY_LIVE_TEST=true -DBUILD_PYTHON_BINDINGS=true -DPYTHON_EXECUTABLE=$(which python3)
cmake --build . --config ${{env.LRS_RUN_CONFIG}} -- -j4

- name: Test
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
shell: bash
run: |
cd build
cmake .. -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DBUILD_WITH_TM2=false -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=true -DBUILD_PYTHON_BINDINGS=true -DPYTHON_EXECUTABLE=$(which python3)
cmake .. -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=true -DBUILD_PYTHON_BINDINGS=true -DPYTHON_EXECUTABLE=$(which python3)
cmake --build . --config ${{env.LRS_RUN_CONFIG}} -- -j4


Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:
shell: bash
run: |
cd build
cmake .. -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=false -DBUILD_WITH_TM2=false -DCHECK_FOR_UPDATES=false -DFORCE_RSUSB_BACKEND=true -DBUILD_LEGACY_LIVE_TEST=true
cmake .. -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=false -DCHECK_FOR_UPDATES=false -DFORCE_RSUSB_BACKEND=true -DBUILD_LEGACY_LIVE_TEST=true
cmake --build . --config $LRS_BUILD_CONFIG -- -j4

- name: Test
Expand Down
1 change: 0 additions & 1 deletion CMake/android_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ macro(os_set_flags)
unset(WIN32)
unset(UNIX)
unset(APPLE)
set(BUILD_WITH_TM2 OFF)
set(BUILD_UNIT_TESTS OFF)
set(BUILD_LEGACY_LIVE_TEST OFF)
set(BUILD_EXAMPLES OFF)
Expand Down
9 changes: 0 additions & 9 deletions CMake/global_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,3 @@ macro(global_target_config)

endmacro()

macro(add_tm2)
message(STATUS "Building with TM2")
include(libusb_config)
target_link_libraries(${LRS_TARGET} PRIVATE usb)
if(USE_EXTERNAL_USB)
add_dependencies(${LRS_TARGET} libusb)
endif()
target_compile_definitions(${LRS_TARGET} PRIVATE WITH_TRACKING=1)
endmacro()
1 change: 0 additions & 1 deletion CMake/lrs_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ option(ENABLE_CCACHE "Build with ccache." ON)
option(BUILD_WITH_CUDA "Enable CUDA" OFF)
option(BUILD_GLSL_EXTENSIONS "Build GLSL extensions API" ON)
option(BUILD_WITH_OPENMP "Use OpenMP" OFF)
option(BUILD_WITH_TM2 "Build with support for Intel TM2 tracking device" ON)
option(BUILD_EASYLOGGINGPP "Build EasyLogging++ as a part of the build" ON)
option(BUILD_WITH_STATIC_CRT "Build with static link CRT" ON)
option(HWM_OVER_XU "Send HWM commands over UVC XU control" ON)
Expand Down
1 change: 0 additions & 1 deletion CMake/unix_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ macro(os_set_flags)

if(APPLE)
set(FORCE_RSUSB_BACKEND ON)
set(BUILD_WITH_TM2 ON)
endif()

if(FORCE_RSUSB_BACKEND)
Expand Down
10 changes: 0 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ if(${FORCE_LIBUVC} OR ${FORCE_WINUSB_UVC} OR ${ANDROID_USB_HOST_UVC})
set(FORCE_RSUSB_BACKEND ON)
endif()

# Checking Internet connection, as TM2 needs to download the FW from amazon cloud
if(BUILD_WITH_TM2 AND NOT INTERNET_CONNECTION)
message(WARNING "No internet connection, disabling BUILD_WITH_TM2")
set(BUILD_WITH_TM2 OFF)
endif()

# Checking Internet connection, as DEPTH CAM needs to download the FW from amazon cloud
if(IMPORT_DEPTH_CAM_FW AND NOT INTERNET_CONNECTION)
message(WARNING "No internet connection, disabling IMPORT_DEPTH_CAM_FW")
Expand Down Expand Up @@ -104,10 +98,6 @@ if(BUILD_NETWORK_DEVICE)
add_subdirectory(src/compression)
endif()

if(BUILD_WITH_TM2)
add_tm2()
endif()

if(IMPORT_DEPTH_CAM_FW)
add_subdirectory(common/fw)
endif()
Expand Down
22 changes: 7 additions & 15 deletions common/fw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,19 @@ set(REALSENSE_FIRMWARE_URL "https://librealsense.intel.com" CACHE STRING

string(REGEX MATCH "D4XX_RECOMMENDED_FIRMWARE_VERSION \"([0-9]+.[0-9]+.[0-9]+.[0-9]+)\"" _ ${ver})
set(D4XX_FW_VERSION ${CMAKE_MATCH_1})
message(STATUS "D4XX_FW_VERSION: ${D4XX_FW_VERSION}")
#message(STATUS "D4XX_FW_VERSION: ${D4XX_FW_VERSION}")
set(D4XX_FW_SHA1 8dc3b8a0b9fdf03410c15b30e04f57701985064a)
set(D4XX_FW_URL "${REALSENSE_FIRMWARE_URL}/Releases/RS4xx/FW")


string(REGEX MATCH "SR3XX_RECOMMENDED_FIRMWARE_VERSION \"([0-9]+.[0-9]+.[0-9]+.[0-9]+)\"" _ ${ver})
set(SR3XX_FW_VERSION ${CMAKE_MATCH_1})
message(STATUS "SR3XX_FW_VERSION: ${SR3XX_FW_VERSION}")
#message(STATUS "SR3XX_FW_VERSION: ${SR3XX_FW_VERSION}")
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
set(SR3XX_FW_SHA1 55237dba5d7db20e7c218975375d05b4210e9460)
set(SR3XX_FW_URL "${REALSENSE_FIRMWARE_URL}/Releases/SR300/FW")

string(REGEX MATCH "T26X_FIRMWARE_VERSION \"([0-9]+.[0-9]+.[0-9]+.[0-9]+)\"" _ ${ver})
set(T26X_FW_VERSION ${CMAKE_MATCH_1})
message(STATUS "T26X_FW_VERSION: ${T26X_FW_VERSION}")
set(T26X_FW_SHA1 c3940ccbb0e3045603e4aceaa2d73427f96e24bc)
set(T26X_FW_URL "${REALSENSE_FIRMWARE_URL}/Releases/TM2/FW/target/${T26X_FW_VERSION}")

string(REGEX MATCH "L51X_RECOMMENDED_FIRMWARE_VERSION \"([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\"" _ ${ver})
set(L51X_FW_VERSION ${CMAKE_MATCH_1})
message(STATUS "L51X_FW_VERSION: ${L51X_FW_VERSION}")
#message(STATUS "L51X_FW_VERSION: ${L51X_FW_VERSION}")
set(L51X_FW_SHA1 ab73e5bfc520c0aa0340cada4b3e317b8fd31a4d)
set(L51X_FW_URL "${REALSENSE_FIRMWARE_URL}/Releases/L5xx/FW")

Expand All @@ -58,15 +51,15 @@ set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER Resources)

function(target_binary url version sha1 symbol ext)
set(binary "${CMAKE_CURRENT_BINARY_DIR}/${symbol}-${version}${ext}")
message(STATUS "${url}/${symbol}-${version}${ext}")
message(STATUS "... ${url}/${symbol}-${version}${ext}")
file(DOWNLOAD "${url}/${symbol}-${version}${ext}" "${binary}"
EXPECTED_HASH SHA1=${sha1}
STATUS status)
list(GET status 0 error_code)
if (NOT ${error_code} EQUAL 0)
message(FATAL_ERROR "Download firmwnare (${status}) - ${url}")
message(FATAL_ERROR "FAILED with status ${status}")
else()
message(STATUS "Download firmware ${status} for ${symbol}-${version}${ext}")
#message(STATUS "Download firmware ${status} for ${symbol}-${version}${ext}")
endif()
string(TOUPPER ${symbol} SYMBOL)
string(REPLACE "." "," version_commas ${version})
Expand All @@ -86,12 +79,11 @@ endfunction()

target_binary( "${D4XX_FW_URL}" "${D4XX_FW_VERSION}" "${D4XX_FW_SHA1}" D4XX_FW_Image .bin)
target_binary( "${SR3XX_FW_URL}" "${SR3XX_FW_VERSION}" "${SR3XX_FW_SHA1}" SR3XX_FW_Image .bin)
target_binary( "${T26X_FW_URL}" "${T26X_FW_VERSION}" "${T26X_FW_SHA1}" target .mvcmd)
target_binary( "${L51X_FW_URL}" "${L51X_FW_VERSION}" "${L51X_FW_SHA1}" L51X_FW_Image .bin)



install(TARGETS ${PROJECT_NAME} EXPORT realsense2Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

2 changes: 1 addition & 1 deletion common/fw/fw.rc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "D4XX_FW_Image.rc"
#include "SR3XX_FW_Image.rc"
#include "L51X_FW_Image.rc"
#include "target.rc"

87 changes: 3 additions & 84 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4112,7 +4112,7 @@ namespace rs2
fps = s.second.profile.fps();
}
auto curr_frame = p.get_position();
uint64_t step = fps ? uint64_t(1000.0 / (float)fps * 1e6) : 1e6;
uint64_t step = fps ? uint64_t(1000.0 / (float)fps * 1e6) : 1000000ULL;
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
if (curr_frame >= step)
{
p.seek(std::chrono::nanoseconds(curr_frame - step));
Expand Down Expand Up @@ -4215,7 +4215,7 @@ namespace rs2
fps = s.second.profile.fps();
}
auto curr_frame = p.get_position();
uint64_t step = fps ? uint64_t(1000.0 / (float)fps * 1e6) : 1e6;
uint64_t step = fps ? uint64_t(1000.0 / (float)fps * 1e6) : 1000000ULL;
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
p.seek(std::chrono::nanoseconds(curr_frame + step));
}
if (ImGui::IsItemHovered())
Expand Down Expand Up @@ -5039,87 +5039,6 @@ namespace rs2

bool something_to_show = false;
ImGui::PushStyleColor(ImGuiCol_Text, dark_grey);
if (auto tm2_extensions = dev.as<rs2::tm2>())
{
something_to_show = true;
try
{
if (!tm2_extensions.is_loopback_enabled() && ImGui::Selectable("Enable loopback...", false, is_streaming ? ImGuiSelectableFlags_Disabled : 0))
{
if (const char* ret = file_dialog_open(file_dialog_mode::open_file, "ROS-bag\0*.bag\0", NULL, NULL))
{
tm2_extensions.enable_loopback(ret);
}
}
if (tm2_extensions.is_loopback_enabled() && ImGui::Selectable("Disable loopback...", false, is_streaming ? ImGuiSelectableFlags_Disabled : 0))
{
tm2_extensions.disable_loopback();
}
if (ImGui::IsItemHovered())
{
if (is_streaming)
ImGui::SetTooltip("Stop streaming to use loopback functionality");
else
ImGui::SetTooltip("Enter the device to loopback mode (inject frames from file to FW)");
}

if (auto tm_sensor = dev.first<pose_sensor>())
{
if (ImGui::Selectable("Export Localization map"))
{
if (auto target_path = file_dialog_open(save_file, "Tracking device Localization map (RAW)\0*.map\0", NULL, NULL))
{
error_message = safe_call([&]()
{
std::stringstream ss;
ss << "Exporting localization map to " << target_path << " ... ";
viewer.not_model->add_log(ss.str());
bin_file_from_bytes(target_path, tm_sensor.export_localization_map());
ss.clear();
ss << "completed";
viewer.not_model->add_log(ss.str());
});
}
}

if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Retrieve the localization map from device");
}

if (ImGui::Selectable("Import Localization map", false, is_streaming ? ImGuiSelectableFlags_Disabled : 0))
{
if (auto source_path = file_dialog_open(open_file, "Tracking device Localization map (RAW)\0*.map\0", NULL, NULL))
{
error_message = safe_call([&]()
{
std::stringstream ss;
ss << "Importing localization map from " << source_path << " ... ";
tm_sensor.import_localization_map(bytes_from_bin_file(source_path));
ss << "completed";
viewer.not_model->add_log(ss.str());
});
}
}

if (ImGui::IsItemHovered())
{
if (is_streaming)
ImGui::SetTooltip("Stop streaming to Import localization map");
else
ImGui::SetTooltip("Load localization map from host to device");
}
}
}
catch (const rs2::error& e)
{
error_message = error_to_string(e);
}
catch (const std::exception& e)
{
error_message = e.what();
}
}

if (_allow_remove)
{
Expand Down Expand Up @@ -7173,7 +7092,7 @@ namespace rs2
reset_trajectory();

rs2_pose pose_data = const_cast<pose_frame&>(pose).get_pose_data();
auto t = tm2_pose_to_world_transformation(pose_data);
auto t = pose_to_world_transformation(pose_data);
float model[4][4];
t.to_column_major((float*)model);

Expand Down
18 changes: 9 additions & 9 deletions common/rendering.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,31 +197,31 @@ namespace rs2
return { a * b.x, a * b.y };
}

inline matrix4 tm2_pose_to_world_transformation(const rs2_pose& pose)
inline matrix4 pose_to_world_transformation(const rs2_pose& pose)
{
matrix4 rotation(pose.rotation);
matrix4 translation(pose.translation);
matrix4 G_tm2_body_to_tm2_world = translation * rotation;
matrix4 G_body_to_world = translation * rotation;
float rotate_180_y[4][4] = { { -1, 0, 0, 0 },
{ 0, 1, 0, 0 },
{ 0, 0,-1, 0 },
{ 0, 0, 0, 1 } };
matrix4 G_vr_body_to_tm2_body(rotate_180_y);
matrix4 G_vr_body_to_tm2_world = G_tm2_body_to_tm2_world * G_vr_body_to_tm2_body;
matrix4 G_vr_body_to_body(rotate_180_y);
matrix4 G_vr_body_to_world = G_body_to_world * G_vr_body_to_body;

float rotate_90_x[4][4] = { { 1, 0, 0, 0 },
{ 0, 0,-1, 0 },
{ 0, 1, 0, 0 },
{ 0, 0, 0, 1 } };
matrix4 G_tm2_world_to_vr_world(rotate_90_x);
matrix4 G_vr_body_to_vr_world = G_tm2_world_to_vr_world * G_vr_body_to_tm2_world;
matrix4 G_world_to_vr_world(rotate_90_x);
matrix4 G_vr_body_to_vr_world = G_world_to_vr_world * G_vr_body_to_world;

return G_vr_body_to_vr_world;
}

inline rs2_pose correct_tm2_pose(const rs2_pose& pose)
inline rs2_pose correct_pose(const rs2_pose& pose)
{
matrix4 G_vr_body_to_vr_world = tm2_pose_to_world_transformation(pose);
matrix4 G_vr_body_to_vr_world = pose_to_world_transformation(pose);
rs2_pose res = pose;
res.translation.x = G_vr_body_to_vr_world.mat[0][3];
res.translation.y = G_vr_body_to_vr_world.mat[1][3];
Expand Down Expand Up @@ -949,7 +949,7 @@ namespace rs2
draw_axes(0.3f, 2.f);

// Drawing pose:
matrix4 pose_trans = tm2_pose_to_world_transformation(pose);
matrix4 pose_trans = pose_to_world_transformation(pose);
float model[16];
pose_trans.to_column_major(model);

Expand Down
2 changes: 1 addition & 1 deletion common/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ namespace rs2
pose = f;
rs2_pose pose_data = pose.get_pose_data();

auto t = tm2_pose_to_world_transformation(pose_data);
auto t = pose_to_world_transformation(pose_data);
float model[4][4];
t.to_column_major((float*)model);
auto m = model;
Expand Down
Loading