Code Monkey home page Code Monkey logo

conan-ros2's Introduction

conan-ros2

This repository contains Conan recipes for ROS 2 packages and an example application that consumes these recipes.

Requirements

We provide a Dockerfile that contains all the required dependencies. To use the Dockerfile:

bash ./docker/build.sh
bash ./docker/run.sh

If you don't want to use the Dockerfile, the following dependencies will have to be installed on your machine:

  • cmake
  • colcon
  • conan
  • lark-parser
  • vcstool
  • wget

Conan recipes

The conan directory contains 4 different Conan recipes.

Two of these recipes are the base for developing any other ROS 2 application in Conan.

  • ros2-base is not a stand-alone recipe, but rather a python requires, i.e. a "base class" that provides methods and utilities to be used in other ROS 2 recipes.
  • ros2-virtualenvgen this package provides a Conan virtual environment that can be used to expose env variables of all the ROS 2 recipes required by an application.

Then we have two additional recipes that serve as an example of how the base recipes can be used to build and package ROS 2 libraries.

  • ros2-core this recipe contains all the core ROS 2 libraries required by C++ applications.
  • ros2-tf this recipe contains the ROS 2 TF library C++ implementation.

The sources directory contains repos files used by these recipes to fetch all their components. This is used as an example to show how this approach could directly fetch repositories from the standard url https://github.com/ros2/ros2/blob/foxy/ros2.repos.

Note that the content of these two recipes has been arbirarily chosen for the sake of this example, in order to show that it is possible to have multiple ROS 2 Conan recipes depend on each others. It is both possible to agglomerate all ROS 2 dependencies within a single ROS 2 recipe as well as have a more fine-grained organization. As an additional example, it is possible to have a recipe for ROS 2 build tools (e.g. ament), one for the ROS 2 core libraries, one for additional RMW implementations and a last one for desktop tools. This split allows to cross-compile only those packages that will need to be used and deployed on the robot.

Example Application

The example-application directory contains a basic C++ application that consumes the ROS 2 Conan recipes. It can be built using standard Conan and CMake commands.

The example-application/conanfile.py defines the list of Conan dependencies of the application. Note that the application is not built as part of the Conan recipe build step (which is not present): this allows to better appreciate the use of vanilla CMake.

The build-example.sh script can be used to run all the commands required to generate the Conan dependencies, build the application and then finally run it.

bash build-example.sh

The script will generate an executable example-application/_install/example_app. Note that in order to run this application, you first need to source the Conan virtual environment.

source example-application/_build/conan/activate_ros2.sh
./example-application/_install/example_app

Using Conan CMake

Note that the build-example.sh script invokes the conan install command on the example-application/conanfile.py in order to grab conan dependencies. This could be replaced by using the Conan Cmake logic, for example:

include (conan)
conan_cmake_run(
    CONANFILE conanfile.py
    INSTALL_FOLDER ${CONAN_FIND_PACKAGE_DIR}
    SETTINGS compiler.libcxx=libstdc++
    SETTINGS arch=${CMAKE_SYSTEM_PROCESSOR}
    BUILD_TYPE Release
)

conan-ros2's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.