Ask Your Question
0

Python TF/TF2 without ROS

asked 2018-09-18 12:09:19 -0500

Jari gravatar image

Okay that's kind of a shitty title, allow me to explain: for one of my "mostly python" projects (which was built initially using ROS conventions, catkin for the build system, and rosdep for dependency resolution) makes extensive use of TF but only to build and query an in memory transformation tree. I'm currently trying to chart a path to transition the project away from ROS and make it a python package (pip for dependency resolution, setuptools for build/deploy etc). I can probably make a library myself that replaces all the uses of TF but if there is already a "ROS free" version of TF or TF2 on PyPi (or in a state where it would be easy to put it on PyPi) that would save me a lot of time.

An alternative approach is to shamelessly copy tf2 and tf2_py from geometry2 and turn it into a python package. I've been considering that and I might end up doing that if the devops burden is less than the linear algebra burden of writing my own library.

Soooo yeah. Is there a TF or TF2 library already that I can install from apt or pip that doesn't need any other ROS dependencies? Thanks :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-09-18 14:03:21 -0500

tfoote gravatar image

The core tf2 library only has dependencies on a few ROS datatypes, but does not depend on the communication layer.

And the tf2_py bindings do add rospy but I believe that's only to access the rospy Time constructs. This likely could easily be stubbed out for you to package up. Or even better refactored to be in the rostime that the c++ implementation uses.

It's not packaged and release on PyPi with these changes already but it is designed that you you could relatively trivially fork the geometry2 repository and strip it down to just the elements you want by deleting the packages you don't want.

edit flag offensive delete link more

Comments

That is what I was leaning towards, just wanted to see if someone else had maybe already done it. No such luck I guess, will do it now.

Jari gravatar imageJari ( 2018-09-18 15:00:47 -0500 )edit

Okay, turns out I'm not a smart man and got too confused trying to de-ROS tf2. Ended up writing a python library that's very similar in interface. It works for my use case so far.

Jari gravatar imageJari ( 2018-10-02 10:14:50 -0500 )edit

@tfoote After removing the parts depending on pModulerospy from tf2_py.cpp, would the _tf2 binary have to be compiled for each OS to make it a library? I guess this touches upon releasing a Python package in general, but if you could shed some light on the next steps that may be helpful.

fvd gravatar imagefvd ( 2019-03-27 04:27:53 -0500 )edit

Yes, the _tf2 binary has to be compiled for your target platform. It's a c module which has a python accessible API.

tfoote gravatar imagetfoote ( 2019-03-27 18:40:07 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-09-18 12:09:19 -0500

Seen: 319 times

Last updated: Sep 18 '18