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

rclc and rclcpp avoiding python usage in cross-compilation #312

Open
RocaPiedra opened this issue Aug 29, 2022 · 5 comments
Open

rclc and rclcpp avoiding python usage in cross-compilation #312

RocaPiedra opened this issue Aug 29, 2022 · 5 comments

Comments

@RocaPiedra
Copy link

Hi,

I am trying to use ROS 2 on a target by doing cross-compilation (Xilinx UltraScale +). I want to avoid the usage of Python and the possibility of using C is very interesting. I would like to know if it would be possible to use rclc and rclcpp to create static libraries and compile the packages and avoid the need for Python in the target.

Thanks in advance

@pablogs9
Copy link
Member

pablogs9 commented Sep 6, 2022

Hello @RocaPiedra, it is possible to cross-compile the ROS 2 stack in static libraries and executables for targetting embedded applications. One approach is using micro-ROS if you have an embedded bare-metal or RTOS platform. But if you have a full-featured OS, it should be possible to build the entire ROS 2 stack (including RCLC or RCLCPP) in static libraries.

@RocaPiedra
Copy link
Author

Hi @pablogs9!

The OS is PetaLinux (based in Yocto), so from what I've checked, it doesn't seem like micro-ROS is compatible (but I've seen it is possible to compile micro-ROS in a host, so maybe I could do the same workflow and cross-compile with the aarch64 compiler?). I thought about building the stack directly but haven't found any guidance on the topic and I thought there was some kind of dependency with Python. If you have any available information or references on how to compile it to static libraries (and use it), it would help a lot!

@JanStaschulat
Copy link
Contributor

JanStaschulat commented Sep 7, 2022

Hi @RocaPiedra, why do you think that micro-ROS is not compatible with PetaLinux? As you mentioned, micro-ROS can be used on a Linux host. micro-ROS was developed for micro-controllers, which have only very little resources (CPU, memory) therefore the server-client architecture. But the client can also be used on larger platforms. See this tutorial for micro-ROS application on Linux.

As an alternative for cross-compiling micro-ROS with the server-client architecture (Linux host as server, micro-controller as client), you could just cross-compile rclc layer (and depending layers like rcl, rmw, ...). Then the API to the ROS 2 stack on your Yocto Linux is rclc. It only depends on the system resources of the hardware (memory and CPU) if you can run a full ROS 2 stack on it or rather use the micro-ROS approach.

The rclc layer provides a programming interface for C applications but can also be used in C++ programs (with some restrictions, e.g. static member functions as callback functions but you can pass a context pointer to a subscription callback to have access to some external state). See also this discussion: Feature request: C++ support.

@RocaPiedra
Copy link
Author

Hi @JanStaschulat, the HW I use could run ROS 2 without much problem but I haven't been able to install ROS yet. I'm updating the PetaLinux version (from 2018.3 to 2020) to include meta-ros but my base image is not working and I have not found a Yocto recipe for the version I have now (rocko 2.4).
So the host approach in Linux (without cross compilation) is not an option because I haven't been able to install ROS 2 so far. That is why I'm trying to find an option where I don't need to use Python at all and just depend on C/C++ so I can load whatever I need on the target and compile it. I guess from @pablogs9's answer that I could do that but without guidance, I feel like it will take me a very long time.

@alecGraves
Copy link

I would also like to build ROS2 without Python. Ideally, I would like to build core components (like RCL and RCLC and a DDS backend) without CMake or a C++ compiler either.

I think there is great value in reducing the number of dependencies. That makes ros2 more portable and accessible, including on new or niche platforms like custom processors and operating systems.

By my testing, RCL requires 78 packages in the workspace just to compile (without testing enabled), or 103 if you count colcon extensions. 48 of these packages (ament + colcon) are just related to the build system. Having a minimal backup build system like Makefiles for core components like RCL and a minimal DDS backend would help to significantly reduce bloat in the build system and improve portability.

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