Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
monado
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
monado
Commits
606b23b5
Commit
606b23b5
authored
4 years ago
by
Jakob Bornecrantz
Browse files
Options
Downloads
Patches
Plain Diff
d/rs: Tidy code (NFC)
parent
855cdb4c
No related branches found
No related tags found
No related merge requests found
Pipeline
#19333
failed
4 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/xrt/drivers/realsense/rs_6dof.c
+56
-29
56 additions, 29 deletions
src/xrt/drivers/realsense/rs_6dof.c
with
56 additions
and
29 deletions
src/xrt/drivers/realsense/rs_6dof.c
+
56
−
29
View file @
606b23b5
...
@@ -342,6 +342,54 @@ rs_run_thread(void *ptr)
...
@@ -342,6 +342,54 @@ rs_run_thread(void *ptr)
return
NULL
;
return
NULL
;
}
}
static
bool
load_config
(
struct
rs_6dof
*
rs
)
{
struct
u_config_json
config_json
=
{
0
};
u_config_json_open_or_create_main_file
(
&
config_json
);
if
(
!
config_json
.
file_loaded
)
{
return
false
;
}
const
cJSON
*
realsense_config_json
=
u_json_get
(
config_json
.
root
,
"config_realsense"
);
if
(
realsense_config_json
==
NULL
)
{
return
false
;
}
const
cJSON
*
mapping
=
u_json_get
(
realsense_config_json
,
"enable_mapping"
);
const
cJSON
*
pose_jumping
=
u_json_get
(
realsense_config_json
,
"enable_pose_jumping"
);
const
cJSON
*
relocalization
=
u_json_get
(
realsense_config_json
,
"enable_relocalization"
);
const
cJSON
*
pose_prediction
=
u_json_get
(
realsense_config_json
,
"enable_pose_prediction"
);
const
cJSON
*
pose_filtering
=
u_json_get
(
realsense_config_json
,
"enable_pose_filtering"
);
// if json key isn't in the json, default to true. if it is in there, use json value
if
(
mapping
!=
NULL
)
{
rs
->
enable_mapping
=
cJSON_IsTrue
(
mapping
);
}
if
(
pose_jumping
!=
NULL
)
{
rs
->
enable_pose_jumping
=
cJSON_IsTrue
(
pose_jumping
);
}
if
(
relocalization
!=
NULL
)
{
rs
->
enable_relocalization
=
cJSON_IsTrue
(
relocalization
);
}
if
(
pose_prediction
!=
NULL
)
{
rs
->
enable_pose_prediction
=
cJSON_IsTrue
(
pose_prediction
);
}
if
(
pose_filtering
!=
NULL
)
{
rs
->
enable_pose_filtering
=
cJSON_IsTrue
(
pose_filtering
);
}
return
true
;
}
/*
*
* Device functions.
*
*/
static
void
static
void
rs_6dof_update_inputs
(
struct
xrt_device
*
xdev
)
rs_6dof_update_inputs
(
struct
xrt_device
*
xdev
)
{
{
...
@@ -398,6 +446,13 @@ rs_6dof_destroy(struct xrt_device *xdev)
...
@@ -398,6 +446,13 @@ rs_6dof_destroy(struct xrt_device *xdev)
free
(
rs
);
free
(
rs
);
}
}
/*
*
* 'Exported' functions.
*
*/
struct
xrt_device
*
struct
xrt_device
*
rs_6dof_create
(
void
)
rs_6dof_create
(
void
)
{
{
...
@@ -409,35 +464,7 @@ rs_6dof_create(void)
...
@@ -409,35 +464,7 @@ rs_6dof_create(void)
rs
->
enable_pose_prediction
=
true
;
rs
->
enable_pose_prediction
=
true
;
rs
->
enable_pose_filtering
=
true
;
rs
->
enable_pose_filtering
=
true
;
struct
u_config_json
config_json
=
{
0
};
if
(
load_config
(
rs
))
{
u_config_json_open_or_create_main_file
(
&
config_json
);
if
(
config_json
.
file_loaded
)
{
const
cJSON
*
realsense_config_json
=
u_json_get
(
config_json
.
root
,
"config_realsense"
);
if
(
realsense_config_json
!=
NULL
)
{
const
cJSON
*
mapping
=
u_json_get
(
realsense_config_json
,
"enable_mapping"
);
const
cJSON
*
pose_jumping
=
u_json_get
(
realsense_config_json
,
"enable_pose_jumping"
);
const
cJSON
*
relocalization
=
u_json_get
(
realsense_config_json
,
"enable_relocalization"
);
const
cJSON
*
pose_prediction
=
u_json_get
(
realsense_config_json
,
"enable_pose_prediction"
);
const
cJSON
*
pose_filtering
=
u_json_get
(
realsense_config_json
,
"enable_pose_filtering"
);
// if json key isn't in the json, default to true. if it is in there, use json value
if
(
mapping
!=
NULL
)
{
rs
->
enable_mapping
=
cJSON_IsTrue
(
mapping
);
}
if
(
pose_jumping
!=
NULL
)
{
rs
->
enable_pose_jumping
=
cJSON_IsTrue
(
pose_jumping
);
}
if
(
relocalization
!=
NULL
)
{
rs
->
enable_relocalization
=
cJSON_IsTrue
(
relocalization
);
}
if
(
pose_prediction
!=
NULL
)
{
rs
->
enable_pose_prediction
=
cJSON_IsTrue
(
pose_prediction
);
}
if
(
pose_filtering
!=
NULL
)
{
rs
->
enable_pose_filtering
=
cJSON_IsTrue
(
pose_filtering
);
}
}
U_LOG_D
(
"Used config file"
);
U_LOG_D
(
"Used config file"
);
}
else
{
}
else
{
U_LOG_D
(
"Did not use config file"
);
U_LOG_D
(
"Did not use config file"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment