0
$\begingroup$

Rosanswers logo

http://answers.ros.org/question/188982/message-headers-wont-build-first/ http://answers.ros.org/question/202312/how-to-use-srv-in-another-package/ (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?


Originally posted by sailor91 on ROS Answers with karma: 3 on 2016-07-06

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

serial_interface::SerialWriteMsg is the service type, and includes both the request and the response.

Try using the request portion of the message instead:

serialMsg.request.header.frame_id = frame_id_;

Originally posted by ahendrix with karma: 47576 on 2016-07-06

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.