Last active
April 25, 2018 18:11
-
-
Save AustinDeric/f6b7ccaf24cffedea7d6c5a5eb61aa2b to your computer and use it in GitHub Desktop.
ROS3D React Component - test code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import {Viewer, Grid, UrdfClient} from 'ros3d'; | |
import ROSLIB from 'roslib'; | |
export default class Simulator extends Component { | |
constructor(props) { | |
super(props); | |
} | |
componentDidMount() { | |
var ros = new ROSLIB.Ros({ | |
url : 'wss://localhost:9090' | |
}); | |
var viewer = new Viewer({ | |
divID : 'urdf', | |
width : 800, | |
height : 600, | |
antialias : true | |
}); | |
viewer.addObject(new Grid()); | |
var tfClient = new ROSLIB.TFClient({ | |
ros : ros, | |
angularThres : 0.01, | |
transThres : 0.01, | |
rate : 10.0 | |
}); | |
var urdfClient = new UrdfClient({ | |
ros : ros, | |
tfClient : tfClient, | |
path : 'https://localhost/meshes', | |
rootObject : viewer.scene, | |
}); | |
} | |
render() { | |
return ( | |
<div> | |
<div> | |
<div className='urdfdiv' id='urdf'/> | |
</div> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment