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

fatal error: Geometry_msgs/Vector3Stamped.h directory not found

asked 2021-07-02 07:50:04 -0500

Fxaxo gravatar image

updated 2021-07-08 03:51:56 -0500

i tried to use this Github File: https://github.com/ros-drivers/um7.git i used git clone to download it, changed the CMakeLists.txt and tried the Command catkin_make. But it doesnt work i get the fatal Error back. I used already the geometry_msgs/Vector3 without problems but Vector3Stamped doesnt work... is there any Library to replace it ? or do anybody have a tip what i can Install to let it work ?

i use a Raspberry Pi4, Ubuntu 20.04 (focal) and Ros Noetic

i added the first the Error output, then the changes in the CMakeLists.txt and then the complete cpp File here :

Error if i let geometry_msgs/Vector3Stamped.h active :

/home/ubuntu/um7_driver/src/um7/src/main.cpp:37:10: fatal error: geometry_msgs/Vector3Stamped.h: No such file or directory 37 | #include "geometry_msgs/Vector3Stamped.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: * [CMakeFiles/um7_driver_2.dir/build.make:63: CMakeFiles/um7_driver_2.dir/um7/src/main.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:1097: CMakeFiles/um7_driver_2.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 1%] Built target std_msgs_generate_messages_cpp [ 1%] Built target _actionlib_msgs_generate_messages_check_deps_GoalStatus [ 1%] Built target _rosserial_msgs_generate_messages_check_deps_TopicInfo make: * [Makefile:141: all] Error 2

Invoking "make -j4 -l4" failed

Error if i comment geometry_msgs/Vector3Stamped out:

/home/ubuntu/um7_driver/src/um7/src/main.cpp:38:10: fatal error: ros/ros.h: No such file or directory 38 | #include "ros/ros.h" | ^~~~~~~~~~~ compilation terminated. make[2]: * [CMakeFiles/um7_driver_2.dir/build.make:63: CMakeFiles/um7_driver_2.dir/um7/src/main.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:1097: CMakeFiles/um7_driver_2.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 1%] Built target std_msgs_generate_messages_nodejs [ 1%] Built target _actionlib_msgs_generate_messages_check_deps_GoalID [ 1%] Built target _actionlib_msgs_generate_messages_check_deps_GoalStatusArray make: * [Makefile:141: all] Error 2 Invoking "make -j4 -l4" failed

Changes in CMakeLists.txt :

catkin_workspace()

include_directories( ${catkin_INCLUDE_DIRS})

add_executable( um7_driver_2 /home/ubuntu/um7_driver/src/um7/src/main.cpp ) target_link_libraries( um7_driver_2 ${catkin_LIBRARIES} )


the new CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3) project(um7_test)

find_package(catkin REQUIRED COMPONENTS roscpp serial sensor_msgs message_generation)

add_service_files( FILES Reset.srv )

generate_messages()

catkin_package( INCLUDE_DIRS include CATKIN_DEPENDS message_runtime )

#

Build

#

Specify additional locations of header files

Your package locations should be listed before other locations

include_directories(include ${catkin_INCLUDE_DIRS} )

Declare a cpp executable

add_executable(um7_driver src/main.cpp src/registers.cpp src/comms.cpp) target_link_libraries(um7_driver ${catkin_LIBRARIES} ) add_dependencies(um7_driver um7_generate_messages_cpp)

#

Install

#

install(TARGETS um7_driver RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} )

#

Testing

#

if(CATKIN_ENABLE_TESTING) find_package(roslint REQUIRED) catkin_add_gtest(${PROJECT_NAME}_test_registers test/test_registers.cpp src/registers.cpp) catkin_add_gtest(${PROJECT_NAME}_test_comms test/test_comms.cpp src/comms.cpp src/registers.cpp) target_link_libraries(${PROJECT_NAME}_test_comms util ${catkin_LIBRARIES})

file(GLOB LINT_SRCS src/*.cpp include/um7/registers.h include/um7/comms.h) roslint_cpp(${LINT_SRCS}) roslint_add_test() endif()

include_directories( ${catkin_INCLUDE_DIRS})

add_executable( um7_driver_2 /home/ubuntu/um7_driver/src/um7/src/main.cpp ) target_link_libraries( um7_driver_2 ${catkin_LIBRARIES} )


Complete cpp File main.cpp:

/** * * \file * \brief Main entry point for UM7 driver. Handles serial connection * details, as well as all ROS message stuffing, parameters, * topics, etc. * \author Mike Purvis mpurvis@clearpathrobotics.com (original code for UM6) * \copyright Copyright (c) 2013, Clearpath Robotics, Inc. * \author Alex Brown rbirac@cox.net ... (more)

edit retag flag offensive close merge delete

Comments

Could you include the compilation log, and the changes that was made in the CMakeLists.txt?

photon gravatar image photon  ( 2021-07-03 03:47:23 -0500 )edit

@Fxaxo: Some friendly advice: you need to pay more attention to the format of file names: the first letter of geometry_msgs is not capitialized, and the first letter of Vector3Stamped.h is capitalized.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-07-03 08:23:21 -0500 )edit

@Fxaxo Please don't create an "answer" unless you are telling us what the solution to the title of this post is. Additional information like you posted below should be added as a comment (like this one.) Please delete that answer and instead put the new info into a comment.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-07-05 07:27:05 -0500 )edit

The line in which you include ros.h is not valid c. Also, please show us the exact text of the error from catkin_make.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-07-05 07:37:29 -0500 )edit

oh okaz i understand ! okaz i postet the error output in the question. i already tried to install some sudo apt-get plug ins like ros-roscpp-msg to work with the ros library but it still not work... also with the geometry_msgs i installed already the ros-geometry-msgs

Fxaxo gravatar image Fxaxo  ( 2021-07-05 07:52:19 -0500 )edit

I suspect you are missing required lines in CMakeLists.txt. Have you provided lines with the necessary roscpp info? There are many, many examples of CMakeLists.txt for you to look at.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-07-05 08:29:14 -0500 )edit

hm i compared my CMakeLists to many others who using the lib ros/ros.h and i didnt found anything wrong ... i added the complete CMakeList like i have it in the question can u have a look on it and maybe see whats missing ?

Fxaxo gravatar image Fxaxo  ( 2021-07-05 10:12:50 -0500 )edit

Your CMakeLists.txt file does not look like any I have ever seen for a ROS1 package. You really need to find one from a package that actually compiles and use it as a reference for your own project.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-07-05 10:40:31 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2021-07-08 06:32:18 -0500

Mike Scheutzow gravatar image

updated 2021-07-08 06:34:40 -0500

You need to create a valid CMakeLists.txtfile. For an example, take a look at http://wiki.ros.org/roscpp_tutorials/...

edit flag offensive delete link more

Comments

This is probably the more correct solution after you have dug deeper into the issue. Even the code linked in the initial question (https://github.com/ros-drivers/um7) is a good enough example to follow

404RobotNotFound gravatar image 404RobotNotFound  ( 2021-07-08 11:59:34 -0500 )edit
0

answered 2021-07-04 10:27:52 -0500

404RobotNotFound gravatar image

Could be two problems coming together:

  1. Use geometry_msgs instead of Geometry_msgs (as mentioned in the comments)
  2. Make sure you change the include to geometry_msgs/Vector3Stamped.h if you only included geometry_msgs/Vector3.h. Vector3Stamped knows about the Vector3 message, but not vice versa so make sure you include the right message you are using.
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-07-02 07:50:04 -0500

Seen: 653 times

Last updated: Jul 08 '21