Ask Your Question
0

Where can I find the actual source code for the tf2 demo?

asked 2019-10-04 10:20:31 -0600

pitosalas gravatar image

I am trying to understand and modify the code for http://wiki.ros.org/tf2/Tutorials/Int...

I have done roscd for all the packages that are named (around five of them as I follow the trail) and none of them have any source code. They have .launch, .msg, .xml files but no .cpp or .py files. So I am stumped in this case, and also curious about the general case. There must be something about package structure that I am missing. Thanks,

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2019-10-04 11:09:24 -0600

gvdhoorn gravatar image

updated 2019-10-04 11:10:11 -0600

Where can I find the actual source code for the tf2 demo?

At the bottom of the page of the tutorial you link, there is this:

Now that we have examined the turtle_tf2_demo, let's look at how to write the broadcaster (Python) (C++) for this demo.

Following that link, we come to the Writing a tf2 broadcaster (Python) page and the Create a learning_tf2 package section states (emphasis mine):

First we will create a catkin package that will be used for this tutorial and the following ones. This package called learning_tf2 will depend on tf2, tf2_ros, roscpp, rospy and turtlesim. Code for this tutorial is stored here.

I'm not entirely sure which "tf2 demo" you refer to, but it would seem there is at least a link to the turtle_tf2 package.

Note that both the Python and the C++ sources are hosted by that same package.

I have done roscd for all the packages that are named (around five of them as I follow the trail) and none of them have any source code. They have .launch, .msg, .xml files but no .cpp or .py files.

Packages you install using apt or apt-get (as instructed by the Installing the Demo section) never include source code -- or at least: it'd be rarely the case.

roscd takes you to the package directory, which is the directory which contains the manifest (ie: package.xml). For packages installed using apt, that is the directory in /opt/ros/$distro/share. Only resources are installed there, no binaries, libraries, headers or source code.

(I write "never", but in reality a package author can do whatever he wants, including installing source code in locations where you'd normally only find binaries. It would be highly irregular and undesirable though)

edit flag offensive delete link more

Comments

Thanks... Useful tips.

pitosalas gravatar imagepitosalas ( 2019-10-07 08:33:34 -0600 )edit
1

answered 2019-10-04 11:16:22 -0600

jdlangs gravatar image

Two points:

  • For installed packages, roscd takes you to the share/ directory of the package which is where everything that's not source code will be residing. Things like C++ headers and python code will get installed according to linux filesystem hierarchy conventions beneath the overall ROS distribution directory (e.g, /opt/ros/melodic/include and /opt/ros/melodic/lib/python2.7/dist-packages)

  • Installed packages generally only include compiled libraries and executables, and not C++ source files (though maybe they should for tutorials). To see the source code, you need to either browse it online or clone it on to your machine. In this case, the code is available here: https://github.com/ros/geometry_tutor...

edit flag offensive delete link more

Comments

Thanks. Useful summary!

pitosalas gravatar imagepitosalas ( 2019-10-07 08:33:44 -0600 )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

1 follower

Stats

Asked: 2019-10-04 10:20:31 -0600

Seen: 44 times

Last updated: Oct 04