[ros-users] [Discourse.ros.org] [Next Generation ROS] Cannot…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Arunava Nag via ros-users
Date:  
To: ros-users
Subject: [ros-users] [Discourse.ros.org] [Next Generation ROS] Cannot run executable and lib using ros2 run after building using ament


I wrote a simple package with class and library to subscribe and publish using rclcpp.

My CMakeLists.txt is:

    cmake_minimum_required(VERSION 3.5)


    project(testpackage)


    if(NOT WIN32)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
    endif()


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


    include_directories(include 
                        ${rclcpp_INCLUDE_DIRS}
                        ${rmw_implementation_INCLUDE_DIRS}
                        ${std_msgs_INCLUDE_DIRS})


    add_library(test_lib
    src/test.cpp
    )


    target_link_libraries(test_lib ${rclcpp_LIBRARIES} ${rmw_implementation_LIBRARIES} ${std_msgs_LIBRARIES})


    add_executable(test_node src/test_node.cpp)
    add_dependencies(test_node test_lib)
    target_link_libraries(test_node test_lib)


    install(
      DIRECTORY include/${PROJECT_NAME}
      DESTINATION include
    )


    install(
      TARGETS test_lib test_node 
      ARCHIVE DESTINATION lib
      LIBRARY DESTINATION lib
      RUNTIME DESTINATION bin
    )


    ament_package()



It builds well. However when I try to run the package like this:

`ros2 run testpackage test_node`
it says no executable found.

Is there something like roscore in ros2 to have the ROS_MASTER and ros services running? I have sourced `install/local_setup.bash` as given in the tutorials.

I have built using the command = `ament build --symlink-install --only-package testpackage`
Also i realised, my library is not created inside install/lib/.





---
[Visit Topic](https://discourse.ros.org/t/cannot-run-executable-and-lib-using-ros2-run-after-building-using-ament/2640/1) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list

http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>