Ask Your Question
0

Unable to show messages

asked 2017-07-06 04:03:05 -0600

TobiasE gravatar image

updated 2017-07-06 04:35:18 -0600

I've seen similar questions, but they do not solve my problem. http://answers.ros.org/question/18707...

I am using Ubuntu 12.04 and ROS Indigo.

If I like my messages to be shown by the command: rosmsg show only the standard ROS-messages are showing up. (Using tab) If I use the name of the msgs like rosmsg show ATestMsg.msg the message can not be found. (error: Could not find msg 'ATestMsg')

My messages can't be found. I think I've done everything the same as in the tutorial explained. Neither source devel/setup.bash nor catkin clean and rebuild seem to solve the problem.

My CMakeList

cmake_minimum_required(VERSION 2.8.3)
project(a_vector_field)
## Use C++11
## add_definitions(--std=c++11)
## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
  visualization_msgs
  magnetic_controller
  mag_msgs
  tf
  roscpp
   rospy
   std_msgs
   message_generation
)
find_package(Qt4 COMPONENTS QtCore QtGui)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
include_directories(include
 ${catkin_INCLUDE_DIRS}
${mag_msgs_INCLUDE_DIRS}
)
add_message_files(
   FILES
   CurrentsStamped.msg
   FieldStamped.msg
   ATestMsg.msg
   SecondTestMsg.msg
 )
add_service_files(
  FILES
  get_magnetic_field.srv
  load_calibration_file.srv
  set_magnetic_field.srv
  set_magnetic_field_gradient.srv
  #set_position.srv
)
generate_messages(
   DEPENDENCIES
   std_msgs
   mag_msgs
)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
catkin_package(
  INCLUDE_DIRS
    include
## CATKIN_DEPENDS: catkin_packages dependent projects also need
  CATKIN_DEPENDS 
    mag_msgs
    message_runtime
    roscpp
## DEPENDS: system dependencies of this project that dependent projects also need
#  DEPENDS 
)
include_directories(
  include
 ${mag_msgs}
 ${catkin_INCLUDE_DIRS}
 ${armadillo_INCLUDE_DIRS}
 ${blas_INCLUDE_DIRS}
 ${lapack_INCLUDE_DIRS}
)
#add_dependencies(mag_msgs ${catkin_EXPORTED_TARGETS})
###########
## Build ##
###########
add_custom_target(${PROJECT_NAME}_OTHER_FILES ALL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} SOURCES ${EXTRA_FILES})
## Specify additional locations of header files
## Your package locations should be listed before other locations
## Declare a C++ executable
##install(DIRECTORY include/${PROJECT_NAME}/
##        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
add_executable(${PROJECT_NAME}
  src/${PROJECT_NAME}_node.cpp
  src/magneticfield.cpp
  src/avectorfield.cpp
)
## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}
  ${catkin_LIBRARIES}
${ARMADILLO_LIBRARIES}
${BLAS_LIBRARIES}
 ${LAPACK_LIBRARIES}
)
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES})
add_library(armadillo src/magneticfield.cpp src/avectorfield.cpp )
install(TARGETS armadillo #blas lapack
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}/
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
        PATTERN ".svn" EXCLUDE)

And my package.xml

<?xml version="1.0"?>
<package>
  <name>a_vector_field</name>
  <version>0.0.0</version>
  <description>The a_vector_field package</description>
  <license>TODO</license>
  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>visualization_msgs</build_depend>
  <build_depend>mag_msgs</build_depend> 
<buildtool_depend>mag_msgs</buildtool_depend> 
<build_depend>magnetic_controller</build_depend>
 <build_depend>libarmadillo-dev</build_depend>
<build_depend>message_generation</build_depend>
  <run_depend>message_runtime</run_depend>
 <run_depend>magnetic_controller</run_depend>
  <run_depend>mag_msgs</run_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>visualization_msgs</run_depend>
  <export>
  </export>
</package>

Did somebody ever occur similar problem? For any solution I would be very thankful.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-07-06 07:00:57 -0600

TobiasE gravatar image

I could solve the problem - it seems to be a very trivial one.

The resourcing "source devel/setup.bash" needs to be done in every console window.

edit flag offensive delete link more

Comments

you can add it to your .bashrc file

jeanpolochon gravatar imagejeanpolochon ( 2017-07-06 07:47:16 -0600 )edit

@TobiasE: thanks for reporting back.

Could I ask you to just accept your own answer instead of closing the question? We try to avoid closing questions here on ROS Answers, as it's not visible from the question list why that was done. An answered question gets a green checkmark.

gvdhoorn gravatar imagegvdhoorn ( 2017-07-06 07:54:41 -0600 )edit

Ok, sorry about that. I can not do that as it requires more than 10 points.

TobiasE gravatar imageTobiasE ( 2017-07-06 08:05:46 -0600 )edit

No need to apologise. I've accepted it for you.

gvdhoorn gravatar imagegvdhoorn ( 2017-07-06 08:06:22 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-07-06 04:03:05 -0600

Seen: 200 times

Last updated: Jul 06 '17