ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Possible alternatives to ROS tf2

asked 2017-01-11 12:23:26 -0600

solomoon gravatar image

I am currently looking for a C++ coordinate transformation library to use. I have read through the ROS tf2 and found it to be a powerful library that can fit my use case well. The only concern is that tf2 seems to be coupled with ROS infra (a ROS core, its pubsub system, catkin build system, etc) pretty tightly, which is a little too heavy to our project. I am wondering if it's possible to use tf2 standalone w/o introducing the whole ROS or anyone happens to know some other library that could somehow reach feature parity with tf2. I have only one moving coordinate frame with a few static coordinate frames, so maybe the tree structure of tf2 is also a little overkill to me. Thanks a ton in advance!

edit retag flag offensive close merge delete

Comments

tf1 was specifically modified to produce tf2 in order to make its core independent of ROS. What is your problem with using it standalone?

joq gravatar image joq  ( 2017-01-11 14:51:19 -0600 )edit

I haven't looked into tf2 core yet. Is there any documentation on how to use it standalone?

solomoon gravatar image solomoon  ( 2017-01-11 15:07:53 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2017-01-11 16:15:35 -0600

tfoote gravatar image

updated 2017-01-11 16:34:48 -0600

As @joq linked to the design doc: http://wiki.ros.org/tf2/Design

tf2 is designed to be ROS independent. The dependencies for the tf2 package are specifically limited. https://github.com/ros/geometry2/blob...

We haven't taken the time to package it up separately as there hasn't been much demand and would potentially add overhead to running within ROS.

Here are what's needed to pull it out as a pure library.

  • libconsole-bridge is a ROS independent console output library.
  • tf2_msgs is only used for error enumerations and can be replaced by copying the generated header file
  • geometry_msgs datatypes are used for data storage. A truely ros independent version would need to copy a few message header files or implement their own replacement data storage type.
  • rostime is the primative datatype for time in the above messages and is thus included

  • It uses the catkin cmake package which is technically independent of ROS and can be used if installed as a pure cmake package. If catkin is installed you can call (mkdir build && cd build && cmake .. && make)

As an approach to using it I would recommend installing catkin and libconsole-bridge as dependencies. The quick solution for converting the datatypes is to copy the generated ROS message headers. The slightly longer solution is to use a different data representation in the public API.

The other relatively simple solution is to install tf2 with it's existing dependencies. You only need to install the message runtime packages and catkin which is 17 packages taking up a total space of 5,244 kB using indigo. a 5MB size is a pretty small footprint to further optimize. Depending on how you measure it it is ROS independent as it has none of the ROS communication middleware dependencies. It just uses datatypes defined using the ROS msg format.

root@b2baa96c3317:/# sudo apt-get install ros-indigo-tf2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  binfmt-support comerr-dev krb5-multidev libapr1-dev libaprutil1-dev libblas3
  libbz2-dev libgfortran3 libgssrpc4 libkadm5clnt-mit9 libkadm5srv-mit9
  libkdb5-7 liblapack3 libldap2-dev liblog4cxx10 liblog4cxx10-dev liblz4-1
  liblz4-dev libmysqlclient-dev libmysqlclient18 libodbc1 libpcre3-dev
  libpcrecpp0 libpipeline1 libpoco-dev libpococrypto9 libpocodata9
  libpocofoundation9 libpocomysql9 libpoconet9 libpoconetssl9 libpocoodbc9
  libpocosqlite9 libpocoutil9 libpocoxml9 libpocozip9 libpq-dev libpq5
  libsctp-dev libsctp1 libsqlite3-dev libssl-dev libssl-doc libtinyxml-dev
  libtinyxml2.6.2 lksctp-tools mysql-common python-dev python-netifaces
  python-numpy python-setuptools python-wstool python2.7-dev sbcl uuid-dev
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  ros-indigo-actionlib-msgs ros-indigo-catkin ros-indigo-cpp-common
  ros-indigo-gencpp ros-indigo-genlisp ros-indigo-genmsg ros-indigo-genpy
  ros-indigo-geometry-msgs ros-indigo-message-generation
  ros-indigo-message-runtime ros-indigo-roscpp-serialization
  ros-indigo-roscpp-traits ros-indigo-rostime ros-indigo-std-msgs
  ros-indigo-tf2-msgs
The following NEW packages will be installed:
  ros-indigo-actionlib-msgs ros-indigo-catkin ros-indigo-cpp-common
  ros-indigo-gencpp ros-indigo-genlisp ros-indigo-genmsg ros-indigo-genpy
  ros-indigo-geometry-msgs ros-indigo-message-generation
  ros-indigo-message-runtime ros-indigo-roscpp-serialization
  ros-indigo-roscpp-traits ros-indigo-rostime ros-indigo-std-msgs
  ros-indigo-tf2 ros-indigo-tf2-msgs
0 upgraded, 16 newly installed, 0 to remove and 8 not upgraded.
Need to get 574 kB of archives.
After this operation, 5,244 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://packages.ros.org/ros/ubuntu/ trusty/main ros-indigo-catkin amd64 0.6.18-0trusty-20160321-102905-0700 [111 kB]
Get ...
(more)
edit flag offensive delete link more

Comments

Thanks for your thorough answer! I noticed that there's a ros2 branch of tf2 that cuts ros dependency even further (only depends on geometry_msgs and the new build system). Is that in a stable state that can be used as well?

solomoon gravatar image solomoon  ( 2017-01-11 18:37:51 -0600 )edit

That is not a stable branch it was a proof of concept for using a library on top of ros2. It might be a good jumping off point for a minor refactor. But I'd like to reiterate that I'd suggest that you just use this as is. The current dependencies are pretty much nominal.

tfoote gravatar image tfoote  ( 2017-01-11 20:28:24 -0600 )edit

@solomoon Any success making TF2 independent of ROS ?

babu gravatar image babu  ( 2017-02-24 02:01:01 -0600 )edit

Hello All, I am new to this. I tried to use TF2 independently by considering dependency with libconsole-bridge, tf2_msgs, geometry_msgs, rostime . But while compiling I am getting below error.

https://gist.github.com/anonymous/77f...

Any thought on this error ?

babu gravatar image babu  ( 2017-02-26 12:46:34 -0600 )edit

Hi, since the discussion is now few months old, I was wondering if there are any updates on this topic, especially about the testing branch mentioned above, and if some kind of updated tutorials are available about how to compile tf2 as a stand alone library. Thank you!

randaz gravatar image randaz  ( 2017-06-29 23:18:26 -0600 )edit
0

answered 2017-01-11 15:53:24 -0600

joq gravatar image
edit flag offensive delete link more
0

answered 2018-12-23 06:49:23 -0600

khea_actua gravatar image

Following @tfoote answer, and some work I found someone at my company did with Indigo, I created a conan package for tf2 melodic

My Indigo branch uses the full ROS build, but this simply stopped working one day, so I built the Melodic branch by setting up an 18.04 VM, installing all the ROS dependencies, and then manually copying them into my checkout of ros/geometry2 (0.65) and re-writing the CMakeLists.txt file.

So, the obvious issue is that code in this repo will age, but for now it should help. I'm still testing this code on various platforms, but it seems to be working.

Hope this helps.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-11 12:23:26 -0600

Seen: 1,682 times

Last updated: Jan 11 '17