RobotWebTools / ros3djs

3D Visualization Library for use with the ROS JavaScript Libraries
https://robotwebtools.github.io/ros3djs
Other
368 stars 216 forks source link

Change minimum step size for displaying changes in joint angle or position #282

Open joshua-glazer opened 5 years ago

joshua-glazer commented 5 years ago

I've figured out how to display a URDF of my team's robot arm in a webpage using ros3djs. I'm using joint_state_publisher to move the model. My issue is that the fingers have a small-ish displacement (0-20mm) and the viewer seems to only update the model in steps of about 10mm (0.01m).

If I echo the /joint_states topic I can see that I'm publishing fractional values such as 0.00255 so I'm relatively confident that it's not related to the joint_state_publisher. Is there any way to adjust the minimum step size in the javascript? I'm not sure what variable would need to be adjusted or whether there's an interface that I have access to for adjusting it.

MerAARIZOU commented 5 years ago

I think that in the tf2_web_republisher node there is a line which publishes new TFs only if TF(t) - TF(t-1) is less then 0.01. You can change that instruction and put your own threshold and it should probably be shown on your html page.

joshua-glazer commented 5 years ago

Ah, it was right under my nose. The thresholds are set when the tf client is created in the javascript:

let tfClient = new ROSLIB.TFClient({
    ros : ros,
    angularThres : 0.01,
    transThres : 0.01,
    rate : 10.0
  })

The webpage generates tf requests which contain the thresholds and the web republisher then catches the request in requestCB().