urdf-loader
Advanced tools
Comparing version 0.7.1 to 0.7.2
{ | ||
"name": "urdf-loader", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "URDF Loader for THREE.js and webcomponent viewer", | ||
@@ -41,3 +41,3 @@ "main": "umd/URDFLoader.js", | ||
"peerDependencies": { | ||
"three": "^0.105.0" | ||
"three": ">=0.105.0" | ||
}, | ||
@@ -52,3 +52,3 @@ "devDependencies": { | ||
"opn-cli": "^3.1.0", | ||
"puppeteer": "^1.7.0", | ||
"puppeteer": "^1.19.0", | ||
"puppeteer-to-istanbul": "^1.2.2", | ||
@@ -55,0 +55,0 @@ "rollup": "^0.66.6", |
259
README.md
@@ -13,57 +13,34 @@ # javascript urdf-loader | ||
## Use | ||
```html | ||
<script src=".../URDFLoader.js"></script> | ||
<script> | ||
const manager = new THREE.LoadingManager(); | ||
const loader = new URDFLoader(manager); | ||
loader.load( | ||
'T12/urdf/T12.URDF', // The path to the URDF within the package OR absolute | ||
robot => { }, // The robot is loaded! | ||
{ | ||
packages: { | ||
packageName : '.../package/dir/' // The equivalent of a (list of) ROS package(s):// directory | ||
}, | ||
loadMeshCb: (path, manager, done) => { }, // Callback for each mesh for custom mesh processing and loading code | ||
} | ||
); | ||
</script> | ||
# Use | ||
```js | ||
import { LoadingManager } from 'three'; | ||
import URDFLoader from 'urdf-loader'; | ||
const manager = new LoadingManager(); | ||
const loader = new URDFLoader(manager); | ||
loader.load( | ||
'T12/urdf/T12.URDF', // The path to the URDF within the package OR absolute | ||
robot => { }, // The robot is loaded! | ||
{ | ||
packages: { | ||
packageName : '.../package/dir/' // The equivalent of a (list of) ROS package(s):// directory | ||
}, | ||
loadMeshCb: (path, manager, done) => { }, // Callback for each mesh for custom mesh processing and loading code | ||
} | ||
); | ||
``` | ||
### Limitations | ||
## Limitations | ||
- Only `prismatic`, `continuous`, `revolute`, and `fixed` joints are supported. | ||
## URDFLoader API | ||
### constructor(manager) | ||
# API | ||
Constructor | ||
## URDFOptions | ||
#### manager : THREE.LoadingManager | ||
### .packages | ||
THREE.LoadingManager. Used for transforming load URLs. | ||
```js | ||
packages = '' : String | Object | ||
``` | ||
### load(urdfpath, onComplete, options) | ||
Loads and builds the specified URDF robot in THREE.js | ||
#### urdfpath : String | ||
_required_ | ||
The path to the URDF file relative to the specified package directory. | ||
#### onComplete(robot) : Function | ||
_required_ | ||
Callback that is called once the urdf robots have been loaded. The loaded robot is passed to the function. | ||
See `URDFRobot` documentation. | ||
#### options : Object | ||
_optional_ | ||
##### options.packages : String | Object | ||
The path representing the `package://` directory(s) to load `package://` relative files. | ||
@@ -82,4 +59,13 @@ | ||
##### options.loadMeshCb(pathToModel, manager, onComplete) : Function | ||
### .loadMeshCb | ||
```js | ||
loadMeshCb = null : | ||
( | ||
pathToModel : string, | ||
manager : LoadingManager, | ||
onComplete : ( obj : Object3D ) => void | ||
) => void | ||
``` | ||
An optional function that can be used to override the default mesh loading functionality. The default loader is specified at `URDFLoader.defaultMeshLoader`. | ||
@@ -93,8 +79,16 @@ | ||
##### options.fetchOptions : Object | ||
### .fetchOptions | ||
```js | ||
fetchOptions : Object | ||
``` | ||
An optional object with the set of options to pass to the `fetch` function call used to load the URDF file. | ||
##### options.workingPath : String | ||
### .workingPath | ||
```js | ||
workingPath : string | ||
``` | ||
The path to load geometry relative to. | ||
@@ -104,90 +98,157 @@ | ||
##### options.parseVisual : Boolean | ||
### .parseVisual | ||
```js | ||
parseVisual : boolean | ||
``` | ||
An optional value that can be used to enable / disable loading meshes for links from the `visual` nodes. Defaults to true. | ||
##### options.parseCollision : Boolean | ||
### .parseCollision | ||
```js | ||
parseCollision : boolean | ||
``` | ||
An optional value that can be used to enable / disable loading meshes for links from the `collision` nodes. Defaults to false. | ||
### parse(urdfContent, options) : THREE.Object3D | ||
## URDFLoader | ||
Parses URDF content and returns the robot model. | ||
### .constructor | ||
#### urdfContent : String | ||
```js | ||
constructor( manager : LoadingManager ) | ||
``` | ||
_required_ | ||
Constructor. Manager is used for transforming load URLs and tracking downloads. | ||
The xml content of a URDF file. | ||
### .load | ||
#### onComplete(robot) : Function | ||
```js | ||
load( | ||
urdfpath : string, | ||
onComplete : (robot: URDFRobot) => void, | ||
options = null : URDFOptions | ||
) : void | ||
``` | ||
_optional_ | ||
Loads and builds the specified URDF robot in THREE.js. | ||
Called immediately with the generated robot. This is the same object that is returned from the function. | ||
Takes a path to load the urdf file from, a func to call when the robot has loaded, and a set of options. | ||
Note that the link geometry will not necessarily have finished being processed when this is called. | ||
### .parse | ||
See `URDFRobot` documentation. | ||
```js | ||
parse( urdfContent : string, options = null : URDFOptions) : URDFRobot | ||
``` | ||
#### options : Object | ||
Parses URDF content and returns the robot model. Takes an XML string to parse and a set of options. | ||
See `load`. | ||
Note that geometry will not necessarily be loaded when the robot is returned. | ||
## URDFJoint : THREE.Object3D | ||
## URDFJoint | ||
_extends Object3D_ | ||
An object representing a robot joint. | ||
#### name : String | ||
### .name | ||
```js | ||
name : string | ||
``` | ||
The name of the joint. | ||
#### jointType : String | ||
### .jointType | ||
```js | ||
.jointType : string | ||
``` | ||
The type of joint. Can only be the URDF types of joints. | ||
#### limit : Object | ||
### .limit | ||
```js | ||
.limit : { lower : number, upper : number } | ||
``` | ||
An object containing the `lower` and `upper` constraints for the joint. | ||
#### axis : THREE.Vector3 | ||
### .axis | ||
```js | ||
axis : Vector3 | ||
``` | ||
The axis described for the joint. | ||
#### angle : Number | ||
### .angle | ||
_readonly_ | ||
```js | ||
angle : number | ||
``` | ||
The current position or angle for joint. | ||
#### ignoreLimits : Boolean | ||
### .ignoreLimits | ||
```js | ||
ignoreLimits : boolean | ||
``` | ||
Whether or not to ignore the joint limits when setting a the joint position. | ||
### setAngle(angle) | setOffset(position) | ||
### .setAngle, .setOffset | ||
#### angle | position : Number | ||
```js | ||
setAngle( angle : number ) : void | ||
setOffset( position : number ) : void | ||
``` | ||
The position off of the starting position to rotate or move the joint to. | ||
Takes the position off of the starting position to rotate or move the joint to. | ||
## URDFLink : THREE.Object3D | ||
## URDFLink | ||
#### name | ||
_extends Object3D_ | ||
### .name | ||
```js | ||
name : string | ||
``` | ||
The name of the link. | ||
## URDFRobot : URDFLink | ||
## URDFRobot | ||
_extends [URDFLink](#URDFLink)_ | ||
Object that describes the URDF Robot. | ||
#### robotName : String | ||
### .robotName | ||
```js | ||
robotName : string | ||
``` | ||
The name of the robot described in the `<robot>` tag. | ||
#### links : Object | ||
### .links | ||
```js | ||
links : { [key] : URDFLink } | ||
``` | ||
A dictionary of `linkName : URDFLink` with all links in the robot. | ||
#### joints : Object | ||
### .joints | ||
```js | ||
joints : { [key] : URDFJoint } | ||
``` | ||
A dictionary of `jointName : URDFJoint` with all joints in the robot. | ||
@@ -271,4 +332,8 @@ | ||
#### angles | ||
#### .angles | ||
```js | ||
angles : Object | ||
``` | ||
Sets or gets the angles of the robot as a dictionary of `joint-name` to `radian` pairs. | ||
@@ -278,16 +343,32 @@ | ||
#### setAngle(jointName, angle) | ||
#### setAngle | ||
```js | ||
setAngle( jointName : string, angle : Number ) : void | ||
``` | ||
Sets the given joint to the provided angle in radians. | ||
#### setAngles(jointDictionary) | ||
#### .setAngles | ||
```js | ||
setAngles( jointDictionary : Object ) : void | ||
``` | ||
Sets all joint names specified as keys to radian angle value. | ||
#### redraw() | ||
#### .redraw | ||
```js | ||
redraw() : void | ||
``` | ||
Dirty the renderer so the element will redraw next frame. | ||
#### recenter() | ||
#### .recenter | ||
```js | ||
recenter() : void | ||
``` | ||
Recenter the camera to the model and redraw. | ||
@@ -313,3 +394,3 @@ | ||
## Running the Example | ||
# Running the Example | ||
@@ -328,6 +409,4 @@ Install Node.js and NPM. | ||
Copyright © 2018 California Institute of Technology. ALL RIGHTS | ||
RESERVED. United States Government Sponsorship Acknowledged. Any | ||
commercial use must be negotiated with with Office of Technology | ||
Transfer at the California Institute of Technology. This software may | ||
Copyright © 2019 California Institute of Technology. ALL RIGHTS | ||
RESERVED. United States Government Sponsorship Acknowledged. This software may | ||
be subject to U.S. export control laws. By accepting this software, | ||
@@ -334,0 +413,0 @@ the user agrees to comply with all applicable U.S. export laws and |
@@ -0,0 +0,0 @@ (function (global, factory) { |
@@ -0,0 +0,0 @@ (function (global, factory) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
413
2
248896
18
2830