hauptmech / odio_urdf Goto Github PK
View Code? Open in Web Editor NEWCreate URDF directly in python instead of wading through XML and Xacro
Create URDF directly in python instead of wading through XML and Xacro
Is there an already available BibTeX format for the repo that I can use to cite it. Thanks!
It would be great if when using "sequential style" you could pass in compatible types as args. So a link for a parent for example.
From your example:
my_robot = Robot()
link1 = Link() #name 'link1' will be used unless link1.name is set
my_robot(link1)
# Standard
base = Parent("link1")
joint1 = Joint(base, Child("link2"), type="continuous")
# What I propose
joint1 = Joint(link1, Child("link2"), type="continuous")
# Or
joint1 = Joint(Parent(link1), Child("link2"), type="continuous")
# Alternatively
base = Parent(link1)
joint1 = Joint(base, Child("link2"), type="continuous")
my_robot(joint1)
print(my_robot)
It can be kind of cumbersome to type out all the various strings of names, when they are already defined by links declared earlier.
This has particular use with how I am trying to use odio where the actual link names can be significantly longer than the logical names.
#1 (comment) points out correctly that the README example code does not do the right thing with unadorned strings passed to Parent and Child constructors.
Fix is to match strings up with the list of required attributes.
I read the existing URDF
file using the xml.etree.ElementTree
and converted it into an xml string using,
xmlstr = ET.tostring(root, encoding='utf8', method='xml')
However when I tried using the urdf_to_odio(urdf_string)
with it, it just returns the same string.
Could you please provide an example on loading an existing URDF
to add new tags to it or is there an example already available somewhere?
The returned string is in the odio_urdf DSL and copy pasting the entire string initialises the URDF in odio_urdf form and can be edited as needed
My issue is a bit more complicated than the title implies, but generally boils down to it.
I am trying to make a robot that pulls from multiple files. Those files provide a Group
back to the main file which aggregates them in a Robot
object. Some of those Group
files are defined entirely with odio, but some compose xacro files into odio by running xacro directly and storing the output.
The xacro_xml
arg that can be used with Robot
cannot be used here, as I have to use a group. Or I can use a Robot
and then discard the top level tags so I can convert it to a Group
but I can't figure out how to make that happen.
I've resorted to running xacro,parsing the result in element tree, iterating over it, appending it all to the xmltext of the group, then in the top level file doing
my_robot(my_group)
my_robot.xmltext += my_group.xmltext
but I'd like the group to be a fully fledged odio object. Am I missing something here?
Hi,
I install this package using the below comand for my application
pip install git+https://github.com/hauptmech/odio_urdf.git
It is failing from today with the below error. I am hoping this is due to the recent changes merged. Can you please advise on this ?
ERROR: Failed building wheel for odio-urdf
Running setup.py clean for odio-urdf
Failed to build odio-urdf
Installing collected packages: odio-urdf
Running setup.py install for odio-urdf ... error
ERROR: Command errored out with exit status 1:
command:venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-cteq9uv9/setup.py'"'"'; file='"'"'/tmp/pip-req-build-cteq9uv9/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ofubhb7u/install-record.txt --single-version-externally-managed --compile --install-headers /venv/include/site/python3.6/odio-urdf
cwd: /tmp/pip-req-build-cteq9uv9/
Complete output (15 lines):
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/odio_urdf
copying odio_urdf/init.py -> build/lib/odio_urdf
copying odio_urdf/main.py -> build/lib/odio_urdf
running install_lib
copying build/lib/odio_urdf/init.py -> /venv/lib/python3.6/site-packages/odio_urdf
copying build/lib/odio_urdf/main.py -> /venv/lib/python3.6/site-packages/odio_urdf
byte-compiling /venv/lib/python3.6/site-packages/odio_urdf/init.py to init.cpython-36.pyc
byte-compiling /venv/lib/python3.6/site-packages/odio_urdf/main.py to main.cpython-36.pyc
running install_egg_info
error: error in 'egg_base' option: '' does not exist or is not a directory
----------------------------------------
ERROR: Command errored out with exit status 1: /venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-cteq9uv9/setup.py'"'"'; file='"'"'/tmp/pip-req-build-cteq9uv9/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ofubhb7u/install-record.txt --single-version-externally-managed --compile --install-headers
I'm curious about how compatible this library is with xacro, specifically concerning macros.
I see there are a couple examples of importing xacro files, but none of those files have macros defined. If an included xacro file has a macro, is there any way for this library to parse that macro and allow the calling of that macro, allowing us to specify xacro macro arguments?
I would like to at least try this tool, but if it can't work with existing xacro macros that provides a significant barrier (as some of the macros I want to use are defined in packages I do not control, and would prefer to not remake them with this tool so any further changes to those external macros are properly updated without additional effort)
The example code in the readme crashes. This is the output:
Traceback (most recent call last):
File "/home/ags/python_modules/odio_urdf/test.py", line 5, in <module>
Link(name="link1"),
File "/usr/local/lib/python2.7/dist-packages/odio_urdf/__init__.py", line 315, in __init__
super().__init__(*args,**kwargs)
TypeError: super() takes at least 1 argument (0 given)
catkin_pkg
does not install automatically when pip install
invoked on this package (run with -e .
as there's no PyPi package).
I'd suggest using setuptools
or just mention it in the README.
Thanks!
Hello @hauptmech, long time no see!
Thanks for working on odio_urdf! A few members of my lab are using it. For reproducibility reasons, once we release the code related to a pubblication, we freeze/pin dependencies. Technically, we can do that with any commit, but for several reasons (mainly being able to get with version is use simply via pip list or similar) we prefer to depend on release/tag instead of just an arbitrary commit. So I was wondering if you were interested in making a tag out of the latest commit on master branch.
In any case, thanks a lot in advance!
ags@xxx:~/python_modules/odio_urdf/test$ ./test_coman
Traceback (most recent call last):
File "coman/coman.py", line 33, in <module>
grey = Material(Color(rgba="0.5 0.5 0.5 1"))
File "<string>", line 497, in __init__
NameError: global name 'self' is not defined
The same thing happens with python3 on my system:
ags@xxx:~/python_modules/odio_urdf/test/coman$ python3 coman.py
Traceback (most recent call last):
File "coman.py", line 33, in <module>
grey = Material(Color(rgba="0.5 0.5 0.5 1"))
File "<string>", line 497, in __init__
NameError: name 'self' is not defined
When trying to create new elements the end tag sometimes does not match the start tag. If I create a new element named hardwareInterface, the end tag makes hardwareinterface. As you can see it made the entire word lower case. It appears the code is changing it to lower case. Also the transmission joint tag comes through as follows: <joint name="joint_1>. I tried a work around by creating my own elements, then I ran into the code making my end tag lower case.
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.