pantor / ruckig

Motion Generation for Robots and Machines. Real-time. Jerk-constrained. Time-optimal.
https://ruckig.com
MIT License
686 stars 162 forks source link

Integrating Ruckig with ROS2 #191

Closed akarshansaurabh closed 4 months ago

akarshansaurabh commented 5 months ago

I want to use Ruckig with ROS2 Humble. But during running the colcon build command i am getting errors. Please help. Will be grateful. I followed the official documentation of Ruckig to install it and I was able to successfully install and sucessfully run the example codes. But I am not able to intergrate Ruckig with ROS2. So, please help me.

THIS IS MY CMAKELISTS.TXT :

cmake_minimum_required(VERSION 3.8) project(motion_planner)

Default to C99

if(NOT CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 99) endif()

Update to C++17 for Ruckig and modern C++ features

if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif()

find dependencies

find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(std_msgs REQUIRED) find_package(sensor_msgs REQUIRED) find_package(geometry_msgs REQUIRED) find_package(trajectory_msgs REQUIRED) find_package(visualization_msgs REQUIRED)

Ruckig dependency

find_package(ruckig REQUIRED)

Include directories

include_directories(include ${ruckig_INCLUDE_DIRS})

Declare a ROS2 executable

add_executable(motion_planner_node src/motion_planner_node.cpp) ament_target_dependencies(motion_planner_node rclcpp std_msgs sensor_msgs geometry_msgs trajectory_msgs visualization_msgs )

Link libraries, including Ruckig

target_link_libraries(motion_planner_node ruckig::ruckig )

Install the executable and configure the package

install(TARGETS motion_planner_node DESTINATION lib/${PROJECT_NAME} )

Linters for code quality

if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() endif()

Final package setup

ament_package()

THIS IS MY PACKAGE.XML :

<?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>

motion_planner 0.0.0 TODO: Package description akarshan TODO: License declaration ament_cmake rclcpp std_msgs sensor_msgs geometry_msgs trajectory_msgs visualization_msgs ament_lint_auto ament_lint_common ament_cmake

AND THIS IS THE ERROR THAT I AM GETTING WHILE RUNNING COLCON BUILD :

/usr/bin/ld: CMakeFiles/motion_planner_node.dir/src/motion_planner_node.cpp.o: in function ruckig::Result ruckig::WaypointsCalculator<3ul, ruckig::StandardVector>::calculate<false>(ruckig::InputParameter<3ul, ruckig::StandardVector> const&, ruckig::Trajectory<3ul, ruckig::StandardVector>&, double, bool&)': motion_planner_node.cpp:(.text._ZN6ruckig19WaypointsCalculatorILm3ENS_14StandardVectorEE9calculateILb0EEENS_6ResultERKNS_14InputParameterILm3ES1_EERNS_10TrajectoryILm3ES1_EEdRb[_ZN6ruckig19WaypointsCalculatorILm3ENS_14StandardVectorEE9calculateILb0EEENS_6ResultERKNS_14InputParameterILm3ES1_EERNS_10TrajectoryILm3ES1_EEdRb]+0x8b3): undefined reference toruckig::CloudClient::post(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator > > const&, bool)' collect2: error: ld returned 1 exit status gmake[2]: [CMakeFiles/motion_planner_node.dir/build.make:192: motion_planner_node] Error 1 gmake[1]: [CMakeFiles/Makefile2:137: CMakeFiles/motion_planner_node.dir/all] Error 2 gmake: *** [Makefile:146: all] Error 2

Failed <<< motion_planner [0.36s, exited with code 2]

So, can you please tell how can I integrate Ruckig with ROS2 humble? Is there any error in my CMakeLists.txt and Package.xml file that I have provided above.

pantor commented 5 months ago

Hi! Can you use the code block to make the terminal output above readable?

It seems that the src/ruckig/cloud_client.cpp file is missing in your build / linking step.