Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ament_cmake clone failed when compiling for esp32-dev #119

Open
kevinEberson opened this issue Sep 26, 2023 · 19 comments
Open

ament_cmake clone failed when compiling for esp32-dev #119

kevinEberson opened this issue Sep 26, 2023 · 19 comments

Comments

@kevinEberson
Copy link

kevinEberson commented Sep 26, 2023

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
@pablogs9
Copy link
Member

Hello @kevinEberson are you using Plaform.IO in a Windows environment?

@kevinEberson
Copy link
Author

kevinEberson commented Sep 26, 2023

Hi @pablogs9, I am running platfromIO on Ubuntu Linux 22.04 LTS. I managed to get the example to work, however when trying to apply micro-ros to another project, I get this error.

@pablogs9
Copy link
Member

What are the differences between those two projects? Could determine exactly the change that makes micro-ROS fail in the clone procedure?

@kevinEberson
Copy link
Author

For testing purposes, I commented all code, and copied the implementation of the platformio.ini and main.c file to the project from the micro-ros example. In theory, everything should be the same but I still get the error as mentioned.

@pablogs9
Copy link
Member

Could you add a print(command) after this line:

command = "git clone -b {} {} {}".format(self.branch, self.url, self.path)

To check which is the git command?

@kevinEberson
Copy link
Author

the resulting git command output is as following:

git clone -b humble https://github.com/ament/ament_cmake /media/kevin/Git drive/git/autonomous-guided-vehicle-platform-3/RIGS-Core/RIGS-Motorcontrol/.pio/libdeps/esp32dev/micro_ros_platformio/build/dev/src/ament_cmake

prehaps the error is caused by the space in the path? I will try to validate myself.

@pablogs9
Copy link
Member

Yes, it seems that this space is not smelling well.

Could you check if adding a couple of quotes solves the problem? If it does, could you open a PR with the solution? It would be highly appreciated.

@kevinEberson
Copy link
Author

Formatting folder and self.name as a str() solves the issue in my case. The formatting of the filepath seems to be the issue here. I will look into fixing this in a proper way and create a PR to fix the issue.

@pablogs9
Copy link
Member

Cool, thanks for contributing!

@kevinEberson
Copy link
Author

kevinEberson commented Sep 27, 2023

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 :)

@MojitoShader
Copy link

MojitoShader commented Jul 11, 2024

@kevinEberson
Where/how do you open up the Build class? (How can I modify that stuff) I am running into this problem for ever now and I have no Idea how to fix it. It occurs on Windows and with WSL soooo.
(Lol, so this Problem is still here and nobody fixed it)
Thx for the help, cheers

@hippo5329
Copy link
Contributor

Windows/WSL will not build. You should use docker or virtualbox to run ubuntu 22.04 and humble. If you have pi4/5, you may vscode/ssh to edit on windows and compile on Pi.

@MojitoShader
Copy link

Thanks for the help, I'll try that next.
Is this just a ESP32 Problem or generally mircoRos?
So the solution is to use the ArduinoIDE 🤢 (wich is able to compile the Example) or VS Code on Ubuntu.
I tried to use the Arduino library as zip in PlatformIO but that didn't work either. Any Idea why that doesn't work?
I think that would be a nice workaround (Normally Arduino libs are mostly compatible with PIO)

@hippo5329
Copy link
Contributor

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

@hippo5329
Copy link
Contributor

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.

@MojitoShader
Copy link

It's coming together now.
The learning curve is pretty steep. But at least I can compile and do stuff now. Thanks for the help. @hippo5329
I think it would be great to have your Example next to the ESP32 / have examples next to the supported Hardware.
(Here: https://github.com/micro-ROS/micro_ros_platformio) (Or have a examples sub Site)
It so easy to get lost in all the possibilities and versions of ROS / micro_ros.
(I don't know if that makes sense in a git-project manner..)
I am working on a simple esp32 robot (SLAM) with a replacement lidar for vacuum cleaners from Aliexpress.
(They are available for less than 20$$ )

@hippo5329
Copy link
Contributor

It is a good idea to use cheap vacuum cleaner as a robot base. I recalled that irobot did it before. If you are going to do slam with esp32, you may check another wiki.

linorobot2_hardware firmware for mobile robots

@hippo5329
Copy link
Contributor

About the various ROS2 releases, I am moving to the current LTS stable Jazzy. I will let you know when ready. One of the reason is Pi 5, which is supported with Ubuntu 24.04 but not 22.04. Pi 5 is much faster than Pi 4. The price of them are close. Pi 5 should be considered for new purchase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants