[Solved] Error when building rosbot_ros2_firmware

Hi, when I try to build rosbot_ros2_firmware I got the following error:

Resolving core2 dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...
Error: Processing core2 (platform: ststm32@15.4.1; framework: mbed; board: core2)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/core2.html
PLATFORM: ST STM32 (15.4.1) > CORE2
HARDWARE: STM32F407ZGT6 168MHz, 192KB RAM, 1MB Flash
DEBUG: Current (stlink) External (stlink)
PACKAGES: 
 - framework-mbed @ 6.51506.201227 (5.15.6) 
 - toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py):
  File "/home/michael/.platformio/penv/lib/python3.10/site-packages/platformio/builder/main.py", line 187:
    env.SConscript("$BUILD_SCRIPT")
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/michael/.platformio/platforms/ststm32/builder/main.py", line 120:
    target_elf = env.BuildProgram()
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/home/michael/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piobuild.py", line 60:
    env.ProcessProgramDeps()
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/home/michael/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piobuild.py", line 120:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/home/michael/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piobuild.py", line 331:
    SConscript(env.GetFrameworkScript(name), exports="env")
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 660:
    return method(*args, **kw)
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/michael/.platformio/platforms/ststm32/builder/frameworks/mbed.py", line 35:
    SConscript(
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 660:
    return method(*args, **kw)
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/michael/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/michael/.platformio/packages/framework-mbed/platformio/platformio-build.py", line 45:
    from pio_mbed_adapter import PlatformioMbedAdapter
  File "/home/michael/.platformio/packages/framework-mbed/platformio/pio_mbed_adapter.py", line 23:
    from tools.build_api import prepare_toolchain, UPDATE_WHITELIST
  File "/home/michael/.platformio/packages/framework-mbed/tools/build_api.py", line 47:
    from .libraries import Library
  File "/home/michael/.platformio/packages/framework-mbed/tools/libraries.py", line 24:
    from tools.tests import TEST_MBED_LIB, DEFAULT_SUPPORT
  File "/home/michael/.platformio/packages/framework-mbed/tools/tests.py", line 17:
    from past.builtins import cmp
  File "/home/michael/.platformio/packages/framework-mbed/platformio/package_deps/py3/past/builtins/__init__.py", line 43:
    from past.builtins.noniterators import (filter, map, range, reduce, zip)
  File "/home/michael/.platformio/packages/framework-mbed/platformio/package_deps/py3/past/builtins/noniterators.py", line 24:
    from past.types import basestring
  File "/home/michael/.platformio/packages/framework-mbed/platformio/package_deps/py3/past/types/__init__.py", line 25:
    from .oldstr import oldstr
  File "/home/michael/.platformio/packages/framework-mbed/platformio/package_deps/py3/past/types/oldstr.py", line 5:
    from collections import Iterable
========================== [FAILED] Took 0.48 seconds ==========================

I tried to delete the “.Home/.platformio/packages/tool-scons” folder (found this as workaround) but that does not help. Done with Ubuntu 22.04.
Any ideas?

Michael

Hello @MichaelT

  1. What hardware/equipment do you use?

  2. What commands/tools are you using to build the firmware?

Best regards
Jan Brzyk

Hi @JanBrzyk

I am using a Core2 with attached RPi 4. But I am building in a Ubuntu 22.04 virtual machine. The Core2 is connected with a ST Link.
Tools are VSCode with installed PlatformIO as described here: https://github.com/husarion/rosbot_ros2_firmware. I start the build process with the small icon at the bottom of VSC. So in the first step (where the error occurs) the Core2 hardware is not involved.

Michael

Hi @MichaelT

we will try to reproduce your problem and we will let you know in a short time.

Best regards
Jan Brzyk

@MichaelT

If you are working on a native system, install the vscode devcontainers plugin and click the left bottom green button and Reopen in container. Then use the container to build and flash with pio run --target upload command. These steps are actually not described in the README.

Best regards
Jan Brzyk

Hi Jan,

thanks for investigating.
I will try and let you know my results.

Michael

Hi @JanBrzyk

building the firmware works now - thanks.
But I am having trouble with uploading the firmware via STLink from the VSC terminal:

husarion@6e96541ebad4:~/rosbot_ros2_firmware$ pio run --target upload
Processing core2 (platform: ststm32@15.4.1; framework: mbed; board: core2)
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/tool-stm32duino @ ~1.0.1
Error: You are not connected to the Internet.
PlatformIO needs the Internet connection to download dependent packages or to work with PlatformIO Account.
husarion@6e96541ebad4:~/rosbot_ros2_firmware$ 

My browser works, has this something to do with docker or the devcontainer?
Did I miss some configuration (I am a complete newbie to Docker)?

After restarting my VM and running VSC again in devcontainer I get the message that PlatformIO cannot be activated because C/C++ extension has to be reloaded, but reloading results in the PlatformIO activation error message and so on …

Michael

Hello @MichaelT

To throw some update: we’re still trying to reproduce your issue.

Best regards
Jan Brzyk

Hello @MichaelT
I. Are you using devcontainer on Ubuntu 22.04 inside some virtual machine? If so try to open new terminal and check internet connection in machine ping 8.8.8.8
II. The browser what you use is on your native system Windows or on Ubuntu 22.04 inside VM?
III. I think the easiest way to program Core2 with rosbot_ros2_firmware is to:

  1. clone or download repository on your native OS (Windows),
  2. open rosbot_ros2_firmware folder in VS Code,
  3. download devcontainer extension,
  4. reopen folder in container,
  5. then run pio run --target upload

Best Regards,
Jakub Delicat

Hi Jakub,

sorry for the late answer.
First I don’t know why but for now everything works in a dev container on Ubuntu inside a virtual machine (running on Windows 10).
II The browser I mentioned was on Ubuntu inside the VM
III I have no Docker at the windows 10 machine so this is not an option.
But as I said, at the moment erverything is working.
Thanks for your help

Michael

Okay.
Thank you for explanation!
I think the problem was with temporary internet connection issue.

After all I’m closing this thread.
Thank you!

Jakub Delicat