ros3djs
ros3djs copied to clipboard
Use our own URDF
Is there a way to use our own URDF with ros3djs ? If yes, maybe we could add another tutorial with all the details about using our own URDF .
You can use whatever URDF you want with ros3djs. Of course if it is well formed and has no errors. If you can use it on gazebo, or visualize it on RViz, you can certainly use it with ros3djs. The usual tutorial is sufficient. What is precisely your issue?
URDF works on RViz, for ros3djs, what must be written for the path
in the ROS3D.UrdfClient
? And like the tutorial for pr2, do we have to run some lines to make everything work ?
You have to put first your robot_description folder (the one which contains your robot meshes) in a HTTP server (Apache for example), then put the url of your folder in the path
. For example if you put robot_description in the root of Apache server the path
would be:
path : 'http://10.3.66.109/'
10.3.66.109 being the address of your Apache server.
The only lines you should pay attention to are:
frameID
in ROS3D.UrdfClient
which is the root frame of your urdf model
fixedFrame
in ROSLIB.TFClient
which is the root frame of all you TF tree
I do strongly recommend making a new tutorial or adjusting the current one. My team first attempted to get this working a year ago and promptly gave up. After solving multiple issues I finally got everything working but it wasn't easy. Here are two things which will help specifically with hosting your own URDF:
We use Flask to host a server and didn't want to have two copies of the same package existing simultaneously. Because of this, instead of copying the package to the server, we created a custom url /static/model
from which Flask would serve the model directly from our catkin workspace rospackages
:
@app.route('/static/model/<path:filename>')
def serveArmModel(filename):
"""Lets ros3djs access the meshes used to render the arm model"""
return flask.send_from_directory('../rospackages/src/', filename)
Another thing we did to ease the process was to make a launch file which sets everything up for us. Since we use URDF and not xacro we use textfile
instead of command
:
<launch>
<!-- this next node sends asimov urdf to param server -->
<param name="robot_description" textfile="$(find asimov_simplified)/urdf/asimov_simplified.urdf" />
<param name="use_gui" type="bool" value="true" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<!-- this next node gives control over the joints -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="tf2_web_republisher" pkg="tf2_web_republisher" type="tf2_web_republisher" />
</launch>