The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/rs: cleanup and initialize u_config_json with zero

authored by

Moses Turner and committed by
Jakob Bornecrantz
5cb130cd 36bc45b6

+30 -27
+30 -27
src/xrt/drivers/realsense/rs_6dof.c
··· 409 409 rs->enable_pose_prediction = true; 410 410 rs->enable_pose_filtering = true; 411 411 412 - struct u_config_json config_json; 412 + struct u_config_json config_json = {0}; 413 + 413 414 u_config_json_open_or_create_main_file(&config_json); 414 - cJSON *realsense_config_json = cJSON_GetObjectItemCaseSensitive(config_json.root, "config_realsense"); 415 - if (realsense_config_json != NULL) { 416 - cJSON *mapping = cJSON_GetObjectItemCaseSensitive(realsense_config_json, "enable_mapping"); 417 - cJSON *pose_jumping = cJSON_GetObjectItemCaseSensitive(realsense_config_json, "enable_pose_jumping"); 418 - cJSON *relocalization = 419 - cJSON_GetObjectItemCaseSensitive(realsense_config_json, "enable_relocalization"); 420 - cJSON *pose_prediction = 421 - cJSON_GetObjectItemCaseSensitive(realsense_config_json, "enable_pose_prediction"); 422 - cJSON *pose_filtering = 423 - cJSON_GetObjectItemCaseSensitive(realsense_config_json, "enable_pose_filtering"); 415 + if (config_json.file_loaded) { 416 + const cJSON *realsense_config_json = u_json_get(config_json.root, "config_realsense"); 417 + if (realsense_config_json != NULL) { 418 + const cJSON *mapping = u_json_get(realsense_config_json, "enable_mapping"); 419 + const cJSON *pose_jumping = u_json_get(realsense_config_json, "enable_pose_jumping"); 420 + const cJSON *relocalization = u_json_get(realsense_config_json, "enable_relocalization"); 421 + const cJSON *pose_prediction = u_json_get(realsense_config_json, "enable_pose_prediction"); 422 + const cJSON *pose_filtering = u_json_get(realsense_config_json, "enable_pose_filtering"); 424 423 425 - // if json key isn't in the json, default to true. if it is in there, use json value 426 - if (mapping != NULL) { 427 - rs->enable_mapping = cJSON_IsTrue(mapping); 428 - } 429 - if (pose_jumping != NULL) { 430 - rs->enable_pose_jumping = cJSON_IsTrue(pose_jumping); 431 - } 432 - if (relocalization != NULL) { 433 - rs->enable_relocalization = cJSON_IsTrue(relocalization); 434 - } 435 - if (pose_prediction != NULL) { 436 - rs->enable_pose_prediction = cJSON_IsTrue(pose_prediction); 437 - } 438 - if (pose_filtering != NULL) { 439 - rs->enable_pose_filtering = cJSON_IsTrue(pose_filtering); 424 + // if json key isn't in the json, default to true. if it is in there, use json value 425 + if (mapping != NULL) { 426 + rs->enable_mapping = cJSON_IsTrue(mapping); 427 + } 428 + if (pose_jumping != NULL) { 429 + rs->enable_pose_jumping = cJSON_IsTrue(pose_jumping); 430 + } 431 + if (relocalization != NULL) { 432 + rs->enable_relocalization = cJSON_IsTrue(relocalization); 433 + } 434 + if (pose_prediction != NULL) { 435 + rs->enable_pose_prediction = cJSON_IsTrue(pose_prediction); 436 + } 437 + if (pose_filtering != NULL) { 438 + rs->enable_pose_filtering = cJSON_IsTrue(pose_filtering); 439 + } 440 440 } 441 + U_LOG_D("Used config file"); 442 + } else { 443 + U_LOG_D("Did not use config file"); 441 444 } 445 + 442 446 U_LOG_D("Realsense opts are %i %i %i %i %i\n", rs->enable_mapping, rs->enable_pose_jumping, 443 447 rs->enable_relocalization, rs->enable_pose_prediction, rs->enable_pose_filtering); 444 - 445 448 rs->base.update_inputs = rs_6dof_update_inputs; 446 449 rs->base.get_tracked_pose = rs_6dof_get_tracked_pose; 447 450 rs->base.get_view_pose = rs_6dof_get_view_pose;