Skip to content

Commit

Permalink
Merge branch 'development' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dorodnic authored Jan 21, 2020
2 parents 33ec0a3 + db6cd95 commit 970f260
Show file tree
Hide file tree
Showing 229 changed files with 14,026 additions and 20,903 deletions.
4 changes: 2 additions & 2 deletions CMake/android_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ macro(os_set_flags)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pedantic -g -Wno-missing-field-initializers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-multichar")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")

set(HWM_OVER_XU ON)

if(FORCE_RSUSB_BACKEND)
set(BACKEND RS2_USE_ANDROID_BACKEND)
set(HWM_OVER_XU ON)
set(IMPORT_DEPTH_CAM_FW OFF)
else()
set(BACKEND RS2_USE_V4L2_BACKEND)
Expand Down
7 changes: 3 additions & 4 deletions CMake/global_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ endmacro()

macro(add_tm2)
message(STATUS "Building with TM2")
add_subdirectory(third-party/libtm)
include(libusb_config)
target_link_libraries(${LRS_TARGET} PRIVATE usb)
if(USE_EXTERNAL_USB)
add_dependencies(tm libusb)
add_dependencies(${LRS_TARGET} libusb)
endif()
target_compile_definitions(${LRS_TARGET} PRIVATE WITH_TRACKING=1 BUILD_STATIC=1)
target_link_libraries(${LRS_TARGET} PRIVATE tm ${CMAKE_THREAD_LIBS_INIT})
target_compile_definitions(${LRS_TARGET} PRIVATE WITH_TRACKING=1)
endmacro()
2 changes: 1 addition & 1 deletion CMake/libusb_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if (NOT TARGET usb)
find_path(LIBUSB_INC libusb.h HINTS PATH_SUFFIXES libusb-1.0)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(usb "libusb not found; using internal version" LIBUSB_LIB LIBUSB_INC)
if (USB_FOUND)
if (USB_FOUND AND NOT USE_EXTERNAL_USB)
add_library(usb INTERFACE)
target_include_directories(usb INTERFACE ${LIBUSB_INC})
target_link_libraries(usb INTERFACE ${LIBUSB_LIB})
Expand Down
5 changes: 3 additions & 2 deletions CMake/unix_config.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
message(STATUS "Setting Unix configurations")

macro(os_set_flags)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -pedantic -g -D_DEFAULT_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pedantic -g -Wno-missing-field-initializers")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -g -D_DEFAULT_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -g -Wno-missing-field-initializers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-multichar -Wsequence-point -Wformat -Wformat-security")

execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE MACHINE)
Expand Down
3 changes: 2 additions & 1 deletion common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright(c) 2019 Intel Corporation. All Rights Reserved.

set(COMMON_SRC
"${CMAKE_CURRENT_LIST_DIR}/rendering.h"
"${CMAKE_CURRENT_LIST_DIR}/rendering.h"
"${CMAKE_CURRENT_LIST_DIR}/model-views.h"
"${CMAKE_CURRENT_LIST_DIR}/model-views.cpp"
"${CMAKE_CURRENT_LIST_DIR}/notifications.h"
Expand All @@ -23,4 +23,5 @@ set(COMMON_SRC
"${CMAKE_CURRENT_LIST_DIR}/fw-update-helper.cpp"
"${CMAKE_CURRENT_LIST_DIR}/on-chip-calib.h"
"${CMAKE_CURRENT_LIST_DIR}/on-chip-calib.cpp"
"${CMAKE_CURRENT_LIST_DIR}/decompress-huffman.h"
)
8,947 changes: 8,947 additions & 0 deletions common/decompress-huffman.h

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,23 @@ namespace rs2

std::map<int, std::vector<uint8_t>> rv;

if ("" != FW_D4XX_FW_IMAGE_VERSION && !allow_rc_firmware)
if (strlen(FW_D4XX_FW_IMAGE_VERSION) && !allow_rc_firmware)
{
int size = 0;
auto hex = fw_get_D4XX_FW_Image(size);
auto vec = std::vector<uint8_t>(hex, hex + size);
rv[RS2_PRODUCT_LINE_D400] = vec;
}

if ("" != FW_D4XX_RC_IMAGE_VERSION && allow_rc_firmware)
if (strlen(FW_D4XX_RC_IMAGE_VERSION) && allow_rc_firmware)
{
int size = 0;
auto hex = fw_get_D4XX_RC_Image(size);
auto vec = std::vector<uint8_t>(hex, hex + size);
rv[RS2_PRODUCT_LINE_D400] = vec;
}

if ("" != FW_SR3XX_FW_IMAGE_VERSION)
if (strlen(FW_SR3XX_FW_IMAGE_VERSION))
{
int size = 0;
auto hex = fw_get_SR3XX_FW_Image(size);
Expand Down Expand Up @@ -550,4 +550,4 @@ namespace rs2

pinned = true;
}
}
}
8 changes: 8 additions & 0 deletions common/fw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ message(STATUS "SR3XX_FW_VERSION: ${SR3XX_FW_VERSION}")
set(SR3XX_FW_SHA1 55237dba5d7db20e7c218975375d05b4210e9460)
set(SR3XX_FW_URL "http://realsense-hw-public.s3-eu-west-1.amazonaws.com/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 0785bd402f54f4f58d838c5fe1a7c422b2df5d2f)
set(T26X_FW_URL "http://realsense-hw-public.s3.amazonaws.com/Releases/TM2/FW/target/${T26X_FW_VERSION}")

add_library(${PROJECT_NAME} STATIC empty.c)

if (MSVC)
Expand All @@ -42,6 +48,7 @@ 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}")
file(DOWNLOAD "${url}/${symbol}-${version}${ext}" "${binary}"
EXPECTED_HASH SHA1=${sha1}
STATUS status)
Expand Down Expand Up @@ -70,6 +77,7 @@ endfunction()
target_binary( "${D4XX_FW_URL}" "${D4XX_FW_VERSION}" "${D4XX_FW_SHA1}" D4XX_FW_Image .bin)
target_binary( "${D4XX_RC_URL}" "${D4XX_RC_VERSION}" "${D4XX_RC_SHA1}" D4XX_RC_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)

install(TARGETS ${PROJECT_NAME} EXPORT realsense2Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down
3 changes: 2 additions & 1 deletion common/fw/firmware-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

#define D4XX_RECOMMENDED_FIRMWARE_VERSION "5.12.1.0"
#define SR3XX_RECOMMENDED_FIRMWARE_VERSION "3.26.1.0"
#define D4XX_RC_FIRMWARE_VERSION "5.12.1.0"
#define D4XX_RC_FIRMWARE_VERSION "5.12.1.0"
#define T26X_FIRMWARE_VERSION "0.2.0.908"
1 change: 1 addition & 0 deletions common/fw/uvc_fw.rc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "D4XX_FW_Image.rc"
#include "D4XX_RC_Image.rc"
#include "SR3XX_FW_Image.rc"
#include "target.rc"
117 changes: 13 additions & 104 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ namespace rs2
streaming(false), _pause(false),
depth_colorizer(std::make_shared<rs2::gl::colorizer>()),
yuy2rgb(std::make_shared<rs2::gl::yuy_decoder>()),
depth_decoder(std::make_shared<rs2::depth_huffman_decoder>()),
viewer(viewer)
{
restore_processing_block("colorizer", depth_colorizer);
Expand Down Expand Up @@ -953,8 +954,8 @@ namespace rs2
this, shared_filter->get_info(RS2_CAMERA_INFO_NAME), shared_filter,
[=](rs2::frame f) { return shared_filter->process(f); }, error_message);

//if (shared_filter->is<disparity_transform>())
// model->visible = false;
if (shared_filter->is<depth_huffman_decoder>())
model->visible = false;

if (is_zo)
{
Expand Down Expand Up @@ -2044,6 +2045,7 @@ namespace rs2
profile = p;
texture->colorize = d->depth_colorizer;
texture->yuy2rgb = d->yuy2rgb;
texture->depth_decode = d->depth_decoder;

if (auto vd = p.as<video_stream_profile>())
{
Expand Down Expand Up @@ -3546,8 +3548,13 @@ namespace rs2
{
if(auto depth = viewer.get_3d_depth_source(filtered))
{
if (depth.get_profile().format() == RS2_FORMAT_DISPARITY32)
depth = disp_to_depth.process(depth);
switch (depth.get_profile().format())
{
case RS2_FORMAT_DISPARITY32: depth = disp_to_depth.process(depth); break;
case RS2_FORMAT_Z16H: depth = depth_decoder.process(depth); break;
default: break;
}

res.push_back(pc->calculate(depth));
}
if(auto texture = viewer.get_3d_texture_source(filtered))
Expand Down Expand Up @@ -3986,69 +3993,6 @@ namespace rs2

}

void device_model::draw_controllers_panel(ImFont* font, bool is_device_streaming)
{
if (!is_device_streaming)
{
controllers.clear();
available_controllers.clear();
return;
}

if (controllers.size() > 0 || available_controllers.size() > 0)
{
int flags = dev.is<playback>() ? ImGuiButtonFlags_Disabled : 0;
ImGui::PushStyleColor(ImGuiCol_Button, sensor_bg);
ImGui::PushStyleColor(ImGuiCol_Text, light_grey);
ImGui::PushStyleColor(ImGuiCol_PopupBg, almost_white_bg);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, from_rgba(0, 0xae, 0xff, 255));
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, white);
ImGui::PushFont(font);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, { 10,0 });
const float button_dim = 30.f;
for (auto&& c : available_controllers)
{
ImGui::PushStyleColor(ImGuiCol_Text, white);
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, white);
std::string action = "Attach controller";
std::string mac = to_string() << (int)c[0] << ":" << (int)c[1] << ":" << (int)c[2] << ":" << (int)c[3] << ":" << (int)c[4] << ":" << (int)c[5];
std::string label = to_string() << u8"\uf11b" << "##" << action << mac;
if (ImGui::ButtonEx(label.c_str(), { button_dim , button_dim }, flags))
{
dev.as<tm2>().connect_controller(c);
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", action.c_str());
}
ImGui::SameLine();
ImGui::Text("%s", mac.c_str());
ImGui::PopStyleColor(2);
}
for (auto&& c : controllers)
{
ImGui::PushStyleColor(ImGuiCol_Text, light_blue);
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, light_blue);
std::string action = "Detach controller";
std::string label = to_string() << u8"\uf11b" << "##" << action << c.first;
if (ImGui::ButtonEx(label.c_str(), { button_dim , button_dim }, flags))
{
dev.as<tm2>().disconnect_controller(c.first);
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", action.c_str());
}
ImGui::SameLine();
ImGui::Text("Controller #%d (connected)", c.first);
ImGui::PopStyleColor(2);
}
ImGui::PopStyleVar();
ImGui::PopFont();
ImGui::PopStyleColor(5);
}
}

std::vector<std::string> get_device_info(const device& dev, bool include_location)
{
std::vector<std::string> res;
Expand Down Expand Up @@ -4470,7 +4414,7 @@ namespace rs2

if (auto tm_sensor = dev.first<pose_sensor>())
{
if (ImGui::Selectable("Export Localization map", false, is_streaming ? ImGuiSelectableFlags_Disabled : 0))
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))
{
Expand All @@ -4489,10 +4433,7 @@ namespace rs2

if (ImGui::IsItemHovered())
{
if (is_streaming)
ImGui::SetTooltip("Stop streaming to Export localization map");
else
ImGui::SetTooltip("Retrieve the localization map from device");
ImGui::SetTooltip("Retrieve the localization map from device");
}

if (ImGui::Selectable("Import Localization map", false, is_streaming ? ImGuiSelectableFlags_Disabled : 0))
Expand Down Expand Up @@ -5459,7 +5400,6 @@ namespace rs2
{
return sm->streaming;
});
draw_controllers_panel(window.get_font(), is_streaming);

pos = ImGui::GetCursorPos();

Expand Down Expand Up @@ -5983,28 +5923,6 @@ namespace rs2
void device_model::handle_hardware_events(const std::string& serialized_data)
{
//TODO: Move under hour glass
std::string event_type = get_event_type(serialized_data);
if (event_type == "Controller Event")
{
std::string subtype = get_subtype(serialized_data);
if (subtype == "Connection")
{
std::array<uint8_t, 6> mac_addr = get_mac(serialized_data);
int id = get_id(serialized_data);
controllers[id] = mac_addr;
available_controllers.erase(mac_addr);
}
else if (subtype == "Discovery")
{
std::array<uint8_t, 6> mac_addr = get_mac(serialized_data);
available_controllers.insert(mac_addr);
}
else if (subtype == "Disconnection")
{
int id = get_id(serialized_data);
controllers.erase(id);
}
}
}

device_changes::device_changes(rs2::context& ctx)
Expand Down Expand Up @@ -6032,15 +5950,6 @@ namespace rs2
_changes.pop();
return true;
}
void tm2_model::draw_controller_pose_object()
{
const float sphere_radius = 0.02f;
const float controller_height = 0.2f;
//TODO: Draw controller holder as cylinder
texture_buffer::draw_circle(1, 0, 0, 0, 1, 0, sphere_radius, { 0.0, controller_height + sphere_radius, 0.0 }, 1.0f);
texture_buffer::draw_circle(0, 1, 0, 0, 0, 1, sphere_radius, { 0.0, controller_height + sphere_radius, 0.0 }, 1.0f);
texture_buffer::draw_circle(1, 0, 0, 0, 0, 1, sphere_radius, { 0.0, controller_height + sphere_radius, 0.0 }, 1.0f);
}

// Aggregate the trajectory path
void tm2_model::update_model_trajectory(const pose_frame& pose, bool track)
Expand Down
6 changes: 2 additions & 4 deletions common/model-views.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ namespace rs2
tm2_model() : _trajectory_tracking(true)
{
}
void draw_controller_pose_object();
void draw_trajectory(bool is_trajectory_button_pressed);
void update_model_trajectory(const pose_frame& pose, bool track);
void record_trajectory(bool on) { _trajectory_tracking = on; };
Expand Down Expand Up @@ -712,6 +711,7 @@ namespace rs2
std::shared_ptr<rs2::colorizer> depth_colorizer;
std::shared_ptr<rs2::yuy_decoder> yuy2rgb;
std::shared_ptr<processing_block_model> zero_order_artifact_fix;
std::shared_ptr<rs2::depth_huffman_decoder> depth_decoder;

std::vector<std::shared_ptr<processing_block_model>> post_processing;
bool post_processing_enabled = true;
Expand Down Expand Up @@ -830,8 +830,6 @@ namespace rs2
bool allow_remove = true;
bool show_depth_only = false;
bool show_stream_selection = true;
std::map<int, std::array<uint8_t, 6>> controllers;
std::set<std::array<uint8_t, 6>> available_controllers;
std::vector<std::pair<std::string, std::string>> infos;
std::vector<std::string> restarting_device_info;
std::set<std::string> advanced_mode_settings_file_names;
Expand All @@ -845,7 +843,6 @@ namespace rs2
int draw_playback_controls(ux_window& window, ImFont* font, viewer_model& view);
advanced_mode_control amc;
std::string pretty_time(std::chrono::nanoseconds duration);
void draw_controllers_panel(ImFont* font, bool is_device_streaming);
float draw_device_panel(float panel_width,
ux_window& window,
std::string& error_message,
Expand Down Expand Up @@ -957,6 +954,7 @@ namespace rs2
rs2::frameset model;
std::shared_ptr<processing_block_model> pc_gen;
rs2::disparity_transform disp_to_depth;
rs2::depth_huffman_decoder depth_decoder;

/* Post processing filter rendering */
std::atomic<bool> render_thread_active; // True when render post processing filter rendering thread is active, False otherwise
Expand Down
Loading

0 comments on commit 970f260

Please sign in to comment.