m2-farzan / ros2-foxy-PKGBUILD

AUR Package for ROS 2 Foxy
1 stars 1 forks source link

Add ros2-foxy-xacro #3

Closed ivolkg closed 3 years ago

ivolkg commented 3 years ago

I see that xacro is available in AUR for other ros distros but not for foxy

m2-farzan commented 3 years ago

You got it: https://aur.archlinux.org/packages/ros2-foxy-xacro/ :)

I'll also upload some other common ROS packages later but over all you'll probably have to build some packages manually. By the way, if you have experience with ROS I'd be happy if you can name like 5-10 other commonly used packages that come to your mind so that I can put them at higher priority for AUR.

ivolkg commented 3 years ago

Thanks I'm pretty new at ROS but I have to use it for my masters and I really don't want to use Ubuntu, so maybe I will encounter more of this problems

So if you could point me in the right direction as to how I can build ROS packages from scratch I will be more than happy to contribute and upload them at the AUR

ivolkg commented 3 years ago

image I'm having this issue

m2-farzan commented 3 years ago

This command should solve the issue:

mkdir -p /home/isaac/.cache/paru/clone/ros2-foxy/src
ln -s /opt/ros2/foxy /home/isaac/.cache/paru/clone/ros2-foxy/src/install

This is caused by a bug in the pkgbuild and I'll solve it ASAP. See #5.

m2-farzan commented 3 years ago

So if you could point me in the right direction as to how I can build ROS packages from scratch I will be more than happy to contribute and upload them at the AUR

You can start by studying xacro pkgbuild itself.

Most ROS packages are more complicated than xacro though. A ROS package can depend on other ROS packages, as well as non-ROS packages that install on OS itself. Furthermore, those dependencies that are ROS packages can themselves depend on ROS and non-ROS packages. This makes a recursive process until you reach simple packages with no special dependencies.

For example, here's my pkgbuild for ros2-localization package which I've not tested enough to publish in AUR.

# Maintainer: Mohammad Mostafa Farzan <m2_farzan@yahoo.com>

pkgname=ros2-robot-localization-git
pkgver=r991.212bfb0
pkgrel=1
pkgdesc="Slam Toolbox for lifelong mapping and localization in potentially massive maps with ROS 2"
url="https://navigation.ros.org/tutorials/docs/navigation2_with_slam.html"
arch=('any')
depends=('ros2-git'
         'ros2-navigation-git'
         'ros2-diagnostics-git'
         )
source=("robot_localization::git+https://github.com/cra-ros-pkg/robot_localization#branch=ros2"
        "git+https://github.com/ros-geographic-info/geographic_info#branch=ros2")
sha256sums=('SKIP'
            'SKIP')

pkgver() {
  cd $srcdir/robot_localization
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    sed -i "s/c++14/c++17/g" $srcdir/robot_localization/CMakeLists.txt
}

build() {
    source /opt/ros2/rolling/setup.sh
    colcon build --merge-install
}

package() {
    # Copy build files
    mkdir -p $pkgdir/opt/ros2/rolling
    cp -r $srcdir/install/* $pkgdir/opt/ros2/rolling/
    # Exclude files that clash with base ros installation
    rm $pkgdir/opt/ros2/rolling/*setup.*
    rm $pkgdir/opt/ros2/rolling/_local_setup*
    rm $pkgdir/opt/ros2/rolling/COLCON_IGNORE
}

Note that the package depends on other ROS packages. For two of them I created separate pkgbuilds (navigation, diagnostic) because I felt they are common packages. For geographic_info I didn't bother making yet another pkgbuild. I just added clone instruction so that it'll be built by colcon before the main package—colcon automatically builds dependencies first. If later on I run into another package with geographic_info dependency, I'll refactor it as a new package. There are no strict rules, and IMO going too granular will just create clutter.

The base ros2-foxy (or ros2-git) package itself installs a few hundred base packages and all ROS packages depend on it.

So how to find out what are dependencies of a package? Here's some tips:

m2-farzan commented 3 years ago

I've just created a separate repo for these non-base ros2 packages, like xacro: https://github.com/m2-farzan/ros2-supplementary-pkgbuilds

I've uploaded a few packages there that I already had. But they are not stable and tested yet. If you have any comments, questions or contributions, please create issues/PR's there as I want to keep this repo dedictated to base ros2-foxy package.

Thanks