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

rasoo's profile - activity

2022-06-05 20:19:58 -0500 received badge  Taxonomist
2019-01-17 06:54:04 -0500 received badge  Famous Question (source)
2018-12-05 17:57:50 -0500 received badge  Notable Question (source)
2018-12-05 17:57:50 -0500 received badge  Popular Question (source)
2018-09-19 14:21:18 -0500 marked best answer How to get the distance in meter from PointCloud Data?

Hello, I am pretty new with ROS and Robotino. I am using ROS-Indigo, Ubuntu 14.4 and Robotino by Festo. I am subscribing the ros topic /distance_sensor :

ros::Subscriber sub = n.subscribe("/distance_sensors",1, distacne_sensor_Callback); 
void distacne_sensor_Callback(const sensor_msgs::PointCloudConstPtr& msg) 
{
       for (i=0;i<msg->points.size();i++) {
        ROS_INFO("X : %f",  msg->points[i].x);
        ROS_INFO("Y : %f",  msg->points[i].y);
        ROS_INFO("Z : %f",  msg->points[i].z);
}

I am getting the x,y,z values for each of the 9 distance sensors. How can I get the distance in meter using these data? I need to use these for obstacle detection. Can anyone give me any idea on this issue? Thank is advance.

2018-04-19 07:35:28 -0500 received badge  Famous Question (source)
2017-11-26 23:49:57 -0500 received badge  Notable Question (source)
2017-06-27 09:55:54 -0500 commented question Problem with creating map with Robotino and without laser scan

Seems like no one in the ROS community is intereste to creat map :p I am sorry, but using this approach I could not crea

2017-06-27 09:50:56 -0500 commented answer Problem using callback with multiple arguments via ApproximateTime synchronizer

Although its again a bit late ;)... but I am really glad to get answere from you :) thanks :)

2017-05-11 10:24:49 -0500 received badge  Famous Question (source)
2017-04-17 03:33:39 -0500 received badge  Notable Question (source)
2017-04-17 03:33:39 -0500 received badge  Famous Question (source)
2017-04-17 03:33:39 -0500 received badge  Popular Question (source)
2017-03-29 03:50:21 -0500 received badge  Famous Question (source)
2017-03-11 04:26:11 -0500 received badge  Popular Question (source)
2016-12-04 07:41:31 -0500 received badge  Famous Question (source)
2016-11-26 04:51:08 -0500 commented answer Problem using callback with multiple arguments via ApproximateTime synchronizer

And what is the solution for this kind of problem with a message type without header like float or bool ?

2016-10-27 04:46:02 -0500 received badge  Famous Question (source)
2016-10-24 07:50:50 -0500 received badge  Notable Question (source)
2016-10-23 21:23:03 -0500 commented answer How can i get object distance using camera/depth/image_raw

the Topic /camera/depth/image is of TYPE_32FC1 and the Topic /camera/depth/image_raw is of TYPE_16UC1. now if need to know the depth information of (i,j)th pixel then what should i do?

2016-10-23 21:16:06 -0500 commented answer Get data values from depth image

why you are only interested for the depth value of center point? if I am not wrong, In your image some points or object could be more closer/far, getting the center point popnt distance does not imply that every point of the image are at same distance

2016-10-21 08:58:15 -0500 commented question How can i get object distance using camera/depth/image_raw

why absdiff method is giving some such wierd value?

2016-10-21 07:47:57 -0500 commented answer How can i get object distance using camera/depth/image_raw

Thanks for your response, but I am having some problem to understand. I added partial code in my original post. Can you please recheck it for me? I target is 1. movement detection by image compare 2. only detect when any object is within the range(0.6m).

2016-10-20 13:00:10 -0500 commented answer How can i get object distance using camera/depth/image_raw

image.data[0] -- does it means that the depth information for the zero-th pixel ?

2016-10-20 11:14:21 -0500 received badge  Popular Question (source)
2016-10-20 10:42:18 -0500 received badge  Student (source)
2016-10-20 09:20:13 -0500 commented answer Subscribe to sensor_msgs/PointCloud

ok. Thanks for your suggestion.

2016-10-20 09:01:16 -0500 received badge  Notable Question (source)
2016-10-20 08:41:08 -0500 commented question Sensor image convert and comparision using opencv

I have edited my question. Can you please have a look on it. :) thanks in advance.

2016-10-20 08:24:54 -0500 commented question Sensor image convert and comparision using opencv

hello Lucas, thanks for your concern. Somehow I manage to solve the problem. There was no error but it was not compiling.So I created a whole new project and put the packages one by one and it successfully compiled. Your previous suggestion was really helpful. Adding cv_bridge is working. :)

2016-10-20 06:48:41 -0500 commented question How can I get depth data from Kinect?

Hello, thanks for updating your solution here. It is quite easy to understand. But I have a question. Is there any quick solution to get the minimum depth of pixels. I know doing a for loop will give me the minimum depth. But is there any other solution for this?

2016-10-20 06:31:43 -0500 asked a question How can i get object distance using camera/depth/image_raw

Hello all, I am using the ros topic /camera/depth/image_raw. It publish sensor_msgs::image data with depth information. I can get the image but I do not exactly how can i get depth information. I need to what is the minimum distance of any pixel infront of the camera. I actually do not want to use the topic /camera/depth/points to measure the distance, as it is said /camera/depth/image_raw provides depth infromation. Can anyone please share some suggestion? I am using ros indigo, kinect, freenect.launch, opencv. Can anyone suggest me which library function is appropriate for me here

void callback(const sensor_msgs::Image::ConstPtr& msg){

 if(check_moving_obs)
 {
     if(img_previous.data.size() == 0)
     {
         img_previous = *msg;
         img_primary = *msg;
     }
     else
         {img_previous = img_current;}
    img_current = *msg;

     cout<<"------------------------header of msg :---------:"<< msg->header.seq <<"\n";
    cout<<"------------------------current image info :---------:"<<img_current.data.size()<<"\n";
    cout<<"------------------------Height :---------:"<<img_current.height<<"\n";
    cout<<"------------------------Width :---------:" <<img_current.width<<"\n";

    cout<<"------------------------previous image info :---------:"<<img_previous.data.size()<<"\n";
    cout<<"------------------------Height :---------:"<<img_previous.height<<"\n";
    cout<<"------------------------Width :---------:" <<img_previous.width<<"\n";


        //Convert from the ROS image message to a CvImage suitable for working with OpenCV for processing
            cv_bridge::CvImagePtr cv_ptr_prev, cv_ptr_cur;
            cv::Mat image_cur, image_pre, differenceImage;
            //thresholded difference image (for use in findContours() function)
            cv::Mat thresholdImage;

            try
            {

                //Always copy, returning a mutable CvImage
                //OpenCV expects color images to use BGR channel order.
                cv_ptr_cur = cv_bridge::toCvCopy(msg, enc::TYPE_32FC1);//cv_bridge::toCvCopy(img_current, enc::BGR8);
                cv_ptr_prev = cv_bridge::toCvCopy(img_previous, enc::TYPE_32FC1);//TYPE_16UC1


                image_cur = cv_ptr_cur->image;
                image_pre = cv_ptr_prev->image;
                int count_diff=0;
                bool motion_detected = false;

                //perform frame differencing with the sequential images.
                cv::absdiff(image_cur,image_pre,differenceImage);
                //threshold intensity image at a given sensitivity value
                cv::threshold(differenceImage,thresholdImage, 20,255,cv::THRESH_BINARY);
                cout<<"~~~~~~~~~~~~IMP~~~~~~~~~~difference image info :---------:"<<thresholdImage.rows<<"\n";
                cout<<"~~~~~~~~~~~~~IMP~~~~~~~~~difference image info :---------:"<<thresholdImage.cols<<"\n";
                for(int j=0; j< thresholdImage.rows; ++j)
                {
                    //const double* Mi = differenceImage.ptr<double>(j);
                    for(int i=0; i< thresholdImage.rows; ++i)
                    {
                        //cout<<"diff img pixel val : "<<Mi[i]<<"\n";
                        //double depth = thresholdImage.at<double>(cv::Point(j,i));
                        //cout<<"diff img depth val : "<<depth<<"\n";
                        cout<<"+++++++++++++++++++++++++++++++++++++++++++++\n";
                        cout<<"+++++ i: "<<i <<"------ j : "<< j<<"++++++++++++++++++++++++++++++++++++++++\n";
                        cout<<"+++++++++++++++++++++++++++++++++++++++++++++\n";
                        cout<<"current  image    : "<< image_cur.at<cv::Vec3b>(j,i)       << "cur img depth val : "<<image_cur.at<double>(cv::Point(j,i))<<"\n";
                        cout<<"previous  image   : "<< image_pre.at<cv::Vec3b>(j,i)       << "pre img depth val : "<<image_pre.at<double>(cv::Point(j,i))<<"\n";
                        cout<<"abs-diff  image   : "<< differenceImage.at<cv::Vec3b>(j,i) << "dif img depth val : "<<differenceImage.at<double>(cv::Point(j,i))<<"\n";
                        cout<<"threshholöd image : "<< thresholdImage.at<cv::Vec3b>(j,i ) << "thr img depth val : "<<thresholdImage.at<double>(cv::Point(j,i))<<"\n";
                        cout<<"+++++++++++++++++++++++++++++++++++++++++++++\n";

                    }

                }
                /*
                for(int j=0; j<image_cur.rows; ++j)
                {
                    if(count_diff > 150)
                    {
                        break;
                    }
                        for(int i=0; i<image_cur.cols; ++i)
                        {
                            int depth = image_cur.at<short int>(cv::Point(j,i));
                            if(depth < 0.6)
                            {
                                cout<<"##############something within the range infront of the camera...########################\n";
                                if(image_cur.at<cv::Vec3b>(j,i) != image_pre.at<cv::Vec3b>(j,i))
                                {
                                    cout<<"i : "<<i<<" ... j ...
(more)
2016-10-19 16:49:23 -0500 commented answer Turtlebot depth image not showing in image_view

Can you tell me how you called the callback from main? I am quite new and dont know how the callback is taking two param for msg_depth and msg_rgb

2016-10-19 08:12:52 -0500 commented question Sensor image convert and comparision using opencv

generate_messages(DEPENDENCIES std_msgs) find_package(catkin REQUIRED COMPONENTS sensor_msgs cv_bridge image_transport
roscpp rospy std_msgs genmsg message_generation pcl_conversions pcl_ros tf
)

2016-10-19 08:08:43 -0500 commented question Sensor image convert and comparision using opencv

add_executable(listener_depthImage_compare src/listener_depthImage_compare.cpp) target_link_libraries(listener_depthImage_compare ${catkin_LIBRARIES} ) add_dependencies(listener_depthImage_compare beginner_tutorials_generate_messages_cpp)

I am confused about the add_dependecies section.

2016-10-19 08:08:04 -0500 commented question Sensor image convert and comparision using opencv

Thank you once again for your valuable response. I changed it as per your suggestion. But still the program is not compiling. Can you please have look at the part below in the next comment and please suggest if i need any change. Because listener_depthImage_comparer.cpp is the file where i used it

2016-10-18 20:25:37 -0500 commented question Sensor image convert and comparision using opencv

Find catkin and any catkin packages

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg message_generation pcl_conversions pcl_ros tf
) find_package(PCL REQUIRED) ##find_package(OpenCV 2 REQUIRED)

2016-10-18 20:25:22 -0500 commented question Sensor image convert and comparision using opencv

Thanks @lucasw for your important observation. I added the line find_package(OpenCV 2 REQUIRED) But now its a new problem. My source is not building and it is hang. I have to restart my laptop. I guess now the installed version is different from openCV 2. But I cuold not solve the issue yet.

2016-10-18 15:31:12 -0500 received badge  Popular Question (source)
2016-10-17 10:04:20 -0500 asked a question Sensor image convert and comparision using opencv

Hello All, I want to compare two(or more) consecutive image to detect movement within a range. For example, if there is anything in front of kinect camera within 60cm then it will detect and then just tell me if the object is moving or stationary. I repeat, I do not need to track any object, do not need to detect any pattern. Just need ato know if anything is moving infront of the camera within a range. I am using ros indigo, ubuntu 14.04 and having kinect cam. I am subscribing the topic /camera/depth/image_raw and getting image of type sensor_msgs::Image. So now I want to compare the two image. If there is a difference in the images then the decision is that there is something moving in front of the camera. I want to use opencv image comparison feature.

edit 1: I used another node which subscribed /camera/depth/points , and from there i detected if there is something in front of camera within 60cm range. Then i published a boolean flag. Using this node below I was trying to know if there is something within the range, it will tell us if the object is static or moving. But now I want to do it in the same node below as I came to know /camera/depth/image_raw gives image with depth data and I can get it using opencv function int depth = image_cur.at<short int="">(cv::Point(j,i));

but somehow I am not getting it exactly. Like if there is nothing moving in front of camera, i get the response something is moving. Because in each frame there is difference of values. My question is, if nothing is moving infront of camera, then why the data array are not identical for sequential images ?

I am going to update the codes below,

#include <ros ros.h=""> #include <std_msgs bool.h=""> #include "std_msgs/String.h" #include "geometry_msgs/Twist.h" #include <sensor_msgs laserscan.h=""> #include <pcl_ros point_cloud.h=""> #include <pcl point_types.h=""> #include <boost foreach.hpp=""> #include <pcl point_types.h=""> #include <pcl filters="" passthrough.h=""> #include <stdio.h>

#include <image_transport image_transport.h=""> #include <opencv2 opencv.hpp=""> #include <opencv2 highgui="" highgui.hpp=""> #include <cv_bridge cv_bridge.h=""> #include <sensor_msgs image_encodings.h=""> #include <opencv2 imgproc="" imgproc.hpp="">

//Store all constants for image encodings in the enc namespace to be used later. namespace enc = sensor_msgs::image_encodings;

using namespace::std; using namespace cv;

sensor_msgs::Image img_previous, img_current, img_primary; std_msgs::Bool check_moving_obj , obstacle_found, is_moving_obs; bool check_moving_obs= true;

ros::Publisher pub, dec_pub;

double scale_linear_, scale_angular_; void dec_callback(const std_msgs::Bool::ConstPtr& msg) { check_moving_obs = msg->data; } void callback(const sensor_msgs::Image::ConstPtr& msg){

 if(check_moving_obs)
 {
     if(img_previous.data.size() == 0)
     {
         img_previous = *msg;
         img_primary = *msg;
     }
     else
         {img_previous = img_current;}
    img_current = *msg;

    cout<<"------------------------current image info :---------:"<<img_current.data.size()<<"\n";
    cout<<"------------------------Height :---------:"<<img_current.height<<"\n";
    cout<<"------------------------Width :---------:" <<img_current.width<<"\n";

    cout<<"------------------------previous image info :---------:"<<img_previous.data.size()<<"\n";
    cout<<"------------------------Height :---------:"<<img_previous.height<<"\n";
    cout<<"------------------------Width :---------:" <<img_previous.width<<"\n";


        //Convert from the ROS image message to ...
(more)
2016-10-15 19:02:52 -0500 commented question Kinect Depth Image for tracking moving object

Can you please share me which method you tried.I was also trying to detect any moving object. Only detection of something moving.Tacking is optional. I thought by comparing to consecutive frame i can detect if there is any object moving. But I may not in the right track. But my problem is the same.