diff --git a/js/cam/assemblers/FixedJoint.js b/js/cam/assemblers/FixedJoint.js new file mode 100644 index 0000000000000000000000000000000000000000..d986be6b7f2d0036d98f0f274eb71a4622339fc5 --- /dev/null +++ b/js/cam/assemblers/FixedJoint.js @@ -0,0 +1,3 @@ +/** + * Created by aghassaei on 8/25/15. + */ diff --git a/js/cam/assemblers/PrismaticJoint.js b/js/cam/assemblers/PrismaticJoint.js new file mode 100644 index 0000000000000000000000000000000000000000..d986be6b7f2d0036d98f0f274eb71a4622339fc5 --- /dev/null +++ b/js/cam/assemblers/PrismaticJoint.js @@ -0,0 +1,3 @@ +/** + * Created by aghassaei on 8/25/15. + */ diff --git a/js/cam/assemblers/RevoluteJoint.js b/js/cam/assemblers/RevoluteJoint.js new file mode 100644 index 0000000000000000000000000000000000000000..d986be6b7f2d0036d98f0f274eb71a4622339fc5 --- /dev/null +++ b/js/cam/assemblers/RevoluteJoint.js @@ -0,0 +1,3 @@ +/** + * Created by aghassaei on 8/25/15. + */ diff --git a/js/cam/assemblers/URDFJoint.js b/js/cam/assemblers/URDFJoint.js new file mode 100644 index 0000000000000000000000000000000000000000..8d48f67c7dad6ebc4f74ae321bc13cc963777d4b --- /dev/null +++ b/js/cam/assemblers/URDFJoint.js @@ -0,0 +1,93 @@ +/** + * Created by aghassaei on 8/25/15. + */ + + +define(['underscore', 'three'], function(_, THREE){ + + var num = 1; + + function Joint(json){ + + this.object3D = new THREE.Object3D(); + + this._name = json.name || "Joint " + num++; + this._type = json.type || "prismatic";//revolute, continuous, prismatic, fixed, floating, planar + + + + this.setParent(json.parent); + this._child = json.child; + + + + this._origin = json.origin || new THREE.Vector3(0,0,0);//also euler rotation + this._axis = json.axis || new THREE.Vector3(1,0,0); + + //this.limit + + } + + Joint.prototype.getName = function(){ + return this._name; + }; + + Joint.prototype.setName = function(name){ + this._name = name; + }; + + Joint.prototype.getType = function(){ + return this._type; + }; + + Joint.prototype.setType = function(type){ + this._type = type; + require([type.charAt(0).toUpperCase() + type.slice(1) + "Joint"], function(SubClass){ + //init subclass + }); + + }; + + Joint.prototype.getParent = function(){ + return this._parent; + }; + + Joint.prototype.setParent = function(parent){ + if (this._parent === parent) return; + if (this._checkDescendants(parent)) { + console.warn("parent is already a child"); + return; + } + + this._parent = parent; + }; + + Joint.prototype._checkDescendants = function(parent){ + if (this._child){ + if (this._child === parent) return true; + else return this._child._checkDescendants(parent); + } else return false; + }; + + Joint.prototype.getChild = function(){ + return this._child; + }; + + Joint.prototype.setChild = function(child){ + this._child = child; + }; + + Joint.prototype.getObject3D = function(){ + return this.object3D; + }; + + + + Joint.prototype.toJSON = function(){ + return { + + }; + }; + + return Joint; +}); \ No newline at end of file diff --git a/js/cam/assemblers/URDFLink.js b/js/cam/assemblers/URDFLink.js new file mode 100644 index 0000000000000000000000000000000000000000..2c1d418dbdb22fb3c14aae96b0396c1eaa9966d4 --- /dev/null +++ b/js/cam/assemblers/URDFLink.js @@ -0,0 +1,41 @@ +/** + * Created by aghassaei on 8/25/15. + */ + + +define(['underscore', 'three'], function(_, THREE){ + + var num = 1; + + function Link(json){ + + this._name = json.name || "Link " + num++; + this._origin = json.origin || new THREE.Vector3(0,0,0);//also euler rotation + this._axis = json.axis || new THREE.Vector3(1,0,0); + + this.object3D = new THREE.Object3D(); + + } + + Link.prototype.getName = function(){ + return this._name; + }; + + Link.prototype.setName = function(name){ + this._name = name; + }; + + Link.prototype.getObject3D = function(){ + return this.object3D; + }; + + + + Link.prototype.toJSON = function(){ + return { + + }; + }; + + return Link; +}); \ No newline at end of file diff --git a/js/main.js b/js/main.js index 6c55137ecd81f8a181337eadd274de937e83f2c5..b9210064c7645bfd1dd332a5b9e065b069650d35 100644 --- a/js/main.js +++ b/js/main.js @@ -193,6 +193,8 @@ require.config({ assemblerPost: 'cam/assemblers/AssemblerPost', component: 'cam/assemblers/Component', stockComponent: 'cam/assemblers/StockComponent', + urdfJoint: 'cam/assemblers/URDFJoint', + urdfLink: 'cam/assemblers/URDfLink', //processes gcode: 'cam/processes/GCodeExporter', diff --git a/js/plists/CamPList.js b/js/plists/CamPList.js index 6d9e5b6a46f84c7a145350432232566430fadaf8..b65812bc7b289b61b5cf119e2b57dcc80e5b2902 100644 --- a/js/plists/CamPList.js +++ b/js/plists/CamPList.js @@ -185,6 +185,15 @@ define(['three'], function(THREE){ } }, + allJointTypes: { + revolute: "Revolute", + continuous: "Continuous", + prismatic: "Prismatic", + fixed: "Fixed", + floating: "Floating", + planar: "Planar" + }, + allAssemblyStrategies: { raster: "Raster" }, diff --git a/js/plists/PList.js b/js/plists/PList.js index 58d70c30d1c204123f418a18e10d5bc54895c851..6defac6a21e611f3e2bdac4c7924a8564ee9f15c 100644 --- a/js/plists/PList.js +++ b/js/plists/PList.js @@ -67,7 +67,7 @@ define(['three'], function(THREE){ tabs:{ assembler:"Assembler", assemblerSetup: "Setup", - cam: "Process", + cam: "Globals", // editCamOutput: "Edit", animate:"Preview" },