micro_ros_platformio: ament_cmake clone failed when compiling for esp32-dev

Issue when cloning micro-ros repo

  • Hardware description: ESP32Dev
  • Installation type: PlatformIO, Ubuntu Linux 22.04 latest version, git version: 2.34.1, cmake version: 3.22.1, python3-pip version: 22.0.2
  • Version or commit hash: Humble

Steps to reproduce the issue

  • Create a new PlatformIO project using the ESP32-dev as board of choice and add micro-ros dependency to platformio.ini file:

lib_deps = https://github.com/micro-ROS/micro_ros_platformio

  • Compile the project as normal

Expected behavior

Succesfully compile the package

Actual behavior

Cloning of micro-ros repo fails:

Configuring esp32dev with transport serial
Downloading micro-ROS dev dependencies
ament_cmake clone failed: 
fatal: Too many arguments.

usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    --reject-shallow      don't clone shallow repository
    -n, --no-checkout     don't create a checkout
    --bare                create a bare repository
    --mirror              create a mirror repository (implies bare)
    -l, --local           to clone from a local repository
    --no-hardlinks        don't use local hardlinks, always copy
    -s, --shared          setup as shared repository
    --recurse-submodules[=<pathspec>]
                          initialize submodules in the clone
    --recursive ...       alias of --recurse-submodules
    -j, --jobs <n>        number of submodules cloned in parallel
    --template <template-directory>
                          directory from which templates will be used
    --reference <repo>    reference repository
    --reference-if-able <repo>
                          reference repository
    --dissociate          use --reference only while cloning
    -o, --origin <name>   use <name> instead of 'origin' to track upstream
    -b, --branch <branch>
                          checkout <branch> instead of the remote's HEAD
    -u, --upload-pack <path>
                          path to git-upload-pack on the remote
    --depth <depth>       create a shallow clone of that depth
    --shallow-since <time>
                          create a shallow clone since a specific time
    --shallow-exclude <revision>
                          deepen history of shallow clone, excluding rev
    --single-branch       clone only one branch, HEAD or --branch
    --no-tags             don't clone any tags, and make later fetches not to follow them
    --shallow-submodules  any cloned submodules will be shallow
    --separate-git-dir <gitdir>
                          separate git dir from working tree
    -c, --config <key=value>
                          set config inside the new repository
    --server-option <server-specific>
                          option to transmit
    -4, --ipv4            use IPv4 addresses only
    -6, --ipv6            use IPv6 addresses only
    --filter <args>       object filtering
    --remote-submodules   any cloned submodules will use their remote-tracking branch
    --sparse              initialize sparse-checkout file to include only files at root

Additional information

Same issue as the following issues: #60, #111

The following platformio.ini configuration is used:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
board_microros_distro = humble
board_microros_transport = serial
monitor_speed = 115200
lib_deps = 
	adafruit/Adafruit Unified Sensor@^1.1.6
	adafruit/Adafruit BNO055@^1.6.1
	adafruit/Adafruit BusIO@^1.14.1
	SPI
	adafruit/Adafruit NeoPixel@^1.11.0
	https://github.com/micro-ROS/micro_ros_platformio

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

The micro_ros_platformio uses ardunio framework. You can use most of the arduino drivers and libraries. The arduino libraries will be built from source. So it will more flexible than the pre-built arduino library.

This issue is not specific to esp32. Though it is possible to run ROS2 Jazzy on Windows, it is difficult for beginners. Docker is popular in ROS development.

Platformio and Arduino have minor different micro-ROS implementation. So it won’t work to just insert the Arduino library.

VScode is a much powerful IDE than Arduino IDE. If you have pi4/5, it would be better to run vscode on Windows and ssh to Pi. Check my wiki,

https://github.com/hippo5329/micro_ros_arduino_examples_platformio/wiki#development-on-windows-or-linux-desktop-and-use-vscode-remote-development-ssh-to-rpi45

I tried a couple of things, but I keep running into some issues with either the file path or shutil not recognizing the file path. My expertise is more in lower-level languages like C. I changed the β€œinit” function of the Build class to the following implementation:

    def __init__(self, library_folder, packages_folder, distro, python_env):
        self.library_folder = '"' + os.path.normcase(library_folder) + '"'
        self.packages_folder = '"' + os.path.normcase(packages_folder) + '"'
        self.build_folder = '"' + os.path.normcase(os.path.join(library_folder, "build").replace('"', '')) + '"'
        self.distro = distro

        self.dev_packages = []
        self.mcu_packages = []

        self.dev_folder = '"' + os.path.normcase(os.path.join(self.build_folder, 'dev').replace('"', '')) + '"'
        self.dev_src_folder = '"' + os.path.normcase(os.path.join(self.dev_folder, 'src').replace('"', '')) + '"'
        self.mcu_folder = '"' +  os.path.normcase(os.path.join(self.build_folder, 'mcu').replace('"', '')) + '"'
        self.mcu_src_folder = '"' + os.path.normcase(os.path.join(self.mcu_folder, 'src').replace('"', '')) + '"'

        self.library_path = '"' + os.path.normcase(os.path.join(library_folder, 'libmicroros').replace('"', '')) + '"'
        self.library = '"' + os.path.normcase(os.path.join(self.library_path, "libmicroros.a").replace('"', '')) + '"'
        self.includes = '"' + os.path.normcase(os.path.join(self.library_path, 'include').replace('"', '')) + '"'
        self.library_name = "microros"
        self.python_env = python_env
        self.env = {}

It seems a bit hacky, but without a pretty major redesign it does not seem a very easy change to me. Perhaps someone with more knowledge about the package and Python could up with a better fix. My implementation formats the paths correctly, but shutil does not recognize the path anymore (No such file or directory, while it does exists). I am kind of short on time due to some school projects, so dedicating time right now is a bit hard. Perhaps I could look into it at a later date When I have more time available. For now, warn people about using Windows style file paths/ file path with spaces as this breaks the build script. If you have any questions, feel free to ask πŸ˜ƒ