aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/showreproject/showreproject.cc4
-rw-r--r--tools/viz/survive_viewer.js11
2 files changed, 11 insertions, 4 deletions
diff --git a/tools/showreproject/showreproject.cc b/tools/showreproject/showreproject.cc
index 8cde992..98dd5f0 100644
--- a/tools/showreproject/showreproject.cc
+++ b/tools/showreproject/showreproject.cc
@@ -134,7 +134,7 @@ void light_process(SurviveObject *so, int sensor_id, int acode, int timeinsweep,
SurvivePose lastPose = {};
-void raw_pose_process(SurviveObject *so, uint8_t lighthouse, SurvivePose *pose) {
+void raw_pose_process(SurviveObject *so, uint32_t lighthouse, SurvivePose *pose) {
survive_default_raw_pose_process(so, lighthouse, pose);
auto d = dist3d(lastPose.Pos, pose->Pos);
// std::cerr << d << std::endl;
@@ -151,7 +151,7 @@ void lighthouse_process(SurviveContext *ctx, uint8_t lighthouse, SurvivePose *po
SurviveContext *create(int argc, char **argv) {
auto ctx = survive_init(argc, argv);
- survive_install_raw_pose_fn(ctx, raw_pose_process);
+ survive_install_pose_fn(ctx, raw_pose_process);
survive_install_lighthouse_pose_fn(ctx, lighthouse_process);
survive_install_light_fn(ctx, light_process);
diff --git a/tools/viz/survive_viewer.js b/tools/viz/survive_viewer.js
index c8a7b23..c1d613d 100644
--- a/tools/viz/survive_viewer.js
+++ b/tools/viz/survive_viewer.js
@@ -7,6 +7,7 @@ var canvas;
var oldDrawTime = 0;
var timecode = {};
var oldPoseTime = 0, poseCnt = 0;
+var oldPose = [0, 0, 0];
var scene, camera, renderer, floor;
$(function() { $("#toggleBtn").click(function() { $("#cam").toggle(); }); });
@@ -242,14 +243,20 @@ var survive_log_handlers = {
objs[obj.tracker].quaternion.set(obj.quat[1], obj.quat[2], obj.quat[3], obj.quat[0]);
objs[obj.tracker].verticesNeedUpdate = true;
- if (trails) {
+ var d = 0;
+ for(var i = 0; i < 3;i++) {
+ d += Math.pow(obj.position[i] - oldPose[i], 2.);
+ }
+ if (trails && Math.sqrt( d ) > .01) {
trails.geometry.vertices.push(trails.geometry.vertices.shift()); // shift the array
trails.geometry.vertices[MAX_LINE_POINTS - 1] =
new THREE.Vector3(obj.position[0], obj.position[1], obj.position[2]);
trails.geometry.verticesNeedUpdate = true;
+ oldPose = obj.position;
}
- }
+
+ }
},
"CONFIG" : function(v, tracker) {
var configStr = v.slice(3).join(' ');