andreasbihlmaier / pysdf Goto Github PK
View Code? Open in Web Editor NEWPython library to parse SDF into class hierarchy and export URDF
Home Page: http://wiki.ros.org/pysdf
Python library to parse SDF into class hierarchy and export URDF
Home Page: http://wiki.ros.org/pysdf
Failed to find parent model_parent::link_1 of joint Joint_nested_model_link_to_parent_model_link. Aborting
The sdf file loads successfully in Gazebo9.
I have a sdf file that defines the mesh and a red color the following way:
sdf file:
<visual name='my_visual'>
<pose frame=''>0 0 0 0 0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>model://package/meshes/file.stl</uri>
</mesh>
</geometry>
<material>
<ambient>1 0 0 1</ambient>
<diffuse>1 0 0 1</diffuse>
<specular>1 0 0 1</specular>
</material>
</visual>
converted file:
<visual name="my_visual">
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://package/meshes/file.stl" scale="1 1 1"/>
</geometry>
</visual>
The urdf file does not have the color information. I had to define the color as a material and then add it after the sdf file is imported.
Color creation:
<material name="red_color">
<color rgba="1 0 0 1"/>
</material>
Usage:
<visual name="my_visual">
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://package/meshes/file.stl" scale="1 1 1"/>
</geometry>
<material name="red_color"/>
</visual>
It would be nice for the converter to recognize the tag (maybe others too) and add the material creation and usage.
Hi!
I'm trying to use this piece of code to convert an SDF file to URDF. I run this in the command line:
$ rosrun pysdf sdf2urdf.py model.sdf model.urdf
and it shows the parsed tree in the terminal but it doesn't print anything.
Thanks for your help!
Nadia
Hi! I'm trying to run sdf2urdf, but I'm getting the error:
Traceback (most recent call last):
File "/home/user/zephyr_ws/src/pysdf/scripts/sdf2urdf.py", line 6, in <module>
import pysdf
File "/home/user/zephyr_ws/devel/lib/python3/dist-packages/pysdf/__init__.py", line 34, in <module>
exec(__fh.read())
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'parse'
The problem occurs either with or without using ROS. Do you have any idea to fix it, please?
Hi I am trying to covert frrom sdf file to urdf
and getting this error
eyup@eyup-FLEXDEX304:~/catkin_ws4/src/iq_sim/models/iris_base$ rosrun pysdf sdf2urdf.py model.sdf model.urdf
Traceback (most recent call last):
File "/home/eyup/catkin_ws4/src/pysdf/scripts/sdf2urdf.py", line 31, in
main()
File "/home/eyup/catkin_ws4/src/pysdf/scripts/sdf2urdf.py", line 17, in main
sdf = pysdf.SDF(file=args.sdf)
TypeError: init(): incompatible constructor arguments. The following argument types are supported:
1. pysdf.SDF(verts: numpy.ndarray[numpy.float32[m, 3], flags.c_contiguous], faces: numpy.ndarray[numpy.uint32[m, 3], flags.c_contiguous], robust: bool = True, copy: bool = True)
Invoked with: kwargs: file='model.sdf'
any idea to fix it?
Hello,
I get the following console output from the program after and the process just hangs after that, does anyone have any solutions?
limit Tag missing from joint. Aborting.
Hi there,
I am getting the error
Traceback (most recent call last):
File "/Users/++++/pysdf/scripts/sdf2urdf.py", line 6, in
import pysdf
File "/Users/++++/opt/anaconda3/lib/python3.7/site-packages/pysdf/init.py", line 1, in
from parse import SDF, homogeneous2translation_quaternion, homogeneous2pose_msg, sdf2tfname, models_paths
ImportError: cannot import name 'SDF' from 'parse' (/Users/++++/opt/anaconda3/lib/python3.7/site-packages/parse.py)
Any idea on the cause?
Hello,
I am a robotics student trying to use this code and I am running into a similar issue as another error listed, except I am using this in ROS and it was installed in my catkin_ws/src area. I am new to ROS and was hoping to see if you could help me understand what this error is and how to fix it if you have time. I know that anaconda/ROS don't play well and it seems to be trying to use the parse python module from anaconda instead of the parse.py provided in your package. Any help or guidance would be greatly appreciated, I tried googling but couldn't find cases like this one.
I am running ROS melodic on Ubuntu Bionic 18.04 and do have anaconda3 installed as well for other projects I am working on (non ROS). I have tried commenting out the anaconda3/bin file path in my .bashrc file but that doesn't seem to fix it either. Thank you once again for any help you can provide.
Kind regards,
Heather
rosrun pysdf sdf2urdf.py plane.sdf plane.urdf
Traceback (most recent call last):
File "/home/afa/catkin_ws/src/pysdf/scripts/sdf2urdf.py", line 6, in
import pysdf
File "/home/afa/catkin_ws/devel/lib/python3/dist-packages/pysdf/init.py", line 34, in
exec(__fh.read())
File "", line 1, in
File "/home/afa/catkin_ws/src/pysdf/src/pysdf/parse.py", line 11, in
from tf.transformations import *
File "/opt/ros/noetic/lib/python3/dist-packages/tf/init.py", line 30, in
from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
File "/opt/ros/noetic/lib/python3/dist-packages/tf2_ros/init.py", line 38, in
from tf2_py import *
File "/opt/ros/noetic/lib/python3/dist-packages/tf2_py/init.py", line 38, in
from ._tf2 import *
ImportError: dynamic module does not define init function (init_tf2)
when I run command as followed, I find that cannot index the file that I want. what should I do to find this.
rosrun pysdf sdf2urdf.py /home/zsq/ROS/models/iris_with_standoffs_demo/model.sdf model.urdf
Error parsing SDF file /home/zsq/.gazebo/models/lunar_tranquillitatis_pit/model.sdf (XML or text declaration not at start of entity: line 2, column 0). Ignoring model and continuing.
Error parsing SDF file /home/zsq/.gazebo/models/lunar_tranquillitatis_pit/model-1_4.sdf (XML or text declaration not at start of entity: line 2, column 0). Ignoring model and continuing.
Error parsing SDF file /home/zsq/.gazebo/models/src_doorway/model.sdf (not well-formed (invalid token): line 761, column 12). Ignoring model and continuing.
Error parsing SDF file /home/zsq/.gazebo/models/submarine_sinking/model.sdf (not well-formed (invalid token): line 77, column 19). Ignoring model and continuing.
Error parsing SDF file /home/zsq/.gazebo/models/mpl_right_arm/model.sdf (XML or text declaration not at start of entity: line 16, column 0). Ignoring model and continuing.
Error parsing SDF file /home/zsq/.gazebo/models/submarine/model.sdf (not well-formed (invalid token): line 77, column 21). Ignoring model and continuing.
Error parsing SDF file /home/zsq/.gazebo/models/submarine_buoyant/model.sdf (not well-formed (invalid token): line 77, column 19). Ignoring model and continuing.
Error parsing SDF file /home/zsq/.gazebo/models/mpl_right_forearm/model.sdf (XML or text declaration not at start of entity: line 16, column 0). Ignoring model and continuing.
Failed to find included model (URI: iris_with_standoffs)
Failed to include model, see previous errors. Aborting.
what should I do to fix this problem?
paresh@paresh-VirtualBox:/Robocon2018/robots$ rosrun pysdf sdf2urdf.py Robocon2018.sdf robocon2018.urdf/Robocon2018/robots$
Traceback (most recent call last):
File "/home/paresh/catkin_ws/src/pysdf/scripts/sdf2urdf.py", line 31, in
main()
File "/home/paresh/catkin_ws/src/pysdf/scripts/sdf2urdf.py", line 17, in main
sdf = pysdf.SDF(file=args.sdf)
File "/home/paresh/catkin_ws/src/pysdf/src/pysdf/parse.py", line 162, in init
self.from_file(kwargs['file'])
File "/home/paresh/catkin_ws/src/pysdf/src/pysdf/parse.py", line 180, in from_file
self.world.from_tree(root, version=self.version)
File "/home/paresh/catkin_ws/src/pysdf/src/pysdf/parse.py", line 211, in from_tree
self.models += [Model(tree=model_node, version=self.version) for model_node in node.findall('model')]
File "/home/paresh/catkin_ws/src/pysdf/src/pysdf/parse.py", line 285, in init
self.from_tree(kwargs['tree'], **kwargs)
File "/home/paresh/catkin_ws/src/pysdf/src/pysdf/parse.py", line 348, in from_tree
self.joints = [Joint(self, tree=joint_node) for joint_node in node.iter('joint')]
File "/home/paresh/catkin_ws/src/pysdf/src/pysdf/parse.py", line 602, in init
self.from_tree(kwargs['tree'])
File "/home/paresh/catkin_ws/src/pysdf/src/pysdf/parse.py", line 625, in from_tree
super(Joint, self).from_tree(node)
File "/home/paresh/catkin_ws/src/pysdf/src/pysdf/parse.py", line 270, in from_tree
self.name = node.attrib['name']
KeyError: 'name'
paresh@paresh-VirtualBox:
Is there a ROS2 implementation of the pysdf library and gazebo2rviz repository?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.