Skip to content

Instantly share code, notes, and snippets.

@AustinDeric
Last active April 25, 2018 18:11
Show Gist options
  • Save AustinDeric/f6b7ccaf24cffedea7d6c5a5eb61aa2b to your computer and use it in GitHub Desktop.
Save AustinDeric/f6b7ccaf24cffedea7d6c5a5eb61aa2b to your computer and use it in GitHub Desktop.
ROS3D React Component - test code
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