This is a JavaScript library for robotics data visualization using WebXR.
To run this example
-
Clone the repository
-
install ROS (everything here was tested using our Jasmine setup) found here
-
create an ssl keypair:
openssl req -x509 -newkey rsa:4096 -keyout server1.example.com.key -out server1.example.com.pem -days 365 -nodes
- remember the path to these files or move them to /etc/ssl/certs/localcerts/
- to move the files use
mv server1.example.com.key /etc/ssl/certs/localcerts/server1.example.com.key mv server1.example.com.pem /etc/ssl/certs/localcerts/server1.example.com.pem
- next you have to change the permissions to allow your python server to access the certificate
chmod 777 /etc/ssl/certs/localcerts/server1.example.com.key chmod 777 /etc/ssl/certs/localcerts/server1.example.com.pem chmod 777 /etc/ssl/certs/localcerts
TODO: change permissions to be less permissive
Note: we need SSL/https to be able to use WebXR -
Create a symlink from opt/hector/share/VRRobot to your cloned repository
- note this is a very specific step for this project. It's needed because our URDF are being returned with the python server with simple get requests
ln -s ~/VRRobot /opt/hector/share/VRRobot
-
Allow connections to your firewall
sudo ufw allow 9090 # for the websocket sudo ufw allow 8080 # for the webserver (you can choose any other port)
note for self signed certificates: before opening the simulation, you have to visit https://127.0.0.1:9090 and https://127.0.0.1:8080 - to accept the certificates
-
make your python server executable
chhmod +x ~/VRRobot/shttps.py
on a default TU setup you can install tmux - sudo apt install tmux
and just run: ~/VRRobot/dev-tmux
Manual Running
execute these commands in order (wait a few seconds after running roscore to initialize the environment)
roscore
rosrun tf2_web_republisher tf2_web_republisher
roslaunch rosbridge_server rosbridge_websocket.launch ssl:=true port:=9090 certfile:=/etc/ssl/certs/localcerts/server1.example.com.pem keyfile:=/etc/ssl/certs/localcerts/server1.example.com.key
- note that this assumes you have moved the files from the previous step
- in
/opt/hector/share
runVRRobot/shttps.py
- note that you need to run this in
opt/hector/share
so the correct 3D models can be delivered - note that you need to configure the
shttps.py
file
- note that you need to run this in
hector sim
and start the simulation or use bagfiles
Notes To record bagfiles:
rosbag record /tf /tf_static /joint_states /colored_cloud /map /smooth_path /trajectory /front_rgbd_cam/depth/color/points /colored_cloud_world
rosrun rqt_robot_steering rqt_robot_steering
and drive around
to add a visualization: use any ROS3DJS visualization. eg
var cloudClient = addVisualization(rootObjectNode,'cloudClient', ROS3D.PointCloud2,{
ros: ros,
tfClient: tfClient,
topic: '/colored_cloud',
material: { size: 0.05 },
colormap: colormap,
max_pts: 30000000,
decay:5
});
To add a controller you need to modify commons/mappings.js
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
- CORS Exceptions
go to https://127.0.0.1:8080 and not https://localhost:8080