Ask Your Question
0

rosdep can't find cyclonedds during foxy install on raspbian

asked 2021-03-04 07:23:21 -0500

bassline gravatar image

updated 2021-03-05 04:00:35 -0500

gvdhoorn gravatar image

I have created a fresh raspbian system on as Pi3b. I have created a new user with sudo privileges, rebooted to new user and installed latest updates follow by a reboot. I am now trying to install ros2 following these instructions https://docs.ros.org/en/foxy/Installa... and using this image ros2-foxy-20201211-linux-focal-arm64.tar.bz2. When trying to install the dependencies I get :

robot@robot:~/ros2_foxy $ rosdep install --from-paths ros2-linux/share --ignore-src --rosdistro foxy -y --skip-keys "console_bridge fastcdr fastrtps osrf_testing_tools_cpp poco_vendor rmw_connext_cpp rosidl_typesupport_connext_c rosidl_typesupport_connext_cpp rti-connext-dds-5.3.1 tinyxml_vendor tinyxml2_vendor urdfdom urdfdom_headers"
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rmw_cyclonedds_cpp: No definition of [cyclonedds] for OS [debian]

Following a previous question I then proceed with the -r option and all seems to go OK until I try to run the demos when I get the following errors: talker

robot@robot:~ $ ros2 run demo_nodes_cpp talker
Traceback (most recent call last):
  File "/home/robot/ros2_foxy/ros2-linux/bin/ros2", line 33, in <module>
    sys.exit(load_entry_point('ros2cli==0.9.8', 'console_scripts', 'ros2')())
  File "/home/robot/ros2_foxy/ros2-linux/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
    rc = extension.main(parser=parser, args=args)
  File "/home/robot/ros2_foxy/ros2-linux/lib/python3.8/site-packages/ros2run/command/run.py", line 70, in main
    return run_executable(path=path, argv=args.argv, prefix=prefix)
  File "/home/robot/ros2_foxy/ros2-linux/lib/python3.8/site-packages/ros2run/api/__init__.py", line 61, in run_executable
    process = subprocess.Popen(cmd)
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/robot/ros2_foxy/ros2-linux/lib/demo_nodes_cpp/talker'

listener

robot@robot:~/ros2_foxy $ ros2 run demo_nodes_py listener
Traceback (most recent call last):
  File "/home/robot/ros2_foxy/ros2-linux/lib/demo_nodes_py/listener", line 33, in <module>
    sys.exit(load_entry_point('demo-nodes-py==0.9.3', 'console_scripts', 'listener')())
  File "/home/robot/ros2_foxy/ros2-linux/lib/demo_nodes_py/listener", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/home/robot/.local/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 100, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/robot/ros2_foxy/ros2-linux/lib/python3.8/site-packages/demo_nodes_py/topics/listener.py", line 16, in <module>
    from rclpy.node import Node
  File "/home/robot/ros2_foxy/ros2-linux/lib/python3.8/site-packages/rclpy/node.py", line 41, in <module>
    from rclpy.client import Client
  File "/home/robot/ros2_foxy/ros2-linux/lib/python3.8/site-packages/rclpy/client.py", line 22, in <module>
    from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
  File "/home/robot/ros2_foxy/ros2-linux/lib/python3.8 ...
(more)
edit retag flag offensive close merge delete

Comments

Hi @bassline. I'm having the same problem. Any updates on this?

TheLegendaryJedi gravatar image TheLegendaryJedi  ( 2021-03-19 12:34:22 -0500 )edit

I tried everything again and using "top" to monitor CPU and memory usage I could see it was swapping out memory all the time in the final build. I bought a new Pi4B and installed under ubuntu with no problems. I suggest you try and close everything that is not essential, reduce memory swapping (sorry can't remember where I found that hack) and then try again. PS If you decide to upgrade to a 4B be aware that the mains supply has a different connector so you will need a new power supply as well.

bassline gravatar image bassline  ( 2021-03-20 03:11:31 -0500 )edit

I have tried again pulling the most recent code but still get problems compiling (e.g. /usr/bin/ld: ../../lib/libOgreMain.so.1.12.1: undefined reference to `__atomic_fetch_add_8') my command line input (after working around several problems) is: MAKEFLAGS="-j1 -l1" colcon build --symlink-install --cmake-args -DCMAKE_EXTRA_LINKER_FLAGS='-latomic' -DBUILD_TESTING=OFF --cmake-force-configure --packages-skip-build-finished --continue-on-error

Has anyone actually succeeded in compiling ROS2 on a Pi3B or do I just transfer my efforts to mi Pi4b?

bassline gravatar image bassline  ( 2021-04-07 05:45:29 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-04-08 03:00:58 -0500

bassline gravatar image

updated 2021-04-10 02:33:29 -0500

Success!! I eventually managed to get ROS2 to build on a Pi3B. It took me 8 hours of trial and error yesterday and may not be the most efficient way but it worked for me. I based it on the approach here https://medium.com/swlh/raspberry-pi-... up to the camera install. The previous link depends heavily on https://docs.ros.org/en/foxy/Installa... The main issue is kswapd0 keeps kicking in to manage the swap. Following are the extra steps / changes I made.

  1. Edit /etc/sysctl.conf as root to add " vm.swappiness = 0". This stops swapping except when completely out of memory. Reboot to activate the changes
  2. I got a warning about missing paths when installing the build pre-requisites so I added these to my PATH. In my case this was achieved by "export PATH=$PATH:/home/brian/.local/bin"
  3. I amended ~/.colcon/defaults.yaml to remove the last line selecting the compiler and added " - -DBUILD_TESTING=OFF" to reduce the load.
  4. I still had kswapd0 cutting in regularly so I limited the C compiler to one instance per thread and only used 2 threads. This made my command line :-

MAKEFLAGS="-j1 -l1" colcon build --symlink-install --packages-skip-build-finished --continue-on-error --parallel-workers 2

This had the additional benefit that I could run "top -i" in another terminal to see what was going on.

5 Even so I still got kswapd0 grabbing a large chunk of processor every so often so I would abort the build (using Ctrl C or in extremis Ctrl Z), reboot the pi and set the build to continue. Eventually I got it all compiled with only one error - concerning ROS1 bridge which I don't need.

Query : I am not sure if I am allowed to close this or whether I need a moderator to do that. I will take action if this is still open at the end of the month.

Comment : I am now moving on the the camera where Raspbian seems to set up /dev/video10 onwards but ROS2 wants to use /dev/video0 - Issue now fixed, just needed the camera activating and the cable connecting the right way round (doh!)

UPDATE - added missing PATH information.

INFO UPDATE: I had not come across the alternative mentioned below

edit flag offensive delete link more

Comments

Hi, I'm very happy to see my article has helped you! I will amend it with some comments about the MAKEFLAGS and --parallel-workers, others have commented about running out of resources during build as well. The -DBUILD_TESTING=OFF option is a good one to add, too! It would be interesting to know which missing paths you saw.

Regarding the camera: /dev/video10 and up are devices for the onboard hardware decoder, encoder and GPU image signal processor. If you have a camera module connected but you don't see a /dev/video0, maybe you have to enable it first: https://projects.raspberrypi.org/en/p...

sgvandijk gravatar image sgvandijk  ( 2021-04-09 11:20:19 -0500 )edit

I'm ignorant here, but can you not use ros-tooling/cross_compile? Or is building on-device faster?

gvdhoorn gravatar image gvdhoorn  ( 2021-04-09 11:26:22 -0500 )edit

ros_cross_compile indeed is horribly slow, because it uses emulation rather than a real cross-compilation toolchain. I haven't done proper timing vs on-device, but the latter was fast enough for me and doesn't require any additional setup on a separate machine and any copying over of build artifacts. However it'll be very different if this issue gets resolved.

sgvandijk gravatar image sgvandijk  ( 2021-04-10 16:58:39 -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

1 follower

Stats

Asked: 2021-03-04 07:23:21 -0500

Seen: 182 times

Last updated: Apr 10