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

Error opening file (/tmp/buildd/ros-hydro-opencv2-2.4.6-3precise-20140303-2216/modules/highgui/src/cap_ffmpeg_impl.hpp:537)

asked 2014-05-31 14:34:12 -0500

rennis_02 gravatar image

updated 2022-03-20 10:17:08 -0500

lucasw gravatar image

Hi,

This is my first post here so hopefully I will provide you with the right information.

I am running ROS Hydro on Ubuntu 12.04 through a virtual machine.

ROS seems to be working ok, I built my workspace using catkin and ROS is recognizing and compiling packages when I run catkin_make. I went through all of the tutorials without a problem.

When I try to run one of my nodes using rosrun sb_vision LineDetector.cpp I am getting this error: Error opening file (/tmp/buildd/ros-hydro-opencv2-2.4.6-3precise-20140303-2216/modules/highgui/src/cap_ffmpeg_impl.hpp:537)

I have deleted all of the source code that had anything to do with OpenCV and commented out things dealing with OpenCV in the CMakeLists but it still has this problem.

I have sb_vision as a package and in it's src section there is Line_Detector.cpp, I have also included the CMakeLists.txt in sb_vision below. Other folders in sb_vision are: include, catkin, catkin_generated, cmake, CMakeFiles, devel, gtest,msg, test_results and package.xml.

Line_Detector.cpp:

#include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>
int main(int argc, char **argv)
{
  //Initialize ROS
 ros::init(argc, argv, "Line_Detector");
  ros::NodeHandle n;
  ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);
  ros::Rate loop_rate(10);
  int count = 0;
  while (ros::ok())
  {
    std_msgs::String msg;
    std::stringstream ss;
    ss << "hello world " << count;
    msg.data = ss.str();
    ROS_INFO("%s", msg.data.c_str());
    chatter_pub.publish(msg);
    ros::spinOnce();
    loop_rate.sleep();
    ++count;
  }
  return 0;
}

Here is my CMakeLists.txt, I have tried commenting and uncommenting anything to do with OpenCV

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(sb_vision)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  message_generation 
)
find_package(OpenCV REQUIRED)

add_message_files(
  FILES
  Num.msg

)

generate_messages(
   DEPENDENCIES
  std_msgs
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES sb_vision
   CATKIN_DEPENDS message_runtime roscpp rospy std_msgs
#  DEPENDS system_lib
)

include_directories(
  ${catkin_INCLUDE_DIRS}
)
include_directories(
  ${OpenCV_INCLUDE_DIRS}
)

add_executable(Line_Detector src/Line_Detector.cpp)

#target_link_libraries( Line_Detector ${OpenCV_LIBS} ${catkin_LIBRARIES})
add_dependencies(Line_Detector sb_vision_generate_messages_cpp)

Any help would be much appreciated. If I can clarify anything or provide you with any more information I will happily do so. Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-06-02 06:03:03 -0500

gvdhoorn gravatar image

When I try to run one of my nodes using rosrun sb_vision LineDetector.cpp [..]

This seems strange: as far as I can tell from your CMakeLists.txt, the executable binary is called LineDetector, not LineDetector.cpp (which is the source file).

After building your workspace, source the devel workspace and see if this works:

rosrun sb_vision LineDetector
edit flag offensive delete link more

Comments

I remade the package, sourced the devel workspace and am able to run things now... I even added the OpenCV code back in and things are going well. You were right about the executable being called LineDetector not LineDetector.cpp. Thank you!

rennis_02 gravatar image rennis_02  ( 2014-06-02 13:10:14 -0500 )edit

Question Tools

Stats

Asked: 2014-05-31 14:34:12 -0500

Seen: 1,203 times

Last updated: Jun 02 '14