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

jesst's profile - activity

2021-04-16 11:18:10 -0500 received badge  Taxonomist
2017-04-19 12:12:19 -0500 received badge  Famous Question (source)
2017-01-11 03:45:56 -0500 received badge  Notable Question (source)
2017-01-11 03:45:56 -0500 received badge  Popular Question (source)
2016-09-30 10:59:52 -0500 received badge  Famous Question (source)
2016-09-08 03:39:49 -0500 received badge  Notable Question (source)
2016-08-05 10:28:02 -0500 received badge  Student (source)
2016-07-31 18:57:31 -0500 received badge  Popular Question (source)
2016-07-24 06:15:22 -0500 asked a question How to use opencv3 package with indigo

I have segmentation fault when using cv_bridge with opencv3 package in ros indigo, i searched similar questions but cant find any proper solution, ı am trying to use cv_bridge without recompile with opencv3 package; and ı guess ı am not give right dependencies,

My CMakeList

find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_transport
  message_generation
  roscpp
  std_msgs
)

find_package(OpenCV 3 REQUIRED)
include_directories(
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
)

add_executable(kcf_algorithm src/kcf_algorithm.cpp)
target_link_libraries(kcf_algorithm ${OpenCV_LIBRARIES} ${catkin_LIBRARIES} )
add_dependencies(kcf_algorithm beginner_tutorials_gencpp)

My Package.xml

  <buildtool_depend>catkin</buildtool_depend>
   <build_depend>cv_bridge</build_depend> 
  <build_depend>image_transport</build_depend>
  <build_depend>message_generation</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <run_depend>cv_bridge</run_depend> 
  <run_depend>image_transport</run_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>std_msgs</run_depend>

And my code

#include <opencv2/core/utility.hpp>
#include <opencv2/tracking.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <cstring>


#include <ros/ros.h>
#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <sensor_msgs/image_encodings.h>

using namespace std;
using namespace cv;


int flag = 0;
Rect2d roi;
Mat frame;
Ptr<Tracker> tracker = Tracker::create( "KCF" );
cv_bridge::CvImagePtr cv_ptr;


class kcf_class{
    image_transport::ImageTransport it_;
    image_transport::Subscriber image_sub_;
    image_transport::Publisher image_pub_;
    ros::NodeHandle nh_;

public:
      kcf_class()
        : it_(nh_)
      {
        // Subscrive to input video feed and publish output video feed
        image_sub_ = it_.subscribe("/camera/image_raw", 1,
          &kcf_class::imageCb, this);

      }

    void imageCb(const sensor_msgs::ImageConstPtr& msg)
    {
        try
        {
            cv_ptr = cv_bridge::toCvCopy(msg,sensor_msgs::image_encodings::BGR8);

        }
        catch(cv_bridge::Exception& e)
        {
            ROS_ERROR("cv_bridge exception %s",e.what());
            return;
        }

          if(!cv_ptr->image.empty())
          {
              frame = cv_ptr->image;
              detectAndDisplay();
          }
    }



     void detectAndDisplay()
     {
         if( flag == 0)
         {
         roi=selectROI("tracker",frame);

         //quit if ROI was not selected
         if(roi.width==0 || roi.height==0)
             return;

         tracker->init(frame,roi);

         printf("Start the tracking process, press ESC to quit.\n");
         flag ++;
         }
         else {
             for ( ;; ){
                 if(frame.rows==0 || frame.cols==0)
                     break;
                 tracker->update(frame,roi);
                 rectangle( frame, roi, Scalar( 255, 0, 0 ), 2, 1 );
                 imshow("tracker",frame);
                 if(waitKey(1)==27)break;
             }
         }
         return ;
     }

};

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

    ros::init(argc,argv,"image_converter");
    kcf_class kcf;
    ros::spin();
    return 0;
}
2016-07-15 03:15:56 -0500 asked a question How to use ROS Indigo Opencv tracker

I'am trying to implement tracker from here for my robot but types and functions unresolved in eclipse, i changed neccesary headers without error

opencv2/tracking.hpp> --> opencv2/video/tracking.hpp

opencv2/videoio.hpp> --> opencv2/videoio/videoio.hpp

opencv2/highgui.hpp> --> opencv2/highgui/highgui.hpp

but still get Type Tracker could not be resolved and function selectROI could not be resolved errors, normally these are in opencv_contrib repo but i am not sure how to implement these to ROS.

2016-07-14 09:27:28 -0500 answered a question velocity smoother

hey can you solve it ? I want to do same thing

2016-06-25 15:08:22 -0500 received badge  Editor (source)
2016-06-25 14:48:48 -0500 asked a question Kinect2 Turtlebot Follower adaptation

Hey everybody ! I'm newbie and trying to write Turtlebot Follower with Kinect2, But actually i am lack of understanding right now about finding avarage of position and adding this values to geometry_msg and when i start to node, Turtlebot start to moving back ( very fast), So any explanation about the code makes me happy

Below it's my code ( I'm try to adapt for Kinect2 , without using dynamic server and nodelets, you can easily find the original code. ) So i didn't understand what i am doing wrong.

#include <ros/ros.h>
#include <pluginlib/class_list_macros.h>
#include <geometry_msgs/Twist.h>
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/PCLPointCloud2.h>
#include <pcl/conversions.h>
#include <pcl_ros/transforms.h>
ros::Subscriber pcl_subscriber;
ros::Publisher geometry_publisher;



void poseCallback(const sensor_msgs::PointCloud2ConstPtr& input){    


  //X,Y,Z of the centroid
  double x = 0.0;
  double y = 0.0;
  double z = 0.0;
//Number of points observed
unsigned int nm = 0;
double min_y_ = 0.1;
double max_y_ = 0.5;
double min_x_ = -0.2;
double max_x_ = 0.2;
double max_z_ = 0.8;
double goal_z_ = 0.6;
double z_scale_ = 1.0;
double x_scale_ = 5.0;    



 pcl::PCLPointCloud2 pcl_pc2;
     pcl_conversions::toPCL(*input,pcl_pc2);
     pcl::PointCloud<pcl::PointXYZ>::Ptr temp_cloud(new pcl::PointCloud<pcl::PointXYZ>);
     pcl::fromPCLPointCloud2(pcl_pc2,*temp_cloud);
     //Iterate through all the points in the region and find the average of the position
    BOOST_FOREACH (const pcl::PointXYZ& pt, temp_cloud->points)
    {
        //First, ensure that the point's position is valid. This must be done in a seperate
        //if because we do not want to perform comparison on a nan value.
        if(!std::isnan(x) && !std::isnan(y) && !std::isnan(z))
        {
            //Test to ensure the point is within the acceptable box.
            if(-pt.y > min_y_ && -pt.y < max_y_ && pt.x < max_x_ && pt.x > min_x_ && pt.z < max_z_)
            {
                //Add the point to the totals
                x += pt.x;
                y += pt.y;
                z += pt.z;
                nm++;
            }
        }
    }
    /*If there are points, find the centroid and calculate the
     * command goal If there are no points, simply publish a stop goal
     * */
    if(nm)
    {
        x /= nm;
        y /= nm;
        z /= nm;
        geometry_msgs::Twist cmd;
        cmd.linear.x = (z - goal_z_) * z_scale_;
        cmd.angular.z = -x * x_scale_;
        geometry_publisher.publish(cmd);
    }
    else
    {
        ROS_DEBUG("No points detected,stopping the robot");
        geometry_publisher.publish(geometry_msgs::Twist());
    }
}
int main(int argc, char **argv){
    ros::init(argc,argv,"follower");
    ros::NodeHandle n;
    ros::NodeHandle n2;
    pcl_subscriber = n.subscribe<sensor_msgs::PointCloud2>("/kinect2/sd/points",10,poseCallback);
    geometry_publisher = n2.advertise<geometry_msgs::Twist>("cmd_vel_mux/input/teleop",1);
    ros::spin();
    return 0;
}
2016-06-14 04:15:06 -0500 received badge  Enthusiast
2016-06-14 04:15:06 -0500 received badge  Enthusiast
2016-06-11 10:16:23 -0500 commented question ROS can't make SLAM map(TurtleBot KinectV2)

No body really ?

2016-06-11 05:17:00 -0500 received badge  Notable Question (source)
2016-06-10 17:33:28 -0500 received badge  Popular Question (source)
2016-06-10 07:29:01 -0500 commented question Useing Rviz from Kinect v2 (xbox one)

Is it solved, i have the same problem ?

2016-06-10 06:10:02 -0500 asked a question ROS can't make SLAM map(TurtleBot KinectV2)

ROS Indigo Ubuntu 14.04.4(Workstation and Turtlebot Both) Kobuki Base-KinectV2 Hi guys! I have problem with making MAP and also visualization on RVIZ i follow these steps;

1)roslaunch kinect2_bridge kinect2_bridge.launch

2)roslaunch turtlebot_bringup minimal.launch

3)roslaunch turtlebot_navigation gmapping_demo.launch

4)roslaunch turtlebot_rviz_launchers view_navigation.launch

I can see the image but can not get any visualization on Rviz, sensors are working (bumper) also ı can see the turtlebot movings in the map and can move with teleop, but cant make any 2D Nav Goal (without keyboard teleop)

ScreenShot https://postimg.org/image/5jwf00drf/

camera node Not connecting Error) (Maybe it's help) https://postimg.org/image/xboajbz3f/

how can i solve this issue ?