rosservice can't find type, and yes I've sourced
I have a package with two nodes. One hosts a service that takes throttle and steer, and publishes a drive command. The other makes use of this service. The the client node can use the service just fine, but rosservice can't find the service type. I promise I've sourced the environment.
The node hosting the service,
bool handle_drive_request(ball_chaser::DriveToTarget::Request &mreq, ball_chaser::DriveToTarget::Response &mresp ) {
geometry_msgs::Twist motor_command;
...
auto service = n.advertiseService("/ball_chaser/command_robot", &handle_drive_request);
The client node
client = n.serviceClient<ball_chaser::DriveToTarget>("/ball_chaser/command_robot");
CMakeLists.txt
cmake_minimum_required(VERSION 3.0.2)
project(ball_chaser)
add_compile_options(-std=c++14)
find_package(catkin REQUIRED COMPONENTS
message_generation
message_runtime
roscpp
rosconsole
std_msgs
)
add_service_files(
FILES
DriveToTarget.srv
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
)
include_directories(
${catkin_INCLUDE_DIRS}
)
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(drive_bot src/drive_bot.cpp)
target_link_libraries(drive_bot ${catkin_LIBRARIES})
add_dependencies(drive_bot ball_chaser_generate_messages_cpp)
add_executable(process_image src/process_image.cpp)
target_link_libraries(process_image ${catkin_LIBRARIES})
add_dependencies(process_image ball_chaser_generate_messages_cpp)
Code is here
build and source the workspace, then run roslaunch src/my_robot/launch/ball-chase.launch (it wouldn't tab complete this, not sure why), in another tab, run rosservice call /ball_chaser/command_robot <tab complete=""> error is "invalid type, did you forget to run make?"
After blowing away devel and build and reissuing catkin_make it still doesn't work, output of env ros is here
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/home/jkordani/path/to/Ball-Chaser/catkin_ws/src:/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROS_PYTHON_VERSION=2
ROS_VERSION=1
ROSLISP_PACKAGE_DIRECTORIES=/home/jkordani/pathtp/Ball-Chaser/catkin_ws/devel/share/common-lisp
ROS_DISTRO=kinetic
ROS_LANG_DISABLE=genlisp:geneus:genpy:gennodejs
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
Please post your full source, and the full error output.
updated per your instructions
You did not indicate that you have started the node that provides the service.
source
only sets up the bash environment. What doesrosservice list
tell you?yes, I run the launch file and /ball_chaster/command robot is listed. output is
Your git repo compiles and the service runs as expected for me on melodic. rosservice works from the command line.
I would try doing a clean build: remove your top-level
devel
andbuild
directories, and runcatkin_make
again. If that doesn't work, show us the output from:env | grep ROS
Updated per your instructions
From what you showed, your ROS environment vars look OK, assuming you have no non-ascii characters or space characters in the portion of the directory names you redacted.
I already told you the src files seem ok since the repository works on my machine. So that indicates the issue is some difference in the build environment.