I am in the development branch of Chrono, using ROS humble on Ubuntu 
22.04.2. I have created a custom ROS package that builds a demo program 
from Chrono. I know this might not necessarily be a supported issue, so 
feel free to tell me that too!

I am using a CMakeLists.txt file (linked below) similar to the provided one 
in template_project, but altered minimally for use with colcon build. 
I can confirm that I built and installed Chrono with all the modules 
necessary and have updated my dynamic links with `sudo ldconfig`. When I 
remove Ros as a build component, everything builds fine, but once I add Ros 
as a build component to Chrono, I get the error below.

Any ideas on what I should be adding to my CMakeLists to help resolve this 
issue?

`Starting >>> chrono_sim
--- stderr: chrono_sim
CMake Error at /usr/local/lib/cmake/Chrono/chrono-config.cmake:474 
(find_package):
  By not providing "FindROS2.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "ROS2", but
  CMake did not find one.

  Could not find a package configuration file provided by "ROS2" with any of
  the following names:

    ROS2Config.cmake
    ros2-config.cmake

  Add the installation prefix of "ROS2" to CMAKE_PREFIX_PATH or set
  "ROS2_DIR" to a directory containing one of the above files.  If "ROS2"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)


gmake: *** [Makefile:267: cmake_check_build_system] Error 1
---
Failed   <<< chrono_sim [0.06s, exited with code 2]

Summary: 0 packages finished [0.21s]
  1 package failed: chrono_sim
  1 package had stderr output: chrono_sim
`

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/849eaf9e-76a3-49f6-a45e-eee0681eba4cn%40googlegroups.com.
cmake_minimum_required(VERSION 3.18)
cmake_policy(SET CMP0091 NEW)
project(chrono_sim)

LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/../Chrono/lib")
find_package(Chrono
             COMPONENTS Irrlicht Vehicle Parsers Ros
             REQUIRED)

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(tf2_ros REQUIRED)

set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD ${CHRONO_CXX_STANDARD})

include_directories(${CHRONO_INCLUDE_DIRS})

add_executable(my_demo src/my_example.cpp)


ament_target_dependencies(my_demo)


install(TARGETS
        my_demo
        DESTINATION ~/ros2_ws/src/chrono_sim/bin)

target_compile_definitions(my_demo PUBLIC 
"CHRONO_DATA_DIR=\"${CHRONO_DATA_DIR}\"") 
target_compile_options(my_demo PUBLIC ${CHRONO_CXX_FLAGS})
target_link_options(my_demo PUBLIC ${CHRONO_LINKER_FLAGS})

target_link_libraries(my_demo ${CHRONO_LIBRARIES})

ament_package()
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd"; schematypens="http://www.w3.org/2001/XMLSchema";?>
<package format="3">
  <name>chrono_sim</name>
  <version>0.0.0</version>
  <description>TODO: Package description</description>
  <maintainer email="[email protected]">parallels</maintainer>
  <license>Apache-2.0</license>

  <depend>rclcpp</depend>
  <depend>ROS2</depend>
  <depend>tf2_ros</depend>
  <depend>std_msgs</depend>
  <depend>chrono</depend>

  <buildtool_depend>ament_cmake</buildtool_depend>
  <buildtool_depend>chrono</buildtool_depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

Reply via email to