Skip to content
This repository was archived by the owner on Feb 21, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions src/interfaces/slice/jderobot/visualization.ice
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <jderobot/common.ice>
#include <jderobot/primitives.ice>

#include <jderobot/pose3d.ice>

module jderobot{

Expand All @@ -31,38 +31,51 @@ module jderobot{
float g;
float b;
};

struct RGBSegment{
Segment seg;
Color c;
};

sequence<RGBSegment> Segments;
sequence<RGBPoint> Points;
sequence<byte> File;

struct bufferSegments{
Segments buffer;
bool refresh;
};

struct bufferPoints{
Points buffer;
bool refresh;
};

struct object3d {
string obj;
string id;
string format;
};

struct PoseObj3D{
string id;
Pose3DData pos;
};

sequence<PoseObj3D> bufferPoseObj3D;

/**
* Interface to the Visualization interaction.
*/
interface Visualization
{
void drawSegment(bufferSegments bseg);
bufferSegments getSegment ();
void drawPoint(bufferPoints bpoints);
bufferPoints getPoints();
bufferSegments getSegment ();
void drawPoint(bufferPoints bpnts);
bufferPoints getPoints();
object3d getObj3D(string id);
bufferPoseObj3D getPoseObj3DData();
void clearAll();
};




};
#endif
Binary file modified src/tools/3DVizWeb/.DS_Store
100644 → 100755
Binary file not shown.
Empty file modified src/tools/3DVizWeb/main.js
100644 → 100755
Empty file.
22 changes: 11 additions & 11 deletions src/tools/3DVizWeb/package-lock.json
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified src/tools/3DVizWeb/package.json
100644 → 100755
Empty file.
Binary file added src/tools/3DVizWeb/public/.DS_Store
Binary file not shown.
8 changes: 4 additions & 4 deletions src/tools/3DVizWeb/public/config.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Server: "localhost"
Port: "11000"
updatePoints: 1000 #miliseconds
updatePoints: 10000 #miliseconds
updateSegments: 1000 #miliseconds
linewidth: 2 #width of the line
pointsize: 8 #size of the point
camera: #camera position
x: 100
y: 50
z: 300
x: 50
y: 20
z: 100
Empty file modified src/tools/3DVizWeb/public/img/disc.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/tools/3DVizWeb/public/index.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
<meta charset="utf-8">
<script src = "js/three.js"></script>
<script src = "js/OrbitControls.js"></script>
<script src = "js/OBJLoader.js"></script>
<script src = "js/ColladaLoader.js"></script>
<script src = "js/GUI.js"></script>
<script src = "js/3DViz.js"></script>
<script src = "js/pose3d.js"></script>

<style>

body {
Expand All @@ -20,6 +24,7 @@
</style>
</head>
<body onload = "webGLStart()">
<div id="descarga"></div>
<div id="canvas" align = "center">
</div>
</body>
Expand Down
Binary file added src/tools/3DVizWeb/public/js/.DS_Store
Binary file not shown.
49 changes: 45 additions & 4 deletions src/tools/3DVizWeb/public/js/3DViz.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
let config = {};
var w;
var lineInterval, pointInterval;
var lineInterval, pointInterval, posInterval, objInterval;
var cont = 1;
class obj3DPose {
constructor(id,x,y,z,rx,ry,rz){
this.id = id;
this.x = x;
this.y = y;
this.z = z;
this.rx = rx;
this.ry = ry;
this.rz = rz;
}
}

try{
const yaml = require('js-yaml');
const fs = require('fs');
Expand Down Expand Up @@ -61,7 +74,8 @@ try{
},config.updatePoints);
lineInterval = setInterval(function(){
setLine();
},config.updateSegments);}
},config.updateSegments);
objInterval = setInterval(function(){setObj();},1000);}
}

function setLine(){
Expand All @@ -72,7 +86,18 @@ try{
function setPoint(){
w.postMessage({func:"setPoint"});
getData();
}
}
function setObj(){
id = "obj" + cont;
w.postMessage({func:"setObj", id: id});
getData();
}

function setPose3D(){
w.postMessage({func:"setPose3D"});
getData();
}

function getData (){
w.onmessage = function(event) {
if (event.data.func == "drawLine"){
Expand All @@ -91,6 +116,22 @@ try{
for (var i = 0; i < points.length; i+=1) {
addPoint(points[i]);
}
}
} else if (event.data.func == "drawObj") {
cont += 1
addObj(event.data.obj);
posInterval = setInterval(function(){
setPose3D();
}, 5000);

} else if (event.data.func == "pose3d") {
for (var i = 0; i < event.data.bpose3d.length; i += 1){
data = event.data.bpose3d[i];
console.log(data);
rotateZ=getYaw(data.pos.q0,data.pos.q1,data.pos.q2,data.pos.q3);
rotateY=getPitch(data.pos.q0,data.pos.q1,data.pos.q2,data.pos.q3);
rotateX=getRoll(data.pos.q0,data.pos.q1,data.pos.q2,data.pos.q3);
objpose3d = new obj3DPose(data.id,data.pos.x,data.pos.y,data.pos.z,rotateX,rotateY,rotateZ);
moveObj(objpose3d);}
}
}
}
21 changes: 21 additions & 0 deletions src/tools/3DVizWeb/public/js/3DViz_worker.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ importScripts('jderobot/datetime.js');
importScripts('jderobot/exceptions.js');
importScripts('jderobot/containers.js');
importScripts('jderobot/common.js');
importScripts('jderobot/pose3d.js');
importScripts('jderobot/image.js');
importScripts('jderobot/primitives.js');
importScripts('jderobot/visualization.js')
Expand Down Expand Up @@ -43,6 +44,19 @@ function setLine(){
});
}

function setObj(id){
srv.getObj3D(id).then(function(data){
console.log(data);
self.postMessage({func:"drawObj", obj: data});
})
}

function setPose3D(){
srv.getPoseObj3DData().then(function (data){
self.postMessage({func:"pose3d", bpose3d: data});
})
}

function clearAll(){
srv.clearAll().then(function(data){
console.log("Clear all");
Expand Down Expand Up @@ -77,5 +91,12 @@ onmessage = function(e) {
var point = []
setPoint(point);
break;
case "setObj":
id = e.data.id;
setObj(id);
break;
case "setPose3D":
setPose3D();
break;
}
}
Loading