@operato/scene-urdf 8.0.0-beta.2 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import URDFViewerElement from './urdf-viewer-element';
1
+ import URDFViewerElement from './urdf-viewer-element.js';
2
2
  export declare function registerDragEvents(viewer: URDFViewerElement, callback: () => void): void;
@@ -1 +1 @@
1
- {"version":3,"file":"drag-n-drop.js","sourceRoot":"","sources":["../../src/elements/drag-n-drop.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAI3E,uEAAuE;AACvE,SAAS,mBAAmB,CAAC,YAA0B;IACrD,IAAI,CAAC,CAAC,YAAY,YAAY,YAAY,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,KAAK,GAAG,EAAS,CAAA;IAEvB,mDAAmD;IACnD,mDAAmD;IACnD,SAAS;IACT,SAAS,gBAAgB,CAAC,IAAS;QACjC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE;oBACtB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;oBAC3B,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;YAElC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC3B,MAAM,QAAQ,GAAG,EAAS,CAAA;gBAE1B,8CAA8C;gBAC9C,SAAS,eAAe;oBACtB,MAAM,CAAC,WAAW,CAAC,CAAC,EAAO,EAAE,EAAE;wBAC7B,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,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EAAE,CAAC;oBAC3B,sCAAsC;oBACtC,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;oBACpD,qBAAqB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAA;oBAEzD,OAAO,OAAO,CAAA;gBAChB,CAAC;gBAED,OAAO,GAAG,CAAA;YACZ,CAAC,CAAA;YAED,0EAA0E;YAC1E,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACrC,MAAM,CAAC,EAAE,GAAG,IAAI,CACf;YAAC,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAU,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,CAAA;YAEjE,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAG,CAAA;QACjE,CAAC,CAAC,CAAA;QAEF,QAAQ,EAAE,CAAA;IACZ,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["// Converts a datatransfer structer into an object with all paths and files\n\nimport URDFViewerElement from './urdf-viewer-element'\n\n// listed out. Returns a promise that resolves with the file structure.\nfunction dataTransferToFiles(dataTransfer: DataTransfer) {\n if (!(dataTransfer instanceof DataTransfer)) {\n throw new Error('Data must be of type \"DataTransfer\"')\n }\n\n const files = {} as any\n\n // recurse down the webkit file structure resolving\n // the paths to files names to store in the `files`\n // object\n function recurseDirectory(item: any): Promise<void> {\n if (item.isFile) {\n return new Promise(resolve => {\n item.file((file: any) => {\n files[item.fullPath] = file\n resolve()\n })\n })\n } else {\n const reader = item.createReader()\n\n return new Promise(resolve => {\n const promises = [] as any\n\n // exhaustively read all the directory entries\n function readNextEntries() {\n reader.readEntries((et: any) => {\n if (et.length === 0) {\n Promise.all(promises).then(() => resolve())\n } else {\n et.forEach((e: any) => {\n promises.push(recurseDirectory(e))\n })\n readNextEntries()\n }\n })\n }\n\n readNextEntries()\n })\n }\n }\n\n return new Promise(resolve => {\n // Traverse down the tree and add the files into the zip\n // const dtitems = dataTransfer.items && [...dataTransfer.items]\n // const dtfiles = [...dataTransfer.files]\n var dtitems = [] as DataTransferItem[]\n if (dataTransfer.items) {\n for (let i = 0; i < dataTransfer.items.length; i++) {\n dtitems.push(dataTransfer.items[i])\n }\n }\n\n var dtfiles = [] as File[]\n if (dataTransfer.files) {\n for (let i = 0; i < dataTransfer.files.length; i++) {\n dtfiles.push(dataTransfer.files[i])\n }\n }\n\n if (dtitems.length && (dtitems[0].webkitGetAsEntry as any)) {\n const promises = []\n for (let i = 0; i < dtitems.length; i++) {\n const item = dtitems[i]\n const entry = item.webkitGetAsEntry()\n\n promises.push(recurseDirectory(entry))\n }\n Promise.all(promises).then(() => resolve(files))\n } else {\n // add a '/' prefix to math the file directory entry\n // on webkit browsers\n dtfiles.filter(f => f.size !== 0).forEach(f => (files['/' + f.name] = f))\n\n resolve(files)\n }\n })\n}\n\nexport function registerDragEvents(viewer: URDFViewerElement, callback: () => void) {\n document.addEventListener('dragover', e => e.preventDefault())\n document.addEventListener('dragenter', e => e.preventDefault())\n document.addEventListener('drop', e => {\n e.preventDefault()\n\n // convert the files\n dataTransferToFiles(e.dataTransfer!).then((files: any) => {\n // removes '..' and '.' tokens and normalizes slashes\n const cleanFilePath = (path: string) => {\n return path\n .replace(/\\\\/g, '/')\n .split(/\\//g)\n .reduce((acc, el) => {\n if (el === '..') acc.pop()\n else if (el !== '.') acc.push(el)\n return acc\n }, [] as string[])\n .join('/')\n }\n\n // set the loader url modifier to check the list\n // of files\n const fileNames = Object.keys(files).map(n => cleanFilePath(n))\n viewer.urlModifierFunc = (url: string) => {\n // find the matching file given the requested url\n const cleaned = cleanFilePath(url.replace(viewer.package, ''))\n const fileName = fileNames\n .filter(name => {\n // check if the end of file and url are the same\n const len = Math.min(name.length, cleaned.length)\n return cleaned.substr(cleaned.length - len) === name.substr(name.length - len)\n })\n .pop()\n\n if (fileName !== undefined) {\n // revoke the url after it's been used\n const bloburl = URL.createObjectURL(files[fileName])\n requestAnimationFrame(() => URL.revokeObjectURL(bloburl))\n\n return bloburl\n }\n\n return url\n }\n\n // set the source of the element to the most likely intended display model\n const filesNames = Object.keys(files)\n viewer.up = '+Z'\n ;(document.getElementById('up-select') as any)!.value = viewer.up\n\n viewer.urdf = filesNames.filter(n => /urdf$/i.test(n)).shift()!\n })\n\n callback()\n })\n}\n"]}
1
+ {"version":3,"file":"drag-n-drop.js","sourceRoot":"","sources":["../../src/elements/drag-n-drop.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAI3E,uEAAuE;AACvE,SAAS,mBAAmB,CAAC,YAA0B;IACrD,IAAI,CAAC,CAAC,YAAY,YAAY,YAAY,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,KAAK,GAAG,EAAS,CAAA;IAEvB,mDAAmD;IACnD,mDAAmD;IACnD,SAAS;IACT,SAAS,gBAAgB,CAAC,IAAS;QACjC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE;oBACtB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;oBAC3B,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;YAElC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC3B,MAAM,QAAQ,GAAG,EAAS,CAAA;gBAE1B,8CAA8C;gBAC9C,SAAS,eAAe;oBACtB,MAAM,CAAC,WAAW,C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AAA;gBAChF,CAAC,CAAC;qBACD,GAAG,EAAE,CAAA;gBAER,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;oBAC3B,sCAAsC;oBACtC,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;oBACpD,qBAAqB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAA;oBAEzD,OAAO,OAAO,CAAA;gBAChB,CAAC;gBAED,OAAO,GAAG,CAAA;YACZ,CAAC,CAAA;YAED,0EAA0E;YAC1E,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACrC,MAAM,CAAC,EAAE,GAAG,IAAI,CACf;YAAC,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAU,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,CAAA;YAEjE,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAG,CAAA;QACjE,CAAC,CAAC,CAAA;QAEF,QAAQ,EAAE,CAAA;IACZ,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["// Converts a datatransfer structer into an object with all paths and files\n\nimport URDFViewerElement from './urdf-viewer-element.js'\n\n// listed out. Returns a promise that resolves with the file structure.\nfunction dataTransferToFiles(dataTransfer: DataTransfer) {\n if (!(dataTransfer instanceof DataTransfer)) {\n throw new Error('Data must be of type \"DataTransfer\"')\n }\n\n const files = {} as any\n\n // recurse down the webkit file structure resolving\n // the paths to files names to store in the `files`\n // object\n function recurseDirectory(item: any): Promise<void> {\n if (item.isFile) {\n return new Promise(resolve => {\n item.file((file: any) => {\n files[item.fullPath] = file\n resolve()\n })\n })\n } else {\n const reader = item.createReader()\n\n return new Promise(resolve => {\n const promises = [] as any\n\n // exhaustively read all the directory entries\n function readNextEntries() {\n reader.readEntries((et: any) => {\n if (et.length === 0) {\n Promise.all(promises).then(() => resolve())\n } else {\n et.forEach((e: any) => {\n promises.push(recurseDirectory(e))\n })\n readNextEntries()\n }\n })\n }\n\n readNextEntries()\n })\n }\n }\n\n return new Promise(resolve => {\n // Traverse down the tree and add the files into the zip\n // const dtitems = dataTransfer.items && [...dataTransfer.items]\n // const dtfiles = [...dataTransfer.files]\n var dtitems = [] as DataTransferItem[]\n if (dataTransfer.items) {\n for (let i = 0; i < dataTransfer.items.length; i++) {\n dtitems.push(dataTransfer.items[i])\n }\n }\n\n var dtfiles = [] as File[]\n if (dataTransfer.files) {\n for (let i = 0; i < dataTransfer.files.length; i++) {\n dtfiles.push(dataTransfer.files[i])\n }\n }\n\n if (dtitems.length && (dtitems[0].webkitGetAsEntry as any)) {\n const promises = []\n for (let i = 0; i < dtitems.length; i++) {\n const item = dtitems[i]\n const entry = item.webkitGetAsEntry()\n\n promises.push(recurseDirectory(entry))\n }\n Promise.all(promises).then(() => resolve(files))\n } else {\n // add a '/' prefix to math the file directory entry\n // on webkit browsers\n dtfiles.filter(f => f.size !== 0).forEach(f => (files['/' + f.name] = f))\n\n resolve(files)\n }\n })\n}\n\nexport function registerDragEvents(viewer: URDFViewerElement, callback: () => void) {\n document.addEventListener('dragover', e => e.preventDefault())\n document.addEventListener('dragenter', e => e.preventDefault())\n document.addEventListener('drop', e => {\n e.preventDefault()\n\n // convert the files\n dataTransferToFiles(e.dataTransfer!).then((files: any) => {\n // removes '..' and '.' tokens and normalizes slashes\n const cleanFilePath = (path: string) => {\n return path\n .replace(/\\\\/g, '/')\n .split(/\\//g)\n .reduce((acc, el) => {\n if (el === '..') acc.pop()\n else if (el !== '.') acc.push(el)\n return acc\n }, [] as string[])\n .join('/')\n }\n\n // set the loader url modifier to check the list\n // of files\n const fileNames = Object.keys(files).map(n => cleanFilePath(n))\n viewer.urlModifierFunc = (url: string) => {\n // find the matching file given the requested url\n const cleaned = cleanFilePath(url.replace(viewer.package, ''))\n const fileName = fileNames\n .filter(name => {\n // check if the end of file and url are the same\n const len = Math.min(name.length, cleaned.length)\n return cleaned.substr(cleaned.length - len) === name.substr(name.length - len)\n })\n .pop()\n\n if (fileName !== undefined) {\n // revoke the url after it's been used\n const bloburl = URL.createObjectURL(files[fileName])\n requestAnimationFrame(() => URL.revokeObjectURL(bloburl))\n\n return bloburl\n }\n\n return url\n }\n\n // set the source of the element to the most likely intended display model\n const filesNames = Object.keys(files)\n viewer.up = '+Z'\n ;(document.getElementById('up-select') as any)!.value = viewer.up\n\n viewer.urdf = filesNames.filter(n => /urdf$/i.test(n)).shift()!\n })\n\n callback()\n })\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { LitElement, PropertyValues } from 'lit';
2
2
  import { URDFRobot } from 'urdf-loader';
3
- import URDFManipulatorElement from './urdf-manipulator-element';
3
+ import URDFManipulatorElement from './urdf-manipulator-element.js';
4
4
  export default class URDFControllerElement extends LitElement {
5
5
  static styles: import("lit").CSSResult[];
6
6
  viewer?: URDFManipulatorElement;
@@ -2,7 +2,7 @@ import { __decorate } from "tslib";
2
2
  import { LitElement, css, html } from 'lit';
3
3
  import { customElement, property } from 'lit/decorators.js';
4
4
  import * as THREE from 'three';
5
- import { registerDragEvents } from './drag-n-drop';
5
+ import { registerDragEvents } from './drag-n-drop.js';
6
6
  import { ScrollbarStyles } from '@operato/styles';
7
7
  const DEG2RAD = Math.PI / 180;
8
8
  const RAD2DEG = 1 / DEG2RAD;
@@ -1 +1 @@
1
- {"version":3,"file":"urdf-controller-element.js","sourceRoot":"","sources":["../../src/elements/urdf-controller-element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,kBAAk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1B,qBAAqB;IADzC,aAAa,CAAC,iBAAiB,CAAC;GACZ,qBAAqB,CA4RzC;eA5RoB,qBAAqB","sourcesContent":["import { LitElement, css, html, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as THREE from 'three'\nimport { registerDragEvents } from './drag-n-drop'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { URDFRobot } from 'urdf-loader'\nimport URDFManipulatorElement from './urdf-manipulator-element'\n\nconst DEG2RAD = Math.PI / 180\nconst RAD2DEG = 1 / DEG2RAD\n\n@customElement('urdf-controller')\nexport default class URDFControllerElement extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin: 15px 0;\n overflow: hidden;\n user-select: none;\n }\n\n :host > * {\n margin: 5px 0;\n }\n\n input[type='number'] {\n color: white;\n border: none;\n font-weight: 300;\n background: rgba(255, 255, 255, 0.25);\n padding: 1px 2px;\n }\n\n ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n input[type='range'] {\n -webkit-appearance: none;\n border: none;\n outline: none;\n width: 100%;\n flex: 1;\n height: 16px;\n background-color: transparent;\n }\n input[type='range']::-webkit-slider-runnable-track {\n width: 100%;\n height: 1px;\n background: white;\n border: none;\n border-radius: 5px;\n }\n input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: white;\n margin-top: -5px;\n }\n input[type='range']:focus {\n outline: none;\n }\n input[type='range']:focus::-webkit-slider-runnable-track {\n background: white;\n }\n\n input[type='range']::-moz-range-track {\n width: 100%;\n height: 1px;\n background: white;\n border: none;\n border-radius: 5px;\n }\n input[type='range']::-moz-range-thumb {\n border: none;\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: white;\n }\n\n input[type='range']:-moz-focusring {\n outline: 1px solid white;\n outline-offset: -1px;\n }\n\n input[type='range']::-ms-track {\n width: 100%;\n height: 1px;\n background: white;\n border-radius: 10px;\n color: transparent;\n border: none;\n outline: none;\n }\n input[type='range']::-ms-thumb {\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: white;\n border: none;\n outline: none;\n margin-top: 2px;\n }\n\n input:focus {\n outline: none;\n opacity: 1;\n }\n\n /* list of joint sliders */\n ul {\n flex: 1;\n overflow-y: auto;\n }\n\n li {\n font-size: 16px;\n display: flex;\n align-items: center;\n padding: 1px 0;\n\n width: 100%;\n user-select: text;\n\n transition: background 0.25s ease;\n }\n\n li[robot-hovered] {\n background: rgba(255, 255, 255, 0.35);\n }\n\n li:hover {\n background: rgba(255, 255, 255, 0.35);\n }\n\n li span {\n padding: 0 5px;\n max-width: 125px;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n li input[type='number'] {\n width: 50px;\n overflow: hidden;\n }\n `\n ]\n\n @property({ type: Object }) viewer?: URDFManipulatorElement\n @property({ type: Object }) robot?: URDFRobot\n\n render() {\n const { joints = {} } = this.robot || {}\n const { ignoreLimits = false } = this.viewer || {}\n const jointsArray = Object.values(joints)\n\n return html`\n <ul>\n ${jointsArray.map(joint => {\n var { jointType, name, angle, limit } = joint\n var degVal: number | string = Number(angle || 0)\n\n if (jointType === 'revolute' || jointType === 'continuous') {\n degVal *= RAD2DEG\n }\n\n if (Math.abs(degVal) > 1) {\n degVal = degVal.toFixed(1)\n } else {\n degVal = degVal.toPrecision(2)\n }\n\n var sliderMin\n var sliderMax\n var inputMin\n var inputMax\n\n if (ignoreLimits || jointType === 'continuous') {\n sliderMin = -6.28\n sliderMax = 6.28\n\n inputMin = -6.28 * RAD2DEG\n inputMax = 6.28 * RAD2DEG\n } else {\n sliderMin = limit.lower\n sliderMax = limit.upper\n\n inputMin = Number(limit.lower) * RAD2DEG\n inputMax = Number(limit.upper) * RAD2DEG\n }\n\n return html`\n <li joint-type=${jointType} joint-name=${name}>\n <span title=${name}>${name}</span>\n <input\n type=\"range\"\n .value=${String(angle)}\n step=\"0.0001\"\n min=${sliderMin}\n max=${sliderMax}\n @input=${(e: Event) => {\n this.viewer?.setJointValue(name, (e.target as any).value)\n }}\n />\n <input\n type=\"number\"\n .value=${degVal}\n step=\"0.0001\"\n min=${inputMin}\n max=${inputMax}\n @change=${(e: Event) => {\n this.viewer?.setJointValue(name, Number((e.target as HTMLInputElement).value) * DEG2RAD)\n }}\n />\n </li>\n `\n })}\n </ul>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('viewer')) {\n this._setupViewer(this.viewer)\n }\n }\n\n _setupViewer(viewer?: URDFManipulatorElement) {\n if (!viewer) {\n return\n }\n\n this.robot = viewer.robot\n\n viewer.addEventListener('urdf-processed', () => {\n this.robot = viewer.robot\n })\n\n viewer.addEventListener('ignore-limits-change', () => {\n this.requestUpdate()\n })\n\n viewer.addEventListener('angle-change', (e: Event) => {\n this.requestUpdate()\n })\n\n viewer.addEventListener('joint-mouseover', (e: Event) => {\n const j = this.renderRoot.querySelector(`li[joint-name=\"${(e as CustomEvent).detail}\"]`)\n if (j) {\n j.setAttribute('robot-hovered', 'true')\n }\n })\n\n viewer.addEventListener('joint-mouseout', (e: Event) => {\n const j = this.renderRoot.querySelector(`li[joint-name=\"${(e as CustomEvent).detail}\"]`)\n if (j) {\n j.removeAttribute('robot-hovered')\n }\n })\n\n let originalNoAutoRecenter: boolean\n viewer.addEventListener('manipulate-start', (e: Event) => {\n const j = this.renderRoot.querySelector(`li[joint-name=\"${(e as CustomEvent).detail}\"]`)\n if (j) {\n // ??\n j.scrollIntoView({ block: 'nearest' })\n window.scrollTo(0, 0)\n }\n\n originalNoAutoRecenter = viewer.noAutoRecenter\n viewer.noAutoRecenter = true\n })\n\n viewer.addEventListener('manipulate-end', (e: Event) => {\n viewer.noAutoRecenter = originalNoAutoRecenter\n })\n\n registerDragEvents(viewer, () => {\n this.setColor('#263238')\n })\n }\n\n setColor(color: string) {\n this.viewer!.highlightColor = '#' + new THREE.Color(0xffffff).lerp(new THREE.Color(color), 0.35).getHexString()\n }\n}\n"]}
1
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6IF;CACF,AAhJY,CAgJZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAkB;AApJ1B,qBAAqB;IADzC,aAAa,CAAC,iBAAiB,CAAC;GACZ,qBAAqB,CA4RzC;eA5RoB,qBAAqB","sourcesContent":["import { LitElement, css, html, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as THREE from 'three'\nimport { registerDragEvents } from './drag-n-drop.js'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { URDFRobot } from 'urdf-loader'\nimport URDFManipulatorElement from './urdf-manipulator-element.js'\n\nconst DEG2RAD = Math.PI / 180\nconst RAD2DEG = 1 / DEG2RAD\n\n@customElement('urdf-controller')\nexport default class URDFControllerElement extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin: 15px 0;\n overflow: hidden;\n user-select: none;\n }\n\n :host > * {\n margin: 5px 0;\n }\n\n input[type='number'] {\n color: white;\n border: none;\n font-weight: 300;\n background: rgba(255, 255, 255, 0.25);\n padding: 1px 2px;\n }\n\n ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n input[type='range'] {\n -webkit-appearance: none;\n border: none;\n outline: none;\n width: 100%;\n flex: 1;\n height: 16px;\n background-color: transparent;\n }\n input[type='range']::-webkit-slider-runnable-track {\n width: 100%;\n height: 1px;\n background: white;\n border: none;\n border-radius: 5px;\n }\n input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: white;\n margin-top: -5px;\n }\n input[type='range']:focus {\n outline: none;\n }\n input[type='range']:focus::-webkit-slider-runnable-track {\n background: white;\n }\n\n input[type='range']::-moz-range-track {\n width: 100%;\n height: 1px;\n background: white;\n border: none;\n border-radius: 5px;\n }\n input[type='range']::-moz-range-thumb {\n border: none;\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: white;\n }\n\n input[type='range']:-moz-focusring {\n outline: 1px solid white;\n outline-offset: -1px;\n }\n\n input[type='range']::-ms-track {\n width: 100%;\n height: 1px;\n background: white;\n border-radius: 10px;\n color: transparent;\n border: none;\n outline: none;\n }\n input[type='range']::-ms-thumb {\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: white;\n border: none;\n outline: none;\n margin-top: 2px;\n }\n\n input:focus {\n outline: none;\n opacity: 1;\n }\n\n /* list of joint sliders */\n ul {\n flex: 1;\n overflow-y: auto;\n }\n\n li {\n font-size: 16px;\n display: flex;\n align-items: center;\n padding: 1px 0;\n\n width: 100%;\n user-select: text;\n\n transition: background 0.25s ease;\n }\n\n li[robot-hovered] {\n background: rgba(255, 255, 255, 0.35);\n }\n\n li:hover {\n background: rgba(255, 255, 255, 0.35);\n }\n\n li span {\n padding: 0 5px;\n max-width: 125px;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n li input[type='number'] {\n width: 50px;\n overflow: hidden;\n }\n `\n ]\n\n @property({ type: Object }) viewer?: URDFManipulatorElement\n @property({ type: Object }) robot?: URDFRobot\n\n render() {\n const { joints = {} } = this.robot || {}\n const { ignoreLimits = false } = this.viewer || {}\n const jointsArray = Object.values(joints)\n\n return html`\n <ul>\n ${jointsArray.map(joint => {\n var { jointType, name, angle, limit } = joint\n var degVal: number | string = Number(angle || 0)\n\n if (jointType === 'revolute' || jointType === 'continuous') {\n degVal *= RAD2DEG\n }\n\n if (Math.abs(degVal) > 1) {\n degVal = degVal.toFixed(1)\n } else {\n degVal = degVal.toPrecision(2)\n }\n\n var sliderMin\n var sliderMax\n var inputMin\n var inputMax\n\n if (ignoreLimits || jointType === 'continuous') {\n sliderMin = -6.28\n sliderMax = 6.28\n\n inputMin = -6.28 * RAD2DEG\n inputMax = 6.28 * RAD2DEG\n } else {\n sliderMin = limit.lower\n sliderMax = limit.upper\n\n inputMin = Number(limit.lower) * RAD2DEG\n inputMax = Number(limit.upper) * RAD2DEG\n }\n\n return html`\n <li joint-type=${jointType} joint-name=${name}>\n <span title=${name}>${name}</span>\n <input\n type=\"range\"\n .value=${String(angle)}\n step=\"0.0001\"\n min=${sliderMin}\n max=${sliderMax}\n @input=${(e: Event) => {\n this.viewer?.setJointValue(name, (e.target as any).value)\n }}\n />\n <input\n type=\"number\"\n .value=${degVal}\n step=\"0.0001\"\n min=${inputMin}\n max=${inputMax}\n @change=${(e: Event) => {\n this.viewer?.setJointValue(name, Number((e.target as HTMLInputElement).value) * DEG2RAD)\n }}\n />\n </li>\n `\n })}\n </ul>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('viewer')) {\n this._setupViewer(this.viewer)\n }\n }\n\n _setupViewer(viewer?: URDFManipulatorElement) {\n if (!viewer) {\n return\n }\n\n this.robot = viewer.robot\n\n viewer.addEventListener('urdf-processed', () => {\n this.robot = viewer.robot\n })\n\n viewer.addEventListener('ignore-limits-change', () => {\n this.requestUpdate()\n })\n\n viewer.addEventListener('angle-change', (e: Event) => {\n this.requestUpdate()\n })\n\n viewer.addEventListener('joint-mouseover', (e: Event) => {\n const j = this.renderRoot.querySelector(`li[joint-name=\"${(e as CustomEvent).detail}\"]`)\n if (j) {\n j.setAttribute('robot-hovered', 'true')\n }\n })\n\n viewer.addEventListener('joint-mouseout', (e: Event) => {\n const j = this.renderRoot.querySelector(`li[joint-name=\"${(e as CustomEvent).detail}\"]`)\n if (j) {\n j.removeAttribute('robot-hovered')\n }\n })\n\n let originalNoAutoRecenter: boolean\n viewer.addEventListener('manipulate-start', (e: Event) => {\n const j = this.renderRoot.querySelector(`li[joint-name=\"${(e as CustomEvent).detail}\"]`)\n if (j) {\n // ??\n j.scrollIntoView({ block: 'nearest' })\n window.scrollTo(0, 0)\n }\n\n originalNoAutoRecenter = viewer.noAutoRecenter\n viewer.noAutoRecenter = true\n })\n\n viewer.addEventListener('manipulate-end', (e: Event) => {\n viewer.noAutoRecenter = originalNoAutoRecenter\n })\n\n registerDragEvents(viewer, () => {\n this.setColor('#263238')\n })\n }\n\n setColor(color: string) {\n this.viewer!.highlightColor = '#' + new THREE.Color(0xffffff).lerp(new THREE.Color(color), 0.35).getHexString()\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { PointerURDFDragControls } from './urdf-drag-controls';
1
+ import { PointerURDFDragControls } from './urdf-drag-controls.js';
2
2
  import { MeshPhongMaterial } from 'three';
3
- import URDFViewerElement from './urdf-viewer-element';
3
+ import URDFViewerElement from './urdf-viewer-element.js';
4
4
  export default class URDFManipulatorElement extends URDFViewerElement {
5
5
  static get observedAttributes(): string[];
6
6
  highlightMaterial: MeshPhongMaterial;
@@ -1,8 +1,8 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { customElement } from 'lit/decorators.js';
3
3
  import * as THREE from 'three';
4
- import { PointerURDFDragControls } from './urdf-drag-controls';
5
- import URDFViewerElement from './urdf-viewer-element';
4
+ import { PointerURDFDragControls } from './urdf-drag-controls.js';
5
+ import URDFViewerElement from './urdf-viewer-element.js';
6
6
  // urdf-manipulator element
7
7
  // Displays a URDF model that can be manipulated with the mouse
8
8
  // Events
@@ -1 +1 @@
1
- {"version":3,"file":"urdf-manipulator-element.js","sourceRoot":"","sources":["../../src/elements/urdf-manipulator-element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AAGrD,2BAA2B;AAC3B,+DAA+D;AAE/D,SAAS;AACT,sDAAsD;AACtD,+DAA+D;AAC/D,sDAA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,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAA;QAC5B,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAA;IAC7B,CAAC;IAED,wBAAwB,CAAC,IAAY,EAAE,MAAW,EAAE,MAAW;QAC7D,KAAK,CAAC,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAEpD,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,iBAAiB;gBACpB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;gBACrD,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;gBACxD,MAAK;QACT,CAAC;IACH,CAAC;CACF,CAAA;AAnHoB,sBAAsB;IAD1C,aAAa,CAAC,aAAa,CAAC;GACR,sBAAsB,CAmH1C;eAnHoB,sBAAsB","sourcesContent":["import { customElement } from 'lit/decorators.js'\nimport * as THREE from 'three'\nimport { PointerURDFDragControls } from './urdf-drag-controls'\nimport { Material, MeshPhongMaterial } from 'three'\nimport URDFViewerElement from './urdf-viewer-element'\nimport { URDFJoint } from 'urdf-loader'\n\n// urdf-manipulator element\n// Displays a URDF model that can be manipulated with the mouse\n\n// Events\n// joint-mouseover: Fired when a joint is hovered over\n// joint-mouseout: Fired when a joint is no longer hovered over\n// manipulate-start: Fires when a joint is manipulated\n// manipulate-end: Fires when a joint is done being manipulated\n\n@customElement('urdf-viewer')\nexport default class URDFManipulatorElement extends URDFViewerElement {\n static get observedAttributes() {\n return ['highlight-color', ...super.observedAttributes]\n }\n\n highlightMaterial: MeshPhongMaterial\n dragControls: PointerURDFDragControls\n\n get disableDragging() {\n return this.hasAttribute('disable-dragging')\n }\n\n set disableDragging(val) {\n val ? this.setAttribute('disable-dragging', String(!!val)) : this.removeAttribute('disable-dragging')\n }\n\n get highlightColor() {\n return this.getAttribute('highlight-color') || '#FFFFFF'\n }\n\n set highlightColor(val) {\n val ? this.setAttribute('highlight-color', val) : this.removeAttribute('highlight-color')\n }\n\n constructor() {\n super()\n\n // The highlight material\n this.highlightMaterial = new THREE.MeshPhongMaterial({\n shininess: 10,\n color: this.highlightColor,\n emissive: this.highlightColor,\n emissiveIntensity: 0.25\n })\n\n const isJoint = (j: URDFJoint) => {\n return j.isURDFJoint && j.jointType !== 'fixed'\n }\n\n // Highlight the link geometry under a joint\n const highlightLinkGeometry = (m: THREE.Material, revert: boolean) => {\n const traverse = (c: any) => {\n // Set or revert the highlight color\n if (c.type === 'Mesh') {\n if (revert) {\n c.material = c.__origMaterial\n delete c.__origMaterial\n } else {\n c.__origMaterial = c.material\n c.material = this.highlightMaterial\n }\n }\n\n // Look into the children and stop if the next child is\n // another joint\n if (c === m || !isJoint(c)) {\n for (let i = 0; i < c.children.length; i++) {\n traverse(c.children[i])\n }\n }\n }\n\n traverse(m)\n }\n\n const el = this.renderer.domElement\n\n const dragControls = new PointerURDFDragControls(this.scene, this.camera, el)\n\n dragControls.onDragStart = joint => {\n this.dispatchEvent(new CustomEvent('manipulate-start', { bubbles: true, cancelable: true, detail: joint.name }))\n this.controls.enabled = false\n this.redraw()\n }\n\n dragControls.onDragEnd = joint => {\n this.dispatchEvent(new CustomEvent('manipulate-end', { bubbles: true, cancelable: true, detail: joint.name }))\n this.controls.enabled = true\n this.redraw()\n }\n\n dragControls.updateJoint = (joint, angle) => {\n this.setJointValue(joint.name, angle)\n }\n\n dragControls.onHover = (joint: URDFJoint) => {\n highlightLinkGeometry(joint as any, false)\n this.dispatchEvent(new CustomEvent('joint-mouseover', { bubbles: true, cancelable: true, detail: joint.name }))\n this.redraw()\n }\n\n dragControls.onUnhover = joint => {\n highlightLinkGeometry(joint as any, true)\n this.dispatchEvent(new CustomEvent('joint-mouseout', { bubbles: true, cancelable: true, detail: joint.name }))\n this.redraw()\n }\n\n this.dragControls = dragControls\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.dragControls.dispose()\n }\n\n attributeChangedCallback(attr: string, oldval: any, newval: any) {\n super.attributeChangedCallback(attr, oldval, newval)\n\n switch (attr) {\n case 'highlight-color':\n this.highlightMaterial.color.set(this.highlightColor)\n this.highlightMaterial.emissive.set(this.highlightColor)\n break\n }\n }\n}\n"]}
1
+ {"version":3,"file":"urdf-manipulator-element.js","sourceRoot":"","sources":["../../src/elements/urdf-manipulator-element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,iBAAiB,MAAM,0BAA0B,CAAA;AAGxD,2BAA2B;AAC3B,+DAA+D;AAE/D,SAAS;AACT,sDAAsD;AACtD,+DAA+D;AAC/D,sDAAsD;AACtD,+DAA+D;AAGhD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,iBAAiB;IACnE,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,iBAAiB,EAAE,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACzD,CAAC;IAKD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAA;IAC9C,CAAC;IAED,IAAI,eAAe,CAAC,GAAG;QACrB,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAA;IACvG,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,SAAS,CAAA;IAC1D,CAAC;IAED,IAAI,cAAc,CAAC,GAAG;QACpB,GAAG,C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C;eAnHoB,sBAAsB","sourcesContent":["import { customElement } from 'lit/decorators.js'\nimport * as THREE from 'three'\nimport { PointerURDFDragControls } from './urdf-drag-controls.js'\nimport { Material, MeshPhongMaterial } from 'three'\nimport URDFViewerElement from './urdf-viewer-element.js'\nimport { URDFJoint } from 'urdf-loader'\n\n// urdf-manipulator element\n// Displays a URDF model that can be manipulated with the mouse\n\n// Events\n// joint-mouseover: Fired when a joint is hovered over\n// joint-mouseout: Fired when a joint is no longer hovered over\n// manipulate-start: Fires when a joint is manipulated\n// manipulate-end: Fires when a joint is done being manipulated\n\n@customElement('urdf-viewer')\nexport default class URDFManipulatorElement extends URDFViewerElement {\n static get observedAttributes() {\n return ['highlight-color', ...super.observedAttributes]\n }\n\n highlightMaterial: MeshPhongMaterial\n dragControls: PointerURDFDragControls\n\n get disableDragging() {\n return this.hasAttribute('disable-dragging')\n }\n\n set disableDragging(val) {\n val ? this.setAttribute('disable-dragging', String(!!val)) : this.removeAttribute('disable-dragging')\n }\n\n get highlightColor() {\n return this.getAttribute('highlight-color') || '#FFFFFF'\n }\n\n set highlightColor(val) {\n val ? this.setAttribute('highlight-color', val) : this.removeAttribute('highlight-color')\n }\n\n constructor() {\n super()\n\n // The highlight material\n this.highlightMaterial = new THREE.MeshPhongMaterial({\n shininess: 10,\n color: this.highlightColor,\n emissive: this.highlightColor,\n emissiveIntensity: 0.25\n })\n\n const isJoint = (j: URDFJoint) => {\n return j.isURDFJoint && j.jointType !== 'fixed'\n }\n\n // Highlight the link geometry under a joint\n const highlightLinkGeometry = (m: THREE.Material, revert: boolean) => {\n const traverse = (c: any) => {\n // Set or revert the highlight color\n if (c.type === 'Mesh') {\n if (revert) {\n c.material = c.__origMaterial\n delete c.__origMaterial\n } else {\n c.__origMaterial = c.material\n c.material = this.highlightMaterial\n }\n }\n\n // Look into the children and stop if the next child is\n // another joint\n if (c === m || !isJoint(c)) {\n for (let i = 0; i < c.children.length; i++) {\n traverse(c.children[i])\n }\n }\n }\n\n traverse(m)\n }\n\n const el = this.renderer.domElement\n\n const dragControls = new PointerURDFDragControls(this.scene, this.camera, el)\n\n dragControls.onDragStart = joint => {\n this.dispatchEvent(new CustomEvent('manipulate-start', { bubbles: true, cancelable: true, detail: joint.name }))\n this.controls.enabled = false\n this.redraw()\n }\n\n dragControls.onDragEnd = joint => {\n this.dispatchEvent(new CustomEvent('manipulate-end', { bubbles: true, cancelable: true, detail: joint.name }))\n this.controls.enabled = true\n this.redraw()\n }\n\n dragControls.updateJoint = (joint, angle) => {\n this.setJointValue(joint.name, angle)\n }\n\n dragControls.onHover = (joint: URDFJoint) => {\n highlightLinkGeometry(joint as any, false)\n this.dispatchEvent(new CustomEvent('joint-mouseover', { bubbles: true, cancelable: true, detail: joint.name }))\n this.redraw()\n }\n\n dragControls.onUnhover = joint => {\n highlightLinkGeometry(joint as any, true)\n this.dispatchEvent(new CustomEvent('joint-mouseout', { bubbles: true, cancelable: true, detail: joint.name }))\n this.redraw()\n }\n\n this.dragControls = dragControls\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.dragControls.dispose()\n }\n\n attributeChangedCallback(attr: string, oldval: any, newval: any) {\n super.attributeChangedCallback(attr, oldval, newval)\n\n switch (attr) {\n case 'highlight-color':\n this.highlightMaterial.color.set(this.highlightColor)\n this.highlightMaterial.emissive.set(this.highlightColor)\n break\n }\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as THREE from 'three';
2
- import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
3
- import { URDFRobot } from 'urdf-loader/src/URDFLoader';
2
+ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
3
+ import { URDFRobot } from 'urdf-loader/src/URDFLoader.js';
4
4
  export default class URDFViewerElement extends HTMLElement {
5
5
  static get observedAttributes(): string[];
6
6
  get package(): string;
@@ -1,6 +1,6 @@
1
1
  import * as THREE from 'three';
2
- import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
3
- import URDFLoader from 'urdf-loader/src/URDFLoader';
2
+ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
3
+ import URDFLoader from 'urdf-loader/src/URDFLoader.js';
4
4
  import { XacroLoader } from 'xacro-parser';
5
5
  // urdf-viewer element
6
6
  // Loads and displays a 3D view of a URDF-formatted robot
@@ -1 +1 @@
1
- {"version":3,"file":"urdf-viewer-element.js","sourceRoot":"","sources":["../../src/elements/urdf-viewer-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAA;AACzE,OAAO,UAAoC,MAAM,4BAA4B,CAAA;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,sBAAsB;AACtB,yDAAyD;AAEzD,SAAS;AACT,8EAA8E;AAC9E,iFAAiF;AACjF,qEAAqE;AACrE,yEAAyE;AACzE,4CAA4C;AAC5C,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAA;IAC1G,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;IAC3C,CAAC;IACD,IAAI,OAAO,CAAC,GAAG;QACb,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;IACnC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IACxC,CAAC;IACD,IAAI,IAAI,CAAC,GAAG;QACV,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,CAA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I,EAAE,CAAC,CAAC,CAAA;QAClH,CAAC;IACH,CAAC;CACF","sourcesContent":["import * as THREE from 'three'\nimport { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'\nimport URDFLoader, { URDFJoint, URDFRobot } from 'urdf-loader/src/URDFLoader'\nimport { XacroLoader } from 'xacro-parser'\n\n// urdf-viewer element\n// Loads and displays a 3D view of a URDF-formatted robot\n\n// Events\n// urdf-change: Fires when the URDF has finished loading and getting processed\n// urdf-processed: Fires when the URDF has finished loading and getting processed\n// geometry-loaded: Fires when all the geometry has been fully loaded\n// ignore-limits-change: Fires when the 'ignore-limits' attribute changes\n// angle-change: Fires when an angle changes\nexport default class URDFViewerElement extends HTMLElement {\n static get observedAttributes() {\n return ['package', 'urdf', 'up', 'display-shadow', 'ambient-color', 'ignore-limits', 'no-auto-recenter']\n }\n\n get package() {\n return this.getAttribute('package') || ''\n }\n set package(val) {\n this.setAttribute('package', val)\n }\n\n get urdf() {\n return this.getAttribute('urdf') || ''\n }\n set urdf(val) {\n this.setAttribute('urdf', val)\n }\n\n get ignoreLimits() {\n return this.hasAttribute('ignore-limits') || false\n }\n set ignoreLimits(val) {\n val ? this.setAttribute('ignore-limits', String(val)) : this.removeAttribute('ignore-limits')\n }\n\n get up() {\n return this.getAttribute('up') || '+Z'\n }\n set up(val) {\n this.setAttribute('up', val)\n }\n\n get displayShadow() {\n return this.hasAttribute('display-shadow') || false\n }\n set displayShadow(val) {\n val ? this.setAttribute('display-shadow', '') : this.removeAttribute('display-shadow')\n }\n\n get ambientColor() {\n return this.getAttribute('ambient-color') || '#455A64'\n }\n set ambientColor(val) {\n val ? this.setAttribute('ambient-color', val) : this.removeAttribute('ambient-color')\n }\n\n get noAutoRecenter() {\n return this.hasAttribute('no-auto-recenter') || false\n }\n set noAutoRecenter(val) {\n val ? this.setAttribute('no-auto-recenter', String(true)) : this.removeAttribute('no-auto-recenter')\n }\n\n get jointValues() {\n const values = {} as any\n if (this.robot) {\n for (const name in this.robot.joints) {\n const joint = this.robot.joints[name]\n values[name] = joint.jointValue.length === 1 ? joint.angle : [...joint.jointValue]\n }\n }\n\n return values\n }\n set jointValues(val) {\n this.setJointValues(val)\n }\n\n get angles() {\n return this.jointValues\n }\n set angles(v) {\n this.jointValues = v\n }\n\n robot?: URDFRobot\n controls: OrbitControls\n scene: THREE.Scene\n camera: THREE.PerspectiveCamera\n\n world: THREE.Object3D\n renderer: THREE.WebGLRenderer\n plane: THREE.Mesh\n directionalLight: THREE.DirectionalLight\n ambientLight: THREE.HemisphereLight\n\n _prevload?: string\n _requestId = 0\n _dirty = true\n _loadScheduled = false\n loadMeshFunc?: (\n url: string,\n manager: THREE.LoadingManager,\n onLoad: (mesh: THREE.Object3D, err?: Error) => void\n ) => void\n urlModifierFunc?: (url: string) => string\n\n /* Lifecycle Functions */\n constructor() {\n super()\n\n const scene = new THREE.Scene()\n\n const ambientLight = new THREE.HemisphereLight(this.ambientColor, '#000')\n ambientLight.groundColor.lerp(ambientLight.color, 0.5)\n ambientLight.intensity = 0.5\n ambientLight.position.set(0, 1, 0)\n scene.add(ambientLight)\n\n // Light setup\n const dirLight = new THREE.DirectionalLight(0xffffff)\n dirLight.position.set(4, 10, 1)\n dirLight.shadow.mapSize.width = 2048\n dirLight.shadow.mapSize.height = 2048\n dirLight.shadow.normalBias = 0.001\n dirLight.castShadow = true\n scene.add(dirLight)\n scene.add(dirLight.target)\n\n // Renderer setup\n const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true })\n renderer.setClearColor(0xffffff)\n renderer.setClearAlpha(0)\n renderer.shadowMap.enabled = true\n renderer.shadowMap.type = THREE.PCFSoftShadowMap\n renderer.outputEncoding = THREE.sRGBEncoding\n\n // Camera setup\n const camera = new THREE.PerspectiveCamera(75, 1, 0.1, 1000)\n camera.position.z = -10\n\n // World setup\n const world = new THREE.Object3D()\n scene.add(world)\n\n const plane = new THREE.Mesh(\n new THREE.PlaneGeometry(40, 40),\n new THREE.ShadowMaterial({ side: THREE.DoubleSide, transparent: true, opacity: 0.5 })\n )\n plane.rotation.x = -Math.PI / 2\n plane.position.y = -0.5\n plane.receiveShadow = true\n plane.scale.set(10, 10, 10)\n scene.add(plane)\n\n // Controls setup\n const controls = new OrbitControls(camera, renderer.domElement)\n controls.rotateSpeed = 2.0\n controls.zoomSpeed = 5\n controls.panSpeed = 2\n controls.enableZoom = true\n controls.enableDamping = false\n controls.maxDistance = 50\n controls.minDistance = 0.25\n controls.addEventListener('change', () => this.recenter())\n\n this.scene = scene\n this.world = world\n this.renderer = renderer\n this.camera = camera\n this.controls = controls\n this.plane = plane\n this.directionalLight = dirLight\n this.ambientLight = ambientLight\n\n this._setUp(this.up)\n }\n\n connectedCallback() {\n if (!this.querySelector('canvas')) {\n var canvas = this.renderer.domElement\n canvas.style.display = 'block'\n canvas.style.width = '100%'\n canvas.style.height = '100%'\n\n this.appendChild(canvas)\n }\n\n requestAnimationFrame(() => this.recenter())\n }\n\n disconnectedCallback() {}\n\n attributeChangedCallback(attr: string, oldval: any, newval: any) {\n this.recenter()\n\n switch (attr) {\n case 'package':\n case 'urdf': {\n this._scheduleLoad()\n break\n }\n\n case 'up': {\n this._setUp(this.up)\n break\n }\n\n case 'ambient-color': {\n this.ambientLight.color.set(this.ambientColor)\n this.ambientLight.groundColor.set('#000').lerp(this.ambientLight.color, 0.5)\n break\n }\n\n case 'ignore-limits': {\n this._setIgnoreLimits(this.ignoreLimits, true)\n break\n }\n }\n }\n\n /* Public API */\n updateSize() {\n const r = this.renderer\n const w = this.clientWidth\n const h = this.clientHeight\n\n const currsize = r.getSize(new THREE.Vector2())\n\n if (currsize.width !== w || currsize.height !== h) {\n this.recenter()\n }\n\n r.setPixelRatio(window.devicePixelRatio)\n r.setSize(w, h, false)\n\n this.camera.aspect = w / h\n this.camera.updateProjectionMatrix()\n }\n\n redraw() {\n if (this.parentNode && this._dirty) {\n this._dirty = false\n try {\n this.updateSize()\n\n if (!this.noAutoRecenter) {\n this._updateEnvironment()\n }\n\n this.renderer.render(this.scene, this.camera)\n\n // update controls after the environment in\n // case the controls are retargeted\n this.controls.update()\n } catch (err) {\n console.error(err)\n } finally {\n this._dirty = true\n }\n }\n }\n\n recenter() {\n this._updateEnvironment()\n this.redraw()\n }\n\n // Set the joint with jointName to\n // angle in degrees\n setJointValue(jointName: string, ...values: Number[]) {\n if (!this.robot) return\n if (!this.robot.joints[jointName]) return\n\n if (this.robot.joints[jointName].setJointValue(values[0], values[1], values[2]) as any) {\n this.redraw()\n this.dispatchEvent(new CustomEvent('angle-change', { bubbles: true, cancelable: true, detail: jointName }))\n }\n }\n\n setJointValues(values: Number[]) {\n for (const name in values) this.setJointValue(name, values[name])\n }\n\n /* Private Functions */\n // Updates the position of the plane to be at the\n // lowest point below the robot and focuses the\n // camera on the center of the scene\n _updateEnvironment() {\n if (!this.robot) return\n\n this.world.updateMatrixWorld()\n\n const bbox = new THREE.Box3()\n bbox.setFromObject(this.robot)\n\n const center = bbox.getCenter(new THREE.Vector3())\n this.controls.target.y = center.y\n this.plane.position.y = bbox.min.y - 1e-3\n\n const dirLight = this.directionalLight\n dirLight.castShadow = this.displayShadow\n\n if (this.displayShadow) {\n // Update the shadow camera rendering bounds to encapsulate the\n // model. We use the bounding sphere of the bounding box for\n // simplicity -- this could be a tighter fit.\n const sphere = bbox.getBoundingSphere(new THREE.Sphere())\n const minmax = sphere.radius\n const cam = dirLight.shadow.camera\n cam.left = cam.bottom = -minmax\n cam.right = cam.top = minmax\n\n // Update the camera to focus on the center of the model so the\n // shadow can encapsulate it\n const offset = dirLight.position.clone().sub(dirLight.target.position)\n dirLight.target.position.copy(center)\n dirLight.position.copy(center).add(offset)\n\n cam.updateProjectionMatrix()\n }\n }\n\n _scheduleLoad() {\n // if our current model is already what's being requested\n // or has been loaded then early out\n if (this._prevload === `${this.package}|${this.urdf}`) return\n this._prevload = `${this.package}|${this.urdf}`\n\n // if we're already waiting on a load then early out\n if (this._loadScheduled) return\n this._loadScheduled = true\n\n if (this.robot) {\n this.robot.traverse((c: any) => c.dispose && c.dispose())\n this.robot.parent!.remove(this.robot)\n delete this.robot\n }\n\n requestAnimationFrame(() => {\n this._loadUrdf(this.package, this.urdf)\n this._loadScheduled = false\n })\n }\n\n // Watch the package and urdf field and load the robot model.\n // This should _only_ be called from _scheduleLoad because that\n // ensures the that current robot has been removed\n _loadUrdf(pkg: string, urdf: string) {\n this.dispatchEvent(new CustomEvent('urdf-change', { bubbles: true, cancelable: true, composed: true }))\n\n if (urdf) {\n // Keep track of this request and make\n // sure it doesn't get overwritten by\n // a subsequent one\n this._requestId++\n const requestId = this._requestId\n\n const updateMaterials = (mesh: URDFRobot) => {\n mesh.traverse(c => {\n if ((c as any).isMesh) {\n c.castShadow = true\n c.receiveShadow = true\n\n if ((c as any).material) {\n const mats = (Array.isArray((c as any).material) ? (c as any).material : [(c as any).material]).map(\n (m: any) => {\n if (m instanceof THREE.MeshBasicMaterial) {\n m = new THREE.MeshPhongMaterial()\n }\n\n // FIXME THREE.GammaEncoding is removed at v136\n // if (m.map) {\n // m.map.encoding = THREE.GammaEncoding\n // }\n\n return m\n }\n )\n\n ;(c as any).material = mats.length === 1 ? mats[0] : mats\n }\n }\n })\n }\n\n if (pkg.includes(':') && pkg.split(':')[1].substring(0, 2) !== '//') {\n // E.g. pkg = \"pkg_name: path/to/pkg_name, pk2: path2/to/pk2\"}\n\n // Convert pkg(s) into a map. E.g.\n // { \"pkg_name\": \"path/to/pkg_name\",\n // \"pk2\": \"path2/to/pk2\" }\n\n pkg = pkg.split(',').reduce((map: any, value: string) => {\n const split = value.split(/:/).filter(x => !!x)\n const pkgName = split.shift()!.trim()\n const pkgPath = split.join(':').trim()\n map[pkgName] = pkgPath\n\n return map\n }, {} as any)\n }\n\n let robot: URDFRobot\n const manager = new THREE.LoadingManager()\n manager.onLoad = () => {\n // If another request has come in to load a new\n // robot, then ignore this one\n if (this._requestId !== requestId) {\n robot.traverse(c => (c as any).dispose && (c as any).dispose())\n return\n }\n\n this.robot = robot\n\n this.world.add(robot)\n updateMaterials(robot)\n\n this._setIgnoreLimits(this.ignoreLimits)\n\n this.dispatchEvent(new CustomEvent('urdf-processed', { bubbles: true, cancelable: true, composed: true }))\n this.dispatchEvent(new CustomEvent('geometry-loaded', { bubbles: true, cancelable: true, composed: true }))\n\n this.recenter()\n }\n\n if (this.urlModifierFunc) {\n manager.setURLModifier(this.urlModifierFunc)\n }\n\n const checkXacro = /[.]/.exec(urdf) ? /[^.]+$/.exec(urdf) : undefined\n\n if (checkXacro && checkXacro[0] === 'xacro') {\n const xacroLoader = new XacroLoader()\n try {\n xacroLoader.load(\n urdf,\n xml => {\n const loader = new URDFLoader(manager)\n loader.packages = pkg\n loader.loadMeshCb = this.loadMeshFunc!\n loader.fetchOptions = { mode: 'cors', credentials: 'same-origin' }\n robot = loader.parse(xml)\n },\n err => {\n console.error('xacroloader error: ', err)\n }\n )\n } catch (error) {\n console.error(error)\n }\n } else {\n const loader = new URDFLoader(manager)\n loader.packages = pkg\n loader.loadMeshCb = this.loadMeshFunc!\n loader.fetchOptions = { mode: 'cors', credentials: 'same-origin' }\n loader.load(urdf, model => (robot = model))\n }\n }\n }\n\n // Watch the coordinate frame and update the\n // rotation of the scene to match\n _setUp(up: string) {\n if (!up) up = '+Z'\n up = up.toUpperCase()\n const sign = up.replace(/[^-+]/g, '')[0] || '+'\n const axis = up.replace(/[^XYZ]/gi, '')[0] || 'Z'\n\n const PI = Math.PI\n const HALFPI = PI / 2\n if (axis === 'X') this.world.rotation.set(0, 0, sign === '+' ? HALFPI : -HALFPI)\n if (axis === 'Z') this.world.rotation.set(sign === '+' ? -HALFPI : HALFPI, 0, 0)\n if (axis === 'Y') this.world.rotation.set(sign === '+' ? 0 : PI, 0, 0)\n }\n\n // Updates the current robot's angles to ignore\n // joint limits or not\n _setIgnoreLimits(ignore: boolean, dispatch = false) {\n if (this.robot) {\n Object.values(this.robot.joints).forEach(joint => {\n joint.ignoreLimits = ignore\n joint.setJointValue(joint.jointValue[0], joint.jointValue[1], joint.jointValue[2])\n })\n }\n\n if (dispatch) {\n this.dispatchEvent(new CustomEvent('ignore-limits-change', { bubbles: true, cancelable: true, composed: true }))\n }\n }\n}\n"]}
1
+ {"version":3,"file":"urdf-viewer-element.js","sourceRoot":"","sources":["../../src/elements/urdf-viewer-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,UAAoC,MAAM,+BAA+B,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,sBAAsB;AACtB,yDAAyD;AAEzD,SAAS;AACT,8EAA8E;AAC9E,iFAAiF;AACjF,qEAAqE;AACrE,yEAAyE;AACzE,4CAA4C;AAC5C,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAA;IAC1G,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;IAC3C,CAAC;IACD,IAAI,OAAO,CAAC,GAAG;QACb,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;IACnC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IACxC,CAAC;IACD,IAAI,IAAI,CAAC,GAAG;QACV,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,KAAK,CAAA;IACpD,CAAC;IACD,IAAI,YAAY,CAAC,GAAG;QAClB,GAAG,CAAC,C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port { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'\nimport URDFLoader, { URDFJoint, URDFRobot } from 'urdf-loader/src/URDFLoader.js'\nimport { XacroLoader } from 'xacro-parser'\n\n// urdf-viewer element\n// Loads and displays a 3D view of a URDF-formatted robot\n\n// Events\n// urdf-change: Fires when the URDF has finished loading and getting processed\n// urdf-processed: Fires when the URDF has finished loading and getting processed\n// geometry-loaded: Fires when all the geometry has been fully loaded\n// ignore-limits-change: Fires when the 'ignore-limits' attribute changes\n// angle-change: Fires when an angle changes\nexport default class URDFViewerElement extends HTMLElement {\n static get observedAttributes() {\n return ['package', 'urdf', 'up', 'display-shadow', 'ambient-color', 'ignore-limits', 'no-auto-recenter']\n }\n\n get package() {\n return this.getAttribute('package') || ''\n }\n set package(val) {\n this.setAttribute('package', val)\n }\n\n get urdf() {\n return this.getAttribute('urdf') || ''\n }\n set urdf(val) {\n this.setAttribute('urdf', val)\n }\n\n get ignoreLimits() {\n return this.hasAttribute('ignore-limits') || false\n }\n set ignoreLimits(val) {\n val ? this.setAttribute('ignore-limits', String(val)) : this.removeAttribute('ignore-limits')\n }\n\n get up() {\n return this.getAttribute('up') || '+Z'\n }\n set up(val) {\n this.setAttribute('up', val)\n }\n\n get displayShadow() {\n return this.hasAttribute('display-shadow') || false\n }\n set displayShadow(val) {\n val ? this.setAttribute('display-shadow', '') : this.removeAttribute('display-shadow')\n }\n\n get ambientColor() {\n return this.getAttribute('ambient-color') || '#455A64'\n }\n set ambientColor(val) {\n val ? this.setAttribute('ambient-color', val) : this.removeAttribute('ambient-color')\n }\n\n get noAutoRecenter() {\n return this.hasAttribute('no-auto-recenter') || false\n }\n set noAutoRecenter(val) {\n val ? this.setAttribute('no-auto-recenter', String(true)) : this.removeAttribute('no-auto-recenter')\n }\n\n get jointValues() {\n const values = {} as any\n if (this.robot) {\n for (const name in this.robot.joints) {\n const joint = this.robot.joints[name]\n values[name] = joint.jointValue.length === 1 ? joint.angle : [...joint.jointValue]\n }\n }\n\n return values\n }\n set jointValues(val) {\n this.setJointValues(val)\n }\n\n get angles() {\n return this.jointValues\n }\n set angles(v) {\n this.jointValues = v\n }\n\n robot?: URDFRobot\n controls: OrbitControls\n scene: THREE.Scene\n camera: THREE.PerspectiveCamera\n\n world: THREE.Object3D\n renderer: THREE.WebGLRenderer\n plane: THREE.Mesh\n directionalLight: THREE.DirectionalLight\n ambientLight: THREE.HemisphereLight\n\n _prevload?: string\n _requestId = 0\n _dirty = true\n _loadScheduled = false\n loadMeshFunc?: (\n url: string,\n manager: THREE.LoadingManager,\n onLoad: (mesh: THREE.Object3D, err?: Error) => void\n ) => void\n urlModifierFunc?: (url: string) => string\n\n /* Lifecycle Functions */\n constructor() {\n super()\n\n const scene = new THREE.Scene()\n\n const ambientLight = new THREE.HemisphereLight(this.ambientColor, '#000')\n ambientLight.groundColor.lerp(ambientLight.color, 0.5)\n ambientLight.intensity = 0.5\n ambientLight.position.set(0, 1, 0)\n scene.add(ambientLight)\n\n // Light setup\n const dirLight = new THREE.DirectionalLight(0xffffff)\n dirLight.position.set(4, 10, 1)\n dirLight.shadow.mapSize.width = 2048\n dirLight.shadow.mapSize.height = 2048\n dirLight.shadow.normalBias = 0.001\n dirLight.castShadow = true\n scene.add(dirLight)\n scene.add(dirLight.target)\n\n // Renderer setup\n const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true })\n renderer.setClearColor(0xffffff)\n renderer.setClearAlpha(0)\n renderer.shadowMap.enabled = true\n renderer.shadowMap.type = THREE.PCFSoftShadowMap\n renderer.outputEncoding = THREE.sRGBEncoding\n\n // Camera setup\n const camera = new THREE.PerspectiveCamera(75, 1, 0.1, 1000)\n camera.position.z = -10\n\n // World setup\n const world = new THREE.Object3D()\n scene.add(world)\n\n const plane = new THREE.Mesh(\n new THREE.PlaneGeometry(40, 40),\n new THREE.ShadowMaterial({ side: THREE.DoubleSide, transparent: true, opacity: 0.5 })\n )\n plane.rotation.x = -Math.PI / 2\n plane.position.y = -0.5\n plane.receiveShadow = true\n plane.scale.set(10, 10, 10)\n scene.add(plane)\n\n // Controls setup\n const controls = new OrbitControls(camera, renderer.domElement)\n controls.rotateSpeed = 2.0\n controls.zoomSpeed = 5\n controls.panSpeed = 2\n controls.enableZoom = true\n controls.enableDamping = false\n controls.maxDistance = 50\n controls.minDistance = 0.25\n controls.addEventListener('change', () => this.recenter())\n\n this.scene = scene\n this.world = world\n this.renderer = renderer\n this.camera = camera\n this.controls = controls\n this.plane = plane\n this.directionalLight = dirLight\n this.ambientLight = ambientLight\n\n this._setUp(this.up)\n }\n\n connectedCallback() {\n if (!this.querySelector('canvas')) {\n var canvas = this.renderer.domElement\n canvas.style.display = 'block'\n canvas.style.width = '100%'\n canvas.style.height = '100%'\n\n this.appendChild(canvas)\n }\n\n requestAnimationFrame(() => this.recenter())\n }\n\n disconnectedCallback() {}\n\n attributeChangedCallback(attr: string, oldval: any, newval: any) {\n this.recenter()\n\n switch (attr) {\n case 'package':\n case 'urdf': {\n this._scheduleLoad()\n break\n }\n\n case 'up': {\n this._setUp(this.up)\n break\n }\n\n case 'ambient-color': {\n this.ambientLight.color.set(this.ambientColor)\n this.ambientLight.groundColor.set('#000').lerp(this.ambientLight.color, 0.5)\n break\n }\n\n case 'ignore-limits': {\n this._setIgnoreLimits(this.ignoreLimits, true)\n break\n }\n }\n }\n\n /* Public API */\n updateSize() {\n const r = this.renderer\n const w = this.clientWidth\n const h = this.clientHeight\n\n const currsize = r.getSize(new THREE.Vector2())\n\n if (currsize.width !== w || currsize.height !== h) {\n this.recenter()\n }\n\n r.setPixelRatio(window.devicePixelRatio)\n r.setSize(w, h, false)\n\n this.camera.aspect = w / h\n this.camera.updateProjectionMatrix()\n }\n\n redraw() {\n if (this.parentNode && this._dirty) {\n this._dirty = false\n try {\n this.updateSize()\n\n if (!this.noAutoRecenter) {\n this._updateEnvironment()\n }\n\n this.renderer.render(this.scene, this.camera)\n\n // update controls after the environment in\n // case the controls are retargeted\n this.controls.update()\n } catch (err) {\n console.error(err)\n } finally {\n this._dirty = true\n }\n }\n }\n\n recenter() {\n this._updateEnvironment()\n this.redraw()\n }\n\n // Set the joint with jointName to\n // angle in degrees\n setJointValue(jointName: string, ...values: Number[]) {\n if (!this.robot) return\n if (!this.robot.joints[jointName]) return\n\n if (this.robot.joints[jointName].setJointValue(values[0], values[1], values[2]) as any) {\n this.redraw()\n this.dispatchEvent(new CustomEvent('angle-change', { bubbles: true, cancelable: true, detail: jointName }))\n }\n }\n\n setJointValues(values: Number[]) {\n for (const name in values) this.setJointValue(name, values[name])\n }\n\n /* Private Functions */\n // Updates the position of the plane to be at the\n // lowest point below the robot and focuses the\n // camera on the center of the scene\n _updateEnvironment() {\n if (!this.robot) return\n\n this.world.updateMatrixWorld()\n\n const bbox = new THREE.Box3()\n bbox.setFromObject(this.robot)\n\n const center = bbox.getCenter(new THREE.Vector3())\n this.controls.target.y = center.y\n this.plane.position.y = bbox.min.y - 1e-3\n\n const dirLight = this.directionalLight\n dirLight.castShadow = this.displayShadow\n\n if (this.displayShadow) {\n // Update the shadow camera rendering bounds to encapsulate the\n // model. We use the bounding sphere of the bounding box for\n // simplicity -- this could be a tighter fit.\n const sphere = bbox.getBoundingSphere(new THREE.Sphere())\n const minmax = sphere.radius\n const cam = dirLight.shadow.camera\n cam.left = cam.bottom = -minmax\n cam.right = cam.top = minmax\n\n // Update the camera to focus on the center of the model so the\n // shadow can encapsulate it\n const offset = dirLight.position.clone().sub(dirLight.target.position)\n dirLight.target.position.copy(center)\n dirLight.position.copy(center).add(offset)\n\n cam.updateProjectionMatrix()\n }\n }\n\n _scheduleLoad() {\n // if our current model is already what's being requested\n // or has been loaded then early out\n if (this._prevload === `${this.package}|${this.urdf}`) return\n this._prevload = `${this.package}|${this.urdf}`\n\n // if we're already waiting on a load then early out\n if (this._loadScheduled) return\n this._loadScheduled = true\n\n if (this.robot) {\n this.robot.traverse((c: any) => c.dispose && c.dispose())\n this.robot.parent!.remove(this.robot)\n delete this.robot\n }\n\n requestAnimationFrame(() => {\n this._loadUrdf(this.package, this.urdf)\n this._loadScheduled = false\n })\n }\n\n // Watch the package and urdf field and load the robot model.\n // This should _only_ be called from _scheduleLoad because that\n // ensures the that current robot has been removed\n _loadUrdf(pkg: string, urdf: string) {\n this.dispatchEvent(new CustomEvent('urdf-change', { bubbles: true, cancelable: true, composed: true }))\n\n if (urdf) {\n // Keep track of this request and make\n // sure it doesn't get overwritten by\n // a subsequent one\n this._requestId++\n const requestId = this._requestId\n\n const updateMaterials = (mesh: URDFRobot) => {\n mesh.traverse(c => {\n if ((c as any).isMesh) {\n c.castShadow = true\n c.receiveShadow = true\n\n if ((c as any).material) {\n const mats = (Array.isArray((c as any).material) ? (c as any).material : [(c as any).material]).map(\n (m: any) => {\n if (m instanceof THREE.MeshBasicMaterial) {\n m = new THREE.MeshPhongMaterial()\n }\n\n // FIXME THREE.GammaEncoding is removed at v136\n // if (m.map) {\n // m.map.encoding = THREE.GammaEncoding\n // }\n\n return m\n }\n )\n\n ;(c as any).material = mats.length === 1 ? mats[0] : mats\n }\n }\n })\n }\n\n if (pkg.includes(':') && pkg.split(':')[1].substring(0, 2) !== '//') {\n // E.g. pkg = \"pkg_name: path/to/pkg_name, pk2: path2/to/pk2\"}\n\n // Convert pkg(s) into a map. E.g.\n // { \"pkg_name\": \"path/to/pkg_name\",\n // \"pk2\": \"path2/to/pk2\" }\n\n pkg = pkg.split(',').reduce((map: any, value: string) => {\n const split = value.split(/:/).filter(x => !!x)\n const pkgName = split.shift()!.trim()\n const pkgPath = split.join(':').trim()\n map[pkgName] = pkgPath\n\n return map\n }, {} as any)\n }\n\n let robot: URDFRobot\n const manager = new THREE.LoadingManager()\n manager.onLoad = () => {\n // If another request has come in to load a new\n // robot, then ignore this one\n if (this._requestId !== requestId) {\n robot.traverse(c => (c as any).dispose && (c as any).dispose())\n return\n }\n\n this.robot = robot\n\n this.world.add(robot)\n updateMaterials(robot)\n\n this._setIgnoreLimits(this.ignoreLimits)\n\n this.dispatchEvent(new CustomEvent('urdf-processed', { bubbles: true, cancelable: true, composed: true }))\n this.dispatchEvent(new CustomEvent('geometry-loaded', { bubbles: true, cancelable: true, composed: true }))\n\n this.recenter()\n }\n\n if (this.urlModifierFunc) {\n manager.setURLModifier(this.urlModifierFunc)\n }\n\n const checkXacro = /[.]/.exec(urdf) ? /[^.]+$/.exec(urdf) : undefined\n\n if (checkXacro && checkXacro[0] === 'xacro') {\n const xacroLoader = new XacroLoader()\n try {\n xacroLoader.load(\n urdf,\n xml => {\n const loader = new URDFLoader(manager)\n loader.packages = pkg\n loader.loadMeshCb = this.loadMeshFunc!\n loader.fetchOptions = { mode: 'cors', credentials: 'same-origin' }\n robot = loader.parse(xml)\n },\n err => {\n console.error('xacroloader error: ', err)\n }\n )\n } catch (error) {\n console.error(error)\n }\n } else {\n const loader = new URDFLoader(manager)\n loader.packages = pkg\n loader.loadMeshCb = this.loadMeshFunc!\n loader.fetchOptions = { mode: 'cors', credentials: 'same-origin' }\n loader.load(urdf, model => (robot = model))\n }\n }\n }\n\n // Watch the coordinate frame and update the\n // rotation of the scene to match\n _setUp(up: string) {\n if (!up) up = '+Z'\n up = up.toUpperCase()\n const sign = up.replace(/[^-+]/g, '')[0] || '+'\n const axis = up.replace(/[^XYZ]/gi, '')[0] || 'Z'\n\n const PI = Math.PI\n const HALFPI = PI / 2\n if (axis === 'X') this.world.rotation.set(0, 0, sign === '+' ? HALFPI : -HALFPI)\n if (axis === 'Z') this.world.rotation.set(sign === '+' ? -HALFPI : HALFPI, 0, 0)\n if (axis === 'Y') this.world.rotation.set(sign === '+' ? 0 : PI, 0, 0)\n }\n\n // Updates the current robot's angles to ignore\n // joint limits or not\n _setIgnoreLimits(ignore: boolean, dispatch = false) {\n if (this.robot) {\n Object.values(this.robot.joints).forEach(joint => {\n joint.ignoreLimits = ignore\n joint.setJointValue(joint.jointValue[0], joint.jointValue[1], joint.jointValue[2])\n })\n }\n\n if (dispatch) {\n this.dispatchEvent(new CustomEvent('ignore-limits-change', { bubbles: true, cancelable: true, composed: true }))\n }\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { default as UrdfViewer } from './urdf-viewer';
2
- export { default as UrdfController } from './urdf-controller';
1
+ export { default as UrdfViewer } from './urdf-viewer.js';
2
+ export { default as UrdfController } from './urdf-controller.js';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { default as UrdfViewer } from './urdf-viewer';
2
- export { default as UrdfController } from './urdf-controller';
1
+ export { default as UrdfViewer } from './urdf-viewer.js';
2
+ export { default as UrdfController } from './urdf-controller.js';
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAA","sourcesContent":["export { default as UrdfViewer } from './urdf-viewer'\nexport { default as UrdfController } from './urdf-controller'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA","sourcesContent":["export { default as UrdfViewer } from './urdf-viewer.js'\nexport { default as UrdfController } from './urdf-controller.js'\n"]}
@@ -1,4 +1,4 @@
1
- import URDFViewer from './urdf-viewer';
2
- import URDFController from './urdf-controller';
1
+ import URDFViewer from './urdf-viewer.js';
2
+ import URDFController from './urdf-controller.js';
3
3
  export default [URDFViewer, URDFController];
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,cAAc,MAAM,mBAAmB,CAAA;AAE9C,eAAe,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA","sourcesContent":["import URDFViewer from './urdf-viewer'\nimport URDFController from './urdf-controller'\n\nexport default [URDFViewer, URDFController]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAA;AACzC,OAAO,cAAc,MAAM,sBAAsB,CAAA;AAEjD,eAAe,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA","sourcesContent":["import URDFViewer from './urdf-viewer.js'\nimport URDFController from './urdf-controller.js'\n\nexport default [URDFViewer, URDFController]\n"]}
@@ -1,7 +1,7 @@
1
1
  import { ComponentNature, HTMLOverlayContainer } from '@hatiolab/things-scene';
2
- import './elements/urdf-controller-element';
3
- import URDFControllerElement from './elements/urdf-controller-element';
4
- import UrdfViewer from './urdf-viewer';
2
+ import './elements/urdf-controller-element.js';
3
+ import URDFControllerElement from './elements/urdf-controller-element.js';
4
+ import UrdfViewer from './urdf-viewer.js';
5
5
  export default class UrdfController extends HTMLOverlayContainer {
6
6
  _reference?: UrdfViewer;
7
7
  static get nature(): ComponentNature;
@@ -17,7 +17,7 @@ const NATURE = {
17
17
  ]
18
18
  };
19
19
  import { Component, HTMLOverlayContainer } from '@hatiolab/things-scene';
20
- import './elements/urdf-controller-element';
20
+ import './elements/urdf-controller-element.js';
21
21
  export default class UrdfController extends HTMLOverlayContainer {
22
22
  static get nature() {
23
23
  return NATURE;
@@ -1 +1 @@
1
- {"version":3,"file":"urdf-controller.js","sourceRoot":"","sources":["../src/urdf-controller.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,gBAAgB;YACvB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,cAAc,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'id-input',\n label: 'urdf-reference',\n name: 'reference',\n property: {\n component: 'urdf-viewer'\n }\n }\n ]\n}\n\nimport { Component, ComponentNature, HTMLOverlayContainer } from '@hatiolab/things-scene'\nimport './elements/urdf-controller-element'\nimport URDFControllerElement from './elements/urdf-controller-element'\nimport URDFManipulatorElement from './elements/urdf-manipulator-element'\nimport UrdfViewer from './urdf-viewer'\n\nexport default class UrdfController extends HTMLOverlayContainer {\n _reference?: UrdfViewer\n\n static get nature() {\n return NATURE\n }\n\n oncreate_element(controller: URDFControllerElement) {}\n\n dispose() {\n super.dispose()\n }\n\n /*\n * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,\n * 그에 따른 html element의 반영이 필요한 부분을 구현한다.\n *\n * ThingsComponent state => HTML element properties\n */\n setElementProperties(controller: URDFControllerElement) {\n var reference = this.reference\n controller.viewer = reference ? (reference.element as URDFManipulatorElement) : undefined\n }\n\n /*\n * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.\n * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.\n */\n reposition() {\n super.reposition()\n }\n\n get tagName() {\n return 'urdf-controller'\n }\n\n get reference() {\n var { reference } = this.state\n if (!reference) {\n return\n }\n\n if (!this._reference) {\n this._reference = this.root.findById(reference) as UrdfViewer\n }\n\n return this._reference\n }\n\n set reference(reference) {\n delete this._reference\n this.state.reference = reference\n }\n}\n\nComponent.register('urdf-controller', UrdfController)\n"]}
1
+ {"version":3,"file":"urdf-controller.js","sourceRoot":"","sources":["../src/urdf-controller.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAA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ACtB,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAA;IAClC,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'id-input',\n label: 'urdf-reference',\n name: 'reference',\n property: {\n component: 'urdf-viewer'\n }\n }\n ]\n}\n\nimport { Component, ComponentNature, HTMLOverlayContainer } from '@hatiolab/things-scene'\nimport './elements/urdf-controller-element.js'\nimport URDFControllerElement from './elements/urdf-controller-element.js'\nimport URDFManipulatorElement from './elements/urdf-manipulator-element.js'\nimport UrdfViewer from './urdf-viewer.js'\n\nexport default class UrdfController extends HTMLOverlayContainer {\n _reference?: UrdfViewer\n\n static get nature() {\n return NATURE\n }\n\n oncreate_element(controller: URDFControllerElement) {}\n\n dispose() {\n super.dispose()\n }\n\n /*\n * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,\n * 그에 따른 html element의 반영이 필요한 부분을 구현한다.\n *\n * ThingsComponent state => HTML element properties\n */\n setElementProperties(controller: URDFControllerElement) {\n var reference = this.reference\n controller.viewer = reference ? (reference.element as URDFManipulatorElement) : undefined\n }\n\n /*\n * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.\n * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.\n */\n reposition() {\n super.reposition()\n }\n\n get tagName() {\n return 'urdf-controller'\n }\n\n get reference() {\n var { reference } = this.state\n if (!reference) {\n return\n }\n\n if (!this._reference) {\n this._reference = this.root.findById(reference) as UrdfViewer\n }\n\n return this._reference\n }\n\n set reference(reference) {\n delete this._reference\n this.state.reference = reference\n }\n}\n\nComponent.register('urdf-controller', UrdfController)\n"]}
@@ -1,6 +1,6 @@
1
1
  import { HTMLOverlayElement, Properties, ComponentNature } from '@hatiolab/things-scene';
2
- import './elements/urdf-manipulator-element';
3
- import URDFManipulatorElement from './elements/urdf-manipulator-element';
2
+ import './elements/urdf-manipulator-element.js';
3
+ import URDFManipulatorElement from './elements/urdf-manipulator-element.js';
4
4
  export default class UrdfViewer extends HTMLOverlayElement {
5
5
  static get nature(): ComponentNature;
6
6
  oncreate_element(element: URDFManipulatorElement): void;
@@ -7,7 +7,7 @@ import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js';
7
7
  import { ColladaLoader } from 'three/examples/jsm/loaders/ColladaLoader.js';
8
8
  import { STLLoader } from 'three/examples/jsm/loaders/STLLoader.js';
9
9
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
10
- import './elements/urdf-manipulator-element';
10
+ import './elements/urdf-manipulator-element.js';
11
11
  const NATURE = {
12
12
  mutable: false,
13
13
  resizable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"urdf-viewer.js","sourceRoot":"","sources":["../src/urdf-viewer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAsC,MAAM,wBAAwB,CAAA;AAC1G,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAA;AACrE,OAAO,qCAAqC,CAAA;AAG5C,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,SAAS;SAChB;QACD;YACE,IAAI,EAA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AAQ,CAAC,KAAiB,EAAE,MAAkB;QAC5C,IAAI,gBAAgB,IAAI,KAAK,IAAI,gBAAgB,IAAI,KAAK,IAAI,gBAAgB,IAAI,KAAK,EAAE,CAAC;YACxF,MAAM,EAAE,cAAc,GAAG,CAAC,EAAE,cAAc,GAAG,CAAC,EAAE,cAAc,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;YACjF,IAAI,CAAC,OAAO;gBACT,IAAI,CAAC,OAAkC,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,CAAA;QAChH,CAAC;QAED,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACjD,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, HTMLOverlayElement, error, Properties, ComponentNature } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js'\nimport { ColladaLoader } from 'three/examples/jsm/loaders/ColladaLoader.js'\nimport { STLLoader } from 'three/examples/jsm/loaders/STLLoader.js'\nimport { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'\nimport './elements/urdf-manipulator-element'\nimport URDFManipulatorElement from './elements/urdf-manipulator-element'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'package',\n name: 'package'\n },\n {\n type: 'string',\n label: 'urdf',\n name: 'urdf'\n },\n {\n type: 'select',\n label: 'up',\n name: 'up',\n property: {\n options: ['', '+X', '-X', '+Y', '-Y', '+Z', '-Z']\n }\n },\n {\n type: 'checkbox',\n label: 'display-shadow',\n name: 'displayShadow'\n },\n {\n type: 'color',\n label: 'ambient-color',\n name: 'ambientColor'\n },\n {\n type: 'color',\n label: 'highlight-color',\n name: 'highlightColor'\n },\n {\n type: 'checkbox',\n label: 'ignore-limits',\n name: 'ignoreLimits'\n },\n {\n type: 'checkbox',\n label: 'no-auto-recenter',\n name: 'noAutoRecenter'\n },\n {\n type: 'checkbox',\n label: 'disable-dragging',\n name: 'disableDragging'\n },\n {\n type: 'checkbox',\n label: 'no-camera-control',\n name: 'noCameraControl'\n },\n {\n type: 'range-input',\n label: 'init-camera-pos-x',\n name: 'initCameraPosX',\n placeholder: '1',\n property: {\n step: 0.1,\n max: 180,\n min: -180\n }\n },\n {\n type: 'range-input',\n label: 'init-camera-pos-y',\n name: 'initCameraPosY',\n placeholder: '1',\n property: {\n step: 0.1,\n max: 180,\n min: -180\n }\n },\n {\n type: 'range-input',\n label: 'init-camera-pos-z',\n name: 'initCameraPosZ',\n placeholder: '1',\n property: {\n step: 0.1,\n max: 180,\n min: -180\n }\n }\n ],\n 'value-property': 'angles'\n}\n\nexport default class UrdfViewer extends HTMLOverlayElement {\n static get nature() {\n return NATURE\n }\n\n oncreate_element(element: URDFManipulatorElement) {\n element.addEventListener('angle-change', (e: Event) => {\n this.data = element.angles\n })\n\n element.loadMeshFunc = (path: string, manager: THREE.LoadingManager, done: (result: any, err?: any) => void) => {\n const ext = path.split(/\\./g).pop()!.toLowerCase()\n switch (ext) {\n case 'gltf':\n case 'glb':\n new GLTFLoader(manager).load(\n path,\n result => done(result.scene),\n undefined,\n err => done(null, err)\n )\n break\n case 'obj':\n new OBJLoader(manager).load(\n path,\n result => done(result),\n undefined,\n err => done(null, err)\n )\n break\n case 'dae':\n new ColladaLoader(manager).load(\n path,\n result => done(result.scene),\n undefined,\n err => done(null, err)\n )\n break\n case 'stl':\n new STLLoader(manager).load(\n path,\n result => {\n const material = new THREE.MeshPhongMaterial()\n const mesh = new THREE.Mesh(result, material)\n done(mesh)\n },\n undefined,\n err => done(null, err)\n )\n break\n }\n }\n\n // initialize first camera position\n var { initCameraPosX = 1, initCameraPosY = 1, initCameraPosZ = 1 } = this.state\n element.camera.position.set(initCameraPosX, initCameraPosY, initCameraPosZ)\n }\n\n dispose() {\n super.dispose()\n }\n\n /*\n * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,\n * 그에 따른 html element의 반영이 필요한 부분을 구현한다.\n *\n * ThingsComponent state => HTML element properties\n */\n setElementProperties(element: URDFManipulatorElement) {\n var {\n package: _package,\n urdf,\n displayShadow,\n ignoreLimits,\n up,\n ambientColor,\n highlightColor,\n noAutoRecenter,\n disableDragging,\n noCameraControl,\n angles\n } = this.state\n\n element.style.pointerEvents = 'auto' //'inherit'\n\n element.package = _package\n element.urdf = urdf\n element.displayShadow = displayShadow\n element.ignoreLimits = ignoreLimits\n element.up = up\n element.ambientColor = ambientColor\n element.highlightColor = highlightColor\n element.noAutoRecenter = noAutoRecenter\n element.disableDragging = disableDragging\n element.controls.enabled = !noCameraControl\n element.angles = angles\n\n requestAnimationFrame(() => element.redraw())\n }\n\n /*\n * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.\n * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.\n */\n reposition() {\n super.reposition()\n }\n\n get tagName() {\n return 'urdf-viewer'\n }\n\n get angles() {\n // return this.element.angles\n return this.state.angles\n }\n\n set angles(angles) {\n // this.element.angles = angles\n this.setState({ angles })\n }\n\n get highlightColor() {\n return this.state.highlightColor\n }\n\n set highlightColor(highlightColor: string) {\n this.setState({ highlightColor })\n }\n\n onchange(after: Properties, before: Properties) {\n if ('initCameraPosX' in after || 'initCameraPosY' in after || 'initCameraPosZ' in after) {\n const { initCameraPosX = 1, initCameraPosY = 1, initCameraPosZ = 1 } = this.state\n this.element &&\n (this.element as URDFManipulatorElement).camera.position.set(initCameraPosX, initCameraPosY, initCameraPosZ)\n }\n\n super.onchange && super.onchange(after, before)\n }\n}\n\nComponent.register('urdf-viewer', UrdfView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yright © HatioLab Inc. All rights reserved.\n */\nimport { Component, HTMLOverlayElement, error, Properties, ComponentNature } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js'\nimport { ColladaLoader } from 'three/examples/jsm/loaders/ColladaLoader.js'\nimport { STLLoader } from 'three/examples/jsm/loaders/STLLoader.js'\nimport { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'\nimport './elements/urdf-manipulator-element.js'\nimport URDFManipulatorElement from './elements/urdf-manipulator-element.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'package',\n name: 'package'\n },\n {\n type: 'string',\n label: 'urdf',\n name: 'urdf'\n },\n {\n type: 'select',\n label: 'up',\n name: 'up',\n property: {\n options: ['', '+X', '-X', '+Y', '-Y', '+Z', '-Z']\n }\n },\n {\n type: 'checkbox',\n label: 'display-shadow',\n name: 'displayShadow'\n },\n {\n type: 'color',\n label: 'ambient-color',\n name: 'ambientColor'\n },\n {\n type: 'color',\n label: 'highlight-color',\n name: 'highlightColor'\n },\n {\n type: 'checkbox',\n label: 'ignore-limits',\n name: 'ignoreLimits'\n },\n {\n type: 'checkbox',\n label: 'no-auto-recenter',\n name: 'noAutoRecenter'\n },\n {\n type: 'checkbox',\n label: 'disable-dragging',\n name: 'disableDragging'\n },\n {\n type: 'checkbox',\n label: 'no-camera-control',\n name: 'noCameraControl'\n },\n {\n type: 'range-input',\n label: 'init-camera-pos-x',\n name: 'initCameraPosX',\n placeholder: '1',\n property: {\n step: 0.1,\n max: 180,\n min: -180\n }\n },\n {\n type: 'range-input',\n label: 'init-camera-pos-y',\n name: 'initCameraPosY',\n placeholder: '1',\n property: {\n step: 0.1,\n max: 180,\n min: -180\n }\n },\n {\n type: 'range-input',\n label: 'init-camera-pos-z',\n name: 'initCameraPosZ',\n placeholder: '1',\n property: {\n step: 0.1,\n max: 180,\n min: -180\n }\n }\n ],\n 'value-property': 'angles'\n}\n\nexport default class UrdfViewer extends HTMLOverlayElement {\n static get nature() {\n return NATURE\n }\n\n oncreate_element(element: URDFManipulatorElement) {\n element.addEventListener('angle-change', (e: Event) => {\n this.data = element.angles\n })\n\n element.loadMeshFunc = (path: string, manager: THREE.LoadingManager, done: (result: any, err?: any) => void) => {\n const ext = path.split(/\\./g).pop()!.toLowerCase()\n switch (ext) {\n case 'gltf':\n case 'glb':\n new GLTFLoader(manager).load(\n path,\n result => done(result.scene),\n undefined,\n err => done(null, err)\n )\n break\n case 'obj':\n new OBJLoader(manager).load(\n path,\n result => done(result),\n undefined,\n err => done(null, err)\n )\n break\n case 'dae':\n new ColladaLoader(manager).load(\n path,\n result => done(result.scene),\n undefined,\n err => done(null, err)\n )\n break\n case 'stl':\n new STLLoader(manager).load(\n path,\n result => {\n const material = new THREE.MeshPhongMaterial()\n const mesh = new THREE.Mesh(result, material)\n done(mesh)\n },\n undefined,\n err => done(null, err)\n )\n break\n }\n }\n\n // initialize first camera position\n var { initCameraPosX = 1, initCameraPosY = 1, initCameraPosZ = 1 } = this.state\n element.camera.position.set(initCameraPosX, initCameraPosY, initCameraPosZ)\n }\n\n dispose() {\n super.dispose()\n }\n\n /*\n * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,\n * 그에 따른 html element의 반영이 필요한 부분을 구현한다.\n *\n * ThingsComponent state => HTML element properties\n */\n setElementProperties(element: URDFManipulatorElement) {\n var {\n package: _package,\n urdf,\n displayShadow,\n ignoreLimits,\n up,\n ambientColor,\n highlightColor,\n noAutoRecenter,\n disableDragging,\n noCameraControl,\n angles\n } = this.state\n\n element.style.pointerEvents = 'auto' //'inherit'\n\n element.package = _package\n element.urdf = urdf\n element.displayShadow = displayShadow\n element.ignoreLimits = ignoreLimits\n element.up = up\n element.ambientColor = ambientColor\n element.highlightColor = highlightColor\n element.noAutoRecenter = noAutoRecenter\n element.disableDragging = disableDragging\n element.controls.enabled = !noCameraControl\n element.angles = angles\n\n requestAnimationFrame(() => element.redraw())\n }\n\n /*\n * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.\n * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.\n */\n reposition() {\n super.reposition()\n }\n\n get tagName() {\n return 'urdf-viewer'\n }\n\n get angles() {\n // return this.element.angles\n return this.state.angles\n }\n\n set angles(angles) {\n // this.element.angles = angles\n this.setState({ angles })\n }\n\n get highlightColor() {\n return this.state.highlightColor\n }\n\n set highlightColor(highlightColor: string) {\n this.setState({ highlightColor })\n }\n\n onchange(after: Properties, before: Properties) {\n if ('initCameraPosX' in after || 'initCameraPosY' in after || 'initCameraPosZ' in after) {\n const { initCameraPosX = 1, initCameraPosY = 1, initCameraPosZ = 1 } = this.state\n this.element &&\n (this.element as URDFManipulatorElement).camera.position.set(initCameraPosX, initCameraPosY, initCameraPosZ)\n }\n\n super.onchange && super.onchange(after, before)\n }\n}\n\nComponent.register('urdf-viewer', UrdfViewer)\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/scene-urdf",
3
3
  "description": "Scene module for manipulating robot simulation through URDF format",
4
4
  "author": "heartyoh",
5
- "version": "8.0.0-beta.2",
5
+ "version": "8.0.1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "license": "MIT",
@@ -27,8 +27,8 @@
27
27
  "migration": "things-factory-migration"
28
28
  },
29
29
  "dependencies": {
30
- "@hatiolab/things-scene": "^8.0.0-beta",
31
- "@operato/styles": "^8.0.0-beta",
30
+ "@hatiolab/things-scene": "^3.4.0",
31
+ "@operato/styles": "^8.0.0",
32
32
  "lit": "^3.1.2",
33
33
  "three": "^0.164.0",
34
34
  "urdf-loader": "^0.10.4",
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@hatiolab/prettier-config": "^1.0.0",
39
- "@things-factory/builder": "^8.0.0-beta",
40
- "@things-factory/operato-board": "^8.0.0-beta",
39
+ "@things-factory/builder": "^8.0.0",
40
+ "@things-factory/operato-board": "^8.0.0",
41
41
  "@types/three": "^0.159.0",
42
42
  "@types/tinycolor2": "^1.4.3",
43
43
  "@typescript-eslint/eslint-plugin": "^4.33.0",
@@ -64,5 +64,5 @@
64
64
  "prettier --write"
65
65
  ]
66
66
  },
67
- "gitHead": "d6329b4f15ae63c2a99ec5b58ee1d527e88a4c36"
67
+ "gitHead": "daedde221bb0afaa12079e47f12660921e960672"
68
68
  }
@@ -1,5 +1,5 @@
1
- import editors from './dist/editors'
2
- import templates from './dist/templates'
1
+ import editors from './dist/editors/index.js'
2
+ import templates from './dist/templates/index.js'
3
3
 
4
4
  export default {
5
5
  templates,