Hi, I am making a new ros2 node, but it is not showing up in the package list (similar to Why doesn't ros2 pkg list show the packages that I built?, but I believe I've sourced things correctly). I first build the minimal_publisher and minimal_subscriber and this worked fine. I then copied the pendulum_msgs demo to build a custom message (obstacle_msgs) and this works fine. Lastly I wanted to create a new node (obstacle_publisher) which based off minimal_publisher and have it use the newly defined message, but its not getting installed for ros2 to find (the first 3 example are).
CMakeList.txt:
cmake_minimum_required(VERSION 3.5)
project(obstacle_publisher)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(obstacle_msgs REQUIRED)
include_directories("../dependencies/")
add_executable(obstacle_publisher obstaclePublisher.cpp obstacles.cpp)
ament_target_dependencies(obstacle_publisher rclcpp std_msgs obstacle_msgs)
install(TARGETS
obstacle_publisher
DESTINATION lib/${PROJECT_NAME}
)
ament_package()
package.xml:
<?xml version="1.0"?>
<package format="2">
<name>obstacle_publisher</name>
<version>0.0.0</version>
<description>The obstacle_publisher package</description>
<maintainer email="paul">Paul</maintainer>
<license>TODO</license>
<!-- <author email="paul">Paul</author> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>message_generation</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>obstacle_msgs</build_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>message_runtime</exec_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>obstacle_msgs</exec_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>
If I remove all the build data
rm -r build/ install/ log/
and then remake the project
colcon build --symlink-install
I get the following;
Starting >>> obstacle_msgs
[0.221s] WARNING:colcon.colcon_ros.prefix_path.ament:The path
'/home/paul/code/eclipse_ws/ROS2/install/obstacle_msgs' in the environment variable AMENT_PREFIX_PATH doesn't
exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.ament:The path
'/home/paul/code/eclipse_ws/ROS2/install/minimal_subscriber' in the environment variable AMENT_PREFIX_PATH
doesn't exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.ament:The path
'/home/paul/code/eclipse_ws/ROS2/install/minimal_publisher' in the environment variable AMENT_PREFIX_PATH
doesn't exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path
'/home/paul/code/eclipse_ws/ROS2/install/obstacle_publisher' in the environment variable CMAKE_PREFIX_PATH
doesn't exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path
'/home/paul/code/eclipse_ws/ROS2/install/obstacle_msgs' in the environment variable CMAKE_PREFIX_PATH doesn't
exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path
'/home/paul/code/eclipse_ws/ROS2/install/minimal_subscriber' in the environment variable CMAKE_PREFIX_PATH
doesn't exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path
'/home/paul/code/eclipse_ws/ROS2/install/minimal_publisher' in the environment variable CMAKE_PREFIX_PATH
doesn't exist
Starting >>> minimal_publisher
Starting >>> minimal_subscriber
Finished <<< minimal_publisher [4.67s]
Finished <<< minimal_subscriber [4.77s]
Finished <<< obstacle_msgs [7.55s]
Starting >>> obstacle_publisher
--- stderr: obstacle_publisher
CMake Warning:
Manually-specified variables were not used by the project:
CATKIN_INSTALL_INTO_PREFIX_ROOT
---
Finished <<< obstacle_publisher [4.60s]
Summary: 4 packages finished [12.3s]
1 package had stderr output: obstacle_publisher
If I rebuild again, I don't get any build errors. Since the only warning that effects obstacle_publisher and not the other relates to CATKIN_INSTALL_INTO_PREFIX_ROOT, I assume it has something to do with the issue.
echo $CATKIN_INSTALL_INTO_PREFIX_ROOT (is blank)
I have 'source /opt/ros/dashing/setup.bash' in my ~/.bashrc file
I see the compiled binary sitting in
install/obstacle_publisher/lib/obstacle_publisher/
, and can execute it directly, but it just doesn't show up in the ros2 pkg list.
I'm sure I've missed something basic, but can somebody help me understand what I'm missing please.
Sincerely, Paul.
Originally posted by AwooOOoo on ROS Answers with karma: 117 on 2019-06-17
Post score: 0