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

nav3128's profile - activity

2022-12-13 12:38:32 -0500 received badge  Famous Question (source)
2020-01-27 12:10:45 -0500 marked best answer Cannot specify link libraries for target "node_name" which is not built by this project.

I'm trying to use opencv on kinetic. As per 4.1 on this wiki, I had to add a dependency on opencv2 and find_package in the CMakeLists.txt [instructions here].

This is my edited CMakeList.txt. I'm getting

 'CMake Error at pc_side/CMakeLists.txt:19 (target_link_libraries):
  Cannot specify link libraries for target "pc_side" which is not built by
  this project.

-- Configuring incomplete, errors occurred!
See also "/home/user/raspi/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/raspi/build/CMakeFiles/CMakeError.log".
Makefile:906: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(pc_side)

find_package(catkin REQUIRED COMPONENTS
  sensor_msgs
  cv_bridge
  rospy
  std_msgs
)

find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(pc_side ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

catkin_package()
include_directories(
  ${catkin_INCLUDE_DIRS}
)
2020-01-27 12:10:44 -0500 received badge  Supporter (source)
2020-01-27 12:10:33 -0500 received badge  Notable Question (source)
2020-01-27 12:10:31 -0500 received badge  Famous Question (source)
2020-01-27 12:10:31 -0500 received badge  Notable Question (source)
2019-09-12 09:09:14 -0500 received badge  Enthusiast
2019-09-03 12:49:43 -0500 received badge  Popular Question (source)
2019-09-02 17:44:24 -0500 received badge  Popular Question (source)
2019-09-02 03:37:33 -0500 marked best answer How to stop recording by camera node through an user input?

I would like to stop the camera node through a different node. I was trying to implement this by sending a message through another node which is read by the camera node But, the problem is that the camera node runs on an infinite loop. Can I get a cpp implementation to stop this while loop through a subscribed message.

#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <opencv2/highgui/highgui.hpp>
#include <cv_bridge/cv_bridge.h>
#include <sstream> // for converting the command line parameter to integer
#include "std_msgs/Int32.h"

bool camOn = true;


void sendCamera(const std_msgs::Int32::ConstPtr& msg)
{
   if (msg->data == 1){
    camOn = true;}
   else if (msg->data == 2){
    camOn = false;}
}

int main(int argc, char** argv)
{


  ros::init(argc, argv, "image_publisher");
  ros::NodeHandle nh;
  ros::Subscriber sub = nh.subscribe("/camera_status", 1000, sendCamera);
  image_transport::ImageTransport it(nh);
  image_transport::Publisher pub = it.advertise("camera/image", 1);


  cv::VideoCapture cap(0);
  if(!cap.isOpened()) return 1;
  cv::Mat frame;
  sensor_msgs::ImagePtr msg;

  ros::Rate loop_rate(10);
    while(nh.ok()){
      while (camOn) {
        ros::Subscriber sub = nh.subscribe("/camera_status", 1000, sendCamera);
        cap >> frame;
        // Check if grabbed frame is actually full with some content
        if(!frame.empty()) {
          msg = cv_bridge::CvImage(std_msgs::Header(), "bgr8", frame).toImageMsg();
          pub.publish(msg);
          cv::waitKey(1);
        }

        ros::spin();
        loop_rate.sleep();
    }    
  }
}
2019-09-02 03:37:33 -0500 received badge  Scholar (source)
2019-09-02 03:00:08 -0500 commented answer How to stop recording by camera node through an user input?

Is it 'overkill' because of the bandwidth required or something else?

2019-09-02 02:45:31 -0500 commented answer How to stop recording by camera node through an user input?

Thank you so much for your answer. I am a beginner to ROS and I don't have a clear idea about spin function. Now, I thin

2019-09-02 02:06:01 -0500 commented question Cannot specify link libraries for target "node_name" which is not built by this project.

I've edited the question to show the full error.

2019-09-02 02:05:43 -0500 edited question Cannot specify link libraries for target "node_name" which is not built by this project.

Cannot specify link libraries for target "node_name" which is not built by this project. I'm trying to use opencv on k

2019-09-02 02:04:20 -0500 edited question Cannot specify link libraries for target "node_name" which is not built by this project.

Cannot specify link libraries for target "node_name" which is not built by this project. I'm trying to use opencv on k

2019-09-02 02:04:20 -0500 received badge  Editor (source)
2019-09-01 15:42:54 -0500 asked a question Cannot specify link libraries for target "node_name" which is not built by this project.

Cannot specify link libraries for target "node_name" which is not built by this project. I'm trying to use opencv on k

2019-09-01 14:47:54 -0500 commented question How to stop recording by camera node through an user input?

I have edited my question to show you my attempt. It's still not working.

2019-09-01 14:45:34 -0500 edited question How to stop recording by camera node through an user input?

How to stop recording by camera node through an user input? I would like to stop the camera node through a different nod

2019-09-01 13:25:43 -0500 asked a question How to stop recording by camera node through an user input?

How to stop recording by camera node through an user input? I would like to stop the camera node through a different nod