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

sailor91's profile - activity

2020-12-11 01:50:17 -0500 received badge  Famous Question (source)
2020-12-11 01:50:17 -0500 received badge  Notable Question (source)
2020-12-11 01:50:17 -0500 received badge  Popular Question (source)
2016-07-06 12:03:41 -0500 received badge  Scholar (source)
2016-07-06 10:48:51 -0500 asked a question How to use ros srv in different pkg

http://answers.ros.org/question/18898... http://answers.ros.org/question/20231... (these answers didn't help me)

Here is the problem:

1) ros pkg serial_interface is providing the service SerialWriteMsg.srv. A test client inside this package can use the service.

2) ros pgk conversions wants to use this service. Here the CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(conversions)

set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-write-strings -g ${CMAKE_CXX_FLAGS}")

find_package(catkin REQUIRED COMPONENTS
  message_generation
  serial_interface
  ackermann_msgs
  roscpp
  rospy
  std_msgs
  tf
  tf2
  tf2_ros
)

add_message_files(
   FILES
   SteeringMsgStamped.msg
)

generate_messages(
   DEPENDENCIES
   std_msgs
)

catkin_package(
  INCLUDE_DIRS include
  CATKIN_DEPENDS message_generation roscpp rospy std_msgs
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

add_executable(velocity_conversion src/velocity_conversion.cpp)
target_link_libraries(velocity_conversion ${catkin_LIBRARIES})
add_dependencies(velocity_conversion serial_interface_generate_messages_cpp)
...

Here part of the package.xml

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>serial_interface</build_depend>
  <build_depend>ackermann_msgs</build_depend>
  <build_depend>message_generation</build_depend>

  <run_depend>roscpp</run_depend>
  <run_depend>rospy</run_depend>
  <run_depend>std_msgs</run_depend>
  <run_depend>serial_interface</run_depend>
  <run_depend>ackermann_msgs</run_depend>
  <run_depend>message_runtime</run_depend>
  <run_depend>message_generation</run_depend>

Here is the srv file

Header header
uint8 type
int32 data
---
bool done

But this error occurs

catkin_ws/src/conversions/src/velocity_conversion.cpp:28:13: error: ‘struct serial_interface::SerialWriteMsg’ has no member named ‘header’
   serialMsg.header.frame_id = frame_id_;

Would you please help me?