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

tf2 tutorial compile failure

asked 2021-10-13 10:57:44 -0500

bassline gravatar image

updated 2021-10-14 05:21:46 -0500

I am running Ubuntu 20.04.3 LTS and following the tf2 tutorials at https://docs.ros.org/en/foxy/Tutorial.... I have managed the static broadcaster OK but can not get the above link to compile. I have installed all the dependencies defined in the static broadcaster tutorial and get a far as Step 3 Build & run in the linked tutorial. However I can not get it to compile. I use the directory ros2_foxy as my equivalent of dev_ws so that I can more easily migrate to galactic. This is my .bashrc_ros which I link at the end of .bashrc whenever a new terminal is opened.

source /opt/ros/foxy/setup.bash

export ROS_DOMAIN_ID=1

cd /home/brian/ros2_foxy/

source install/local_setup.bash

This is the command I enter and the full output

brian@HP-notebook:~/ros2_foxy$ colcon build --symlink-install --packages-select learning_tf2_py Starting >>> learning_tf2_py Traceback (most recent call last):2_py - 0.2s]
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/distutils/core.py", line 215, in run_setup exec(f.read(), g) File "<string>", line 13, in <module> NameError: name 'os' is not defined --- stderr: learning_tf2_py Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__ rc = await self.task(args, *kwargs) File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__ return await task_method(args, *kwargs) File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 51, in build setup_py_data = get_setup_data(self.context.pkg, env) File "/usr/lib/python3/dist-packages/colcon_core/task/python/__init__.py", line 20, in get_setup_data return dict(pkg.metadatakey) File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 129, in getter return get_setup_information( File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 241, in get_setup_information _setup_information_cache[hashable_env] = _get_setup_information( File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 281, in _get_setup_information result = subprocess.run( File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup( 'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = {
key: value for key, value in dist.__dict__.items() if (
not key.startswith('_') and
not callable(value) and key not in skip_keys and key not in dist.display_option_names
)};data['metadata'] = { k: v for k, v in dist.metadata.__dict__.items()
if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1. --- Failed <<< learning_tf2_py [0.26s, exited with code 1]

Summary: 0 packages finished [0.36s]
1 package failed: learning_tf2_py 1 package had stderr output: learning_tf2_py Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup( 'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = {
key: value for key, value in dist.__dict__.items() if (
not key.startswith ...

(more)
edit retag flag offensive close merge delete

Comments

This looks like a Python environment problem. This is a complex topic, and I am not an expert, but I have screwed up my Python environment a few times. :-/ Try building inside a docker container like osrf/ros:foxy-desktop to see if it works there.

clyde gravatar image clyde  ( 2021-10-14 13:22:34 -0500 )edit

I have not used Docker so it will take me a while to familiarise myself with it and then set up an environment. I'll add the results later.

bassline gravatar image bassline  ( 2021-10-15 02:59:14 -0500 )edit

try to delete build/ install/ log/ then redo the colcon build

kak13 gravatar image kak13  ( 2021-10-15 11:57:02 -0500 )edit

Having the deleted the above directories I then get a "missing turtlesim" error on build. If I then build turtleseim and retry to build learning_tf2_py I get the same error.

bassline gravatar image bassline  ( 2021-10-15 12:44:44 -0500 )edit

you downloaded tf2_py from the github, right? If so, go in that directory and git branch then let me know what you see. I can help you on here in real time for next 20 minutes.

kak13 gravatar image kak13  ( 2021-10-15 12:46:14 -0500 )edit

I realised I had not tried the demo launch file in the static tutorial. This also fails with a similar message. Plan of attack :- 1. Retry everything on a pi4+ with 4Gb to eliminate environment issues 2. Boot laptop to Windows to check for firmware updates (laptop < 1 yr old) 3. Continue Docker training raising issues on their forums. As I have other things to do this may take several days.

bassline gravatar image bassline  ( 2021-10-16 02:06:34 -0500 )edit

bad news is that it failed on the Pi4 with the same error. Firmware update were made to the laptop with the same result. Pausing to think it through and later try to sort docker (where I will raise issues on their site)

bassline gravatar image bassline  ( 2021-10-16 04:14:13 -0500 )edit

Ah, hold off on the docker idea. I mislead you. I just ran the tutorial and was able to re-create your problem. I don't have any experience building Python-only ROS2 packages, so it might take me a while to figure out the bug, but at this point I think it's a bug in the tutorial. (Any other ROS Python power-users feel free to jump in!)

clyde gravatar image clyde  ( 2021-10-16 14:07:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-10-16 14:30:03 -0500

clyde gravatar image

The tutorial is missing some key instructions for modifying setup.py. Add these lines to the top of setup.py:

from glob import glob
import os

Then the build colcon build --packages-select learning_tf2_py should succeed.

The tutorial source code is here: https://github.com/ros/geometry_tutor...

I think it's worth filing a bug against the tutorial so that others don't fall into this trap.

(Sorry for leading you astray earlier!)

edit flag offensive delete link more

Comments

You helped me get unstuck after 3 days of bashing my head against the wall. The errors I've been having are useless to point me in the right direction. This was the single google search result when i just paste the entire nonsens... and it actually worked.

Thank you.

Electrolight gravatar image Electrolight  ( 2022-05-18 19:22:55 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-10-13 10:57:44 -0500

Seen: 351 times

Last updated: Oct 16 '21