I am building a package and receive the correct output that you would expect for a package:
Starting >>> controllers Finished <<< controllers [7.45s] Summary: 1 package finished [7.69s] I open a new terminal, source my ROS 2 installation (/opt/ros/humble/setup.bash), source my package (install/setup.bash), and I try to run the only node that is in the package (pi_node) with the following command:
ros2 run controllers pi_node But I receive the following error:
Package 'controllers' not found Also, autocomplete is not working. I have been deleting my workspace and retrying, but there is nothing that solves the issue, and I don't know what else could be failing. My CMakeLists.txt looks like this:
cmake_minimum_required(VERSION 3.8) project(controllers) find_package(Eigen3 3.4 REQUIRED NO_MODULE) find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(geometry_msgs REQUIRED) find_package(turtlesim REQUIRED) include_directories(include) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() add_executable(pi_node src/pi_node.cpp include/control/controller.hpp include/control/pi_controller.hpp) ament_target_dependencies(pi_node rclcpp turtlesim geometry_msgs) target_link_libraries(pi_node Eigen3::Eigen) install(TARGETS pi_node DESTINATION lib/${PROJECT_NAME}) ament_package() The content of my package.xml file is:
<?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>controllers</name> <version>0.0.0</version> <description>TODO: Package description</description> <maintainer email="[email protected]">pablo</maintainer> <license>TODO: License declaration</license> <depend>rclcpp</depend> <depend>std_msgs</depend> <depend>geometry_msgs</depend> <depend>turtlesim</depend> <export> <build_type>cmake</build_type> </export> </package>
ros2 pkg list | grep controllers? $\endgroup$package.xmlsince e.g.ros2 runqueries the ament index to find packages. $\endgroup$<build_type>ament_cmake</build_type>. More information aboutament(and other build types) and its functionality can be found in the design article - Integrate arbitrary build systems.ament_cmakeautomatically writes to the ament resource index at build time and thus provides efficient access to information like the available packages, messages, etc at runtime. $\endgroup$