Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Monado
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Monado
Monado
Commits
8269eaa2
Commit
8269eaa2
authored
Aug 18, 2020
by
Jakob Bornecrantz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
2c4fa013
Pipeline
#191259
passed with stages
in 1 minute and 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
2 deletions
+88
-2
src/xrt/drivers/realsense/rs_6dof.c
src/xrt/drivers/realsense/rs_6dof.c
+88
-2
No files found.
src/xrt/drivers/realsense/rs_6dof.c
View file @
8269eaa2
...
...
@@ -12,6 +12,8 @@
#include "xrt/xrt_defines.h"
#include "xrt/xrt_device.h"
#include "math/m_predict.h"
#include "os/os_time.h"
#include "os/os_threading.h"
...
...
@@ -58,6 +60,12 @@ rs_6dof(struct xrt_device *xdev)
return
(
struct
rs_6dof
*
)
xdev
;
}
static
uint32_t
ns_to_ms
(
uint64_t
val
)
{
return
(
uint32_t
)(
val
/
1000000
);
}
/*!
* Simple helper to check and print error messages.
*/
...
...
@@ -326,8 +334,33 @@ rs_6dof_get_tracked_pose(struct xrt_device *xdev,
uint64_t
relation_timestamp_ns
=
rs
->
relation_timestamp_ns
;
os_thread_helper_unlock
(
&
rs
->
oth
);
*
out_relation_timestamp_ns
=
relation_timestamp_ns
;
*
out_relation
=
relation
;
int64_t
diff_prediction_ns
=
0
;
diff_prediction_ns
=
at_timestamp_ns
-
relation_timestamp_ns
;
#if 1
if
(
diff_prediction_ns
<
0
)
{
fprintf
(
stderr
,
"
\t
Before the timestamp %ums
\n
"
,
ns_to_ms
(
-
diff_prediction_ns
));
}
#else
(
void
)
ns_to_ms
;
#endif
if
(
diff_prediction_ns
>
0
)
{
double
delta_s
=
time_ns_to_s
(
diff_prediction_ns
);
#if 1
fprintf
(
stderr
,
"
\t
Predicting %fs %ums (%"
PRIu64
"ns)
\n
"
,
delta_s
,
ns_to_ms
(
diff_prediction_ns
),
diff_prediction_ns
);
#endif
m_predict_relation
(
&
relation
,
delta_s
,
out_relation
);
}
else
{
*
out_relation
=
relation
;
}
*
out_relation_timestamp_ns
=
at_timestamp_ns
;
}
static
void
...
...
@@ -339,6 +372,59 @@ rs_6dof_get_view_pose(struct xrt_device *xdev,
assert
(
false
);
}
#if 0
fprintf(stderr, "Predict-a-tron\n");
if (now_ns < relation_timestamp_ns) {
fprintf(stderr, "\tRelation from the future?!\n");
}
int64_t diff_now_ns = 0;
diff_now_ns = at_timestamp_ns - now_ns;
diff_prediction_ns = at_timestamp_ns - relation_timestamp_ns;
if (diff_now_ns < 0) {
fprintf(stderr, "\tIn the past %ums\n", ns_to_ms(-diff_now_ns));
}
if (diff_prediction_ns < 0) {
fprintf(stderr, "\tBefore the timestamp %ums\n",
ns_to_ms(-diff_prediction_ns));
}
if (diff_prediction_ns > 0) {
fprintf(stderr, "\tPredicting %ums (%" PRIu64 "ns)\n",
ns_to_ms(diff_prediction_ns), diff_prediction_ns);
}
/*
if (at_timestamp_ns < now_ns) {
uint64_t diff_ns = now_ns - at_timestamp_ns;
uint64_t diff_ms = diff_ns / (1000 * 1000);
if (at_timestamp_ns < relation_timestamp_ns) {
fprintf(stderr,
"No predict, in the past, after relation "
"timestamp! %ums (%" PRIu64 "ns)\n",
(uint32_t)diff_ms, diff_ns);
} else {
fprintf(stderr,
"Predict, in the past %ums (%" PRIu64 "ns)\n",
(uint32_t)diff_ms, diff_ns);
}
} else {
uint64_t diff_now_ns = now_ns - relation_timestamp_ns;
uint64_t diff_pred_ns = at_timestamp_ns - relation_timestamp_ns;
uint64_t diff_pred_ms = diff_pred_ns / (1000 * 1000);
fprintf(stderr,
"Predict %ums (%" PRIu64 "ns) (from now %" PRIu64 ")\n",
(uint32_t)diff_pred_ms, diff_pred_ns, diff_now_ns);
}
*/
#endif
static
void
rs_6dof_destroy
(
struct
xrt_device
*
xdev
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment