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

C++ executable file not build

asked 2022-02-15 13:36:56 -0500

ROS-Beginer gravatar image

i am new to ROS currently working on ROS Kinetic,i have an issue when i run this linefollowing.cpp file using the command “rosrun roscv linefollowing.cpp” (where roscv is the package name & “linefollowing.cpp” is the .cpp file),

the error;

 /home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 19: using: command not found
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 20: using: command not found
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 21: namespace: command not found
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 22: static: command not found
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 24: float: command not found
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 25: float: command not found
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 26: float: command not found
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 28: class: command not found
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 36: syntax error near unexpected token `('
/home/badhrisrini/line_follow_ws/src/roscv/src/linefollow.cpp: line 36: `  image_transport::Publisher image_pub_; //image publisher(we subscribe to ardrone image_raw)'

the code in this file is;

#include <ros/ros.h>
#include <stdio.h>
#include <iostream>
#include "std_msgs/String.h"
#include <image_transport/image_transport.h>
#include <cv_bridge/cv_bridge.h>
#include <sensor_msgs/image_encodings.h>
#include <opencv2/imgproc/imgproc.hpp>     //make sure to include the relevant headerfiles
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <cv_bridge/CvBridge.h>
#include <cvaux.h>
#include<math.h>
#include <cxcore.h>
#include "turtlesim/Velocity.h"

/*here is a simple program which demonstrates the use of ros and opencv to do image manipulations on video streams given out as image topics from the monocular vision
of robots,here the device used is a ardrone(quad-rotor).*/
using namespace std;
using namespace cv;
namespace enc = sensor_msgs::image_encodings;
static const char WINDOW[] = "Image window";

float prevVelocity_angular ,prevVelocity_linear ,newVelocity_angular ,newVelocity_linear ;
float derive_angular, derive_linear, dt = 0.5;
float horizontalcount;

class ImageConverter
{
  ros::NodeHandle nh_;
  ros::NodeHandle n;
  ros::Publisher pub ;
  ros::Publisher tog;
  image_transport::ImageTransport it_;    
  image_transport::Subscriber image_sub_; //image subscriber 
  image_transport::Publisher image_pub_; //image publisher(we subscribe to ardrone image_raw)
  std_msgs::String msg;
public:
  ImageConverter()
    : it_(nh_)
  {
      pub= n.advertise<turtlesim::Velocity>("/drocanny/vanishing_points", 500);//
      image_sub_ = it_.subscribe("/ardrone/image_raw", 1, &ImageConverter::imageCb, this);
      image_pub_= it_.advertise("/arcv/Image",1);    
  }

  ~ImageConverter()
  {
    cv::destroyWindow(WINDOW);
  }

  void imageCb(const sensor_msgs::ImageConstPtr& msg)
  {

     sensor_msgs::CvBridge bridge;//we need this object bridge for facilitating conversion from ros-img to opencv
   IplImage* img = bridge.imgMsgToCv(msg,"rgb8");  //image being converted from ros to opencv using cvbridge
   turtlesim::Velocity velMsg;
 CvMemStorage* storage = cvCreateMemStorage(0);
     CvSeq* lines = 0;
       int i,c,d;
       float c1[50]; 
       float m,angle;
          float buf;
          float m1;
       float dis;
       int k=0,k1=0; 
      int count=0;  

      float xv;
      float yv;
      int vc=0;
     float xvan=0,yvan=0;
      static float xvan1=0,yvan1=0;
    float num=0;
   static float count1=0;
  float dv;
float vxx,vyy;

         cvSetImageROI(img, cvRect(0, 0 ...
(more)
edit retag flag offensive close merge delete

Comments

I don't think you would need .cpp in rosrun. As for the executable, what locations did you look for it?

MakinoharaShouko gravatar image MakinoharaShouko  ( 2022-02-15 14:45:22 -0500 )edit

Usually it should be build in "devel/lib/" in package directory, so i looked up there!!! But i cant find it there!! So i searched for it in the whole workspace but i cant still find it!!! @MakinaharaShouko

ROS-Beginer gravatar image ROS-Beginer  ( 2022-02-16 09:09:14 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2022-03-22 15:19:11 -0500

pisers gravatar image

Hi. Hope I am not too late!!

The executable not available might be due to CMakeLists.txt not being configured correctly. Can you post a Screenshot of the "catkin_make" command output and "CMakeLists.txt" file if possible?

If you have already solved the query. Feel free to reply with the solution too!!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-02-15 13:36:56 -0500

Seen: 109 times

Last updated: Feb 15 '22