Newbie in running a package
Hi everyone I followed the wiki pages to create and run a simple node but I am getting this error message :
[rosrun] Couldn't find executable named talker_node below /home/bc/catkin_ws/src/my_package
What I did is :
mkdir -p ~/catkin_ws/src
cd catkin_ws/
catkin_make
cd src/
catkin_create_pkg my_package std_msgs rospy roscpp
cd my_package/src/
Copied a talker.cpp file here (/home/bc/catkin_ws/src/my_package/src/)
Added following lines to /home/bc/catkin_ws/src/my_package/CMakeLists.txt file
add_executable(talker_node src/talker.cpp)
target_link_libraries (talker_node ${catkin_LIBRARIES})
File content :
cmake_minimum_required(VERSION 2.8.3)
project(my_package)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
)
add_executable(talker_node src/talker.cpp)
target_link_libraries (talker_node ${catkin_LIBRARIES})
include_directories(
${catkin_INCLUDE_DIRS}
)
finally I compile the code in /home/bc/catkin_ws directory with running
catkin_make
The output:
Base path: /home/bc/catkin_ws
Source space: /home/bc/catkin_ws/src
Build space: /home/bc/catkin_ws/build
Devel space: /home/bc/catkin_ws/devel
Install space: /home/bc/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/bc/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/bc/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/bc/catkin_ws/devel;/opt/ros/melodic
-- This workspace overlays: /home/bc/catkin_ws/devel;/opt/ros/melodic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/bc/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.17")
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.20
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - my_package
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'my_package'
-- ==> add_subdirectory(my_package)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bc/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/bc/catkin_ws/build"
####
Scanning dependencies of target talker_node
[ 50%] Building CXX object my_package/CMakeFiles/talker_node.dir/src/talker.cpp.o
[100%] Linking CXX executable talker_node
[100%] Built target talker_node
But If I try to run
rosrun my_package talker_node
I get the error message
[rosrun] Couldn't find executable named talker_node below /home/bc/catkin_ws/src/my_package
What should I do ??? Please help me Thanks.
Did you
source ./devel/setup.bash
?