ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

can't create a service server in new package

asked 2022-12-21 16:24:47 -0500

p.h.dias gravatar image

updated 2022-12-23 10:31:12 -0500

I'm fairly new to linux and ROS, so any help is appreciated. I'm trying to create a service in a new package right after completing the tutorials on wiki, but I'm getting an error message saying my server doesn't exist:

pedro@pedroPC:~/catkin_ws$ rosrun pkg_pedro1 sub_two_ints_server[rosrun] 
Couldn't find executable named sub_two_ints_server below /home/pedro/catkin_ws/src/pkg_pedro1

Using catkin_make, it seems that it ignores my new package, but I can't be sure:

pedro@pedroPC:~/catkin_ws$ catkin_make --force-cmake
Base path: /home/pedro/catkin_ws
Source space: /home/pedro/catkin_ws/src
Build space: /home/pedro/catkin_ws/build
Devel space: /home/pedro/catkin_ws/devel
Install space: /home/pedro/catkin_ws/install
####
#### Running command: "cmake /home/pedro/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/pedro/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/pedro/catkin_ws/install -G Unix Makefiles" in "/home/pedro/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/pedro/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/pedro/catkin_ws/devel;/opt/ros/noetic
-- This workspace overlays: /home/pedro/catkin_ws/devel;/opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/pedro/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- 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/python3 (found version "3.8.10") 
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- Using CATKIN_WHITELIST_PACKAGES: beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- beginner_tutorials: 1 messages, 2 services
CMake Warning at /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:166 (message):
  catkin_package() DEPENDS on 'system_lib' but neither
  'system_lib_INCLUDE_DIRS' nor 'system_lib_LIBRARIES' is defined.
Call Stack (most recent call first):
  /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  beginner_tutorials/CMakeLists.txt:105 (catkin_package)


-- Configuring done
-- Generating done
-- Build files have been written to: /home/pedro/catkin_ws/build
####
#### Running command: "make -j8 -l8" in "/home/pedro/catkin_ws/build"
####
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_nodejs
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoArrays
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_Num
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
[ 19%] Built target beginner_tutorials_generate_messages_py
[ 34%] Built target beginner_tutorials_generate_messages_lisp
[ 42%] Built target beginner_tutorials_generate_messages_nodejs
[ 57%] Built target beginner_tutorials_generate_messages_eus
[ 69%] Built target beginner_tutorials_generate_messages_cpp
[ 69%] Built target beginner_tutorials_gencpp
[ 69%] Built target beginner_tutorials_generate_messages
[ 76%] Built target add_two_arrays_client
[ 84%] Built target add_two_arrays_server
[ 92%] Built target add_two_ints_server
[100%] Built target add_two_ints_client

----EDIT 1----

The service that I'm trying to create is in a package called pkg_pedro1, but catkin_make seem to be working only with the package beginner_tutorials, which is the package used on the tutorials found on the wiki page.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-12-22 06:55:55 -0500

Mike Scheutzow gravatar image

rosrun pkg_pedro1 sub_two_ints_server

According to your catkin_make log, the ros node is named add_two_ints_server.

edit flag offensive delete link more

Comments

add_two_ints_server is a service in beginner_tutorials package. sub_two_ints_server is a service that I'm trying to create in a new package called pkg_pedro1, which doesn't seem to appear when i run catkin_make:

    -- Using CATKIN_WHITELIST_PACKAGES: beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p.h.dias gravatar image p.h.dias  ( 2022-12-23 10:28:28 -0500 )edit

The ros package name is not specified by the directory name you use, it is specified inside the CMakeLists.txt file and the package.xml file (yes, both of them).

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-12-23 15:49:33 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-12-21 16:24:47 -0500

Seen: 83 times

Last updated: Dec 23 '22