rosservice unable to load type, and yes I've sourced... [closed]

asked 2021-12-12 15:46:56 -0500

Joshua Kordani gravatar image

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");

the .srv

float64 linear_x
float64 angular_z
---
string msg_feedback

the CMakeLists.txt with comments removed

cmake_minimum_required(VERSION 3.0.2)
project(ball_chaser)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++14)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  message_generation
  message_runtime
  roscpp
  rosconsole
  std_msgs
)

## Generate services in the 'srv' folder
add_service_files(
   FILES
   DriveToTarget.srv
)

## Generate added messages and services with any dependencies listed here
 generate_messages(
   DEPENDENCIES
   std_msgs
 )

include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

${catkin_EXPORTED_TARGETS})

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)
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Mike Scheutzow
close date 2021-12-13 12:04:34.963023

Comments

This is a duplicate of #q392694

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-12-13 12:05:01 -0500 )edit