Socket
Socket
Sign inDemoInstall

urdf-loader

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urdf-loader - npm Package Compare versions

Comparing version 0.9.4 to 0.9.5

2

CHANGELOG.md

@@ -7,3 +7,3 @@ # Changelog

## [0.9.4] - 2021-01-26
## [0.9.5] - 2021-01-26
### Added

@@ -10,0 +10,0 @@ - Support for "mimic" joints.

{
"name": "urdf-loader",
"version": "0.9.4",
"version": "0.9.5",
"description": "URDF Loader for THREE.js and webcomponent viewer",

@@ -5,0 +5,0 @@ "main": "umd/URDFLoader.js",

@@ -0,0 +0,0 @@ (function (global, factory) {

@@ -0,0 +0,0 @@ (function (global, factory) {

@@ -125,2 +125,4 @@ (function (global, factory) {

this.mimicJoints = [];
}

@@ -144,2 +146,4 @@

this.mimicJoints = [...source.mimicJoints];
return this;

@@ -161,2 +165,10 @@

let didUpdate = false;
this.mimicJoints.forEach(joint => {
didUpdate = joint.updateFromMimickedJoint(...values) || didUpdate;
});
switch (this.jointType) {

@@ -166,3 +178,3 @@

return false;
return didUpdate;

@@ -174,4 +186,4 @@ }

let angle = values[0];
if (angle == null) return false;
if (angle === this.jointValue[0]) return false;
if (angle == null) return didUpdate;
if (angle === this.jointValue[0]) return didUpdate;

@@ -197,3 +209,3 @@ if (!this.ignoreLimits && this.jointType === 'revolute') {

return false;
return didUpdate;

@@ -207,4 +219,4 @@ }

let pos = values[0];
if (pos == null) return false;
if (pos === this.jointValue[0]) return false;
if (pos == null) return didUpdate;
if (pos === this.jointValue[0]) return didUpdate;

@@ -229,3 +241,3 @@ if (!this.ignoreLimits) {

return false;
return didUpdate;

@@ -243,3 +255,3 @@ }

return false;
return didUpdate;

@@ -250,2 +262,43 @@ }

class URDFMimicJoint extends URDFJoint {
constructor(...args) {
super(...args);
this.type = 'URDFMimicJoint';
this.mimicJoint = null;
this.offset = 0;
this.multiplier = 1;
}
updateFromMimickedJoint(...values) {
const modifiedValues = values.map(x => x * this.multiplier + this.offset);
return super.setJointValue(...modifiedValues);
}
/* Overrides */
setJointValue(...values) {
console.warn(`URDFMimicJoint: Setting the joint value of mimic joint "${ this.urdfName }" will cause it to be out of sync.`);
return super.setJointValue(...values);
}
/* Overrides */
copy(source, recursive) {
super.copy(source, recursive);
this.mimicJoint = source.mimicJoint;
this.offset = source.offset;
this.multiplier = source.multiplier;
return this;
}
}
class URDFRobot extends URDFLink {

@@ -630,2 +683,38 @@

// Link up mimic joints
const jointList = Object.values(jointMap);
jointList.forEach(j => {
if (j instanceof URDFMimicJoint) {
jointMap[j.mimicJoint].mimicJoints.push(j);
}
});
// Detect infinite loops of mimic joints
jointList.forEach(j => {
const uniqueJoints = new Set();
const iterFunction = joint => {
if (uniqueJoints.has(joint)) {
throw new Error('URDFLoader: Detected an infinite loop of mimic joints.');
}
uniqueJoints.add(joint);
joint.mimicJoints.forEach(j => {
iterFunction(j);
});
};
iterFunction(j);
});
obj.frames = {

@@ -647,3 +736,19 @@ ...colliderMap,

const jointType = joint.getAttribute('type');
const obj = new URDFJoint();
let obj;
const mimicTag = children.find(n => n.nodeName.toLowerCase() === 'mimic');
if (mimicTag) {
obj = new URDFMimicJoint();
obj.mimicJoint = mimicTag.getAttribute('joint');
obj.multiplier = parseFloat(mimicTag.getAttribute('multiplier') || 1.0);
obj.offset = parseFloat(mimicTag.getAttribute('offset') || 0.0);
} else {
obj = new URDFJoint();
}
obj.urdfNode = joint;

@@ -682,3 +787,2 @@ obj.name = joint.getAttribute('name');

}
});

@@ -685,0 +789,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc