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

Andrii Matviienko's profile - activity

2016-07-14 11:36:47 -0500 received badge  Famous Question (source)
2016-04-12 09:35:11 -0500 marked best answer Merging 2 pcl from kinects

Hi all,

I am trying to merge two pointclouds from kinects, convert this merged pointcloud data into 2D image and publish the image data as a topic. I am using ros fuerte.

Here is my launch file:

<launch>

        <!--broadcasting the transformation from world frame to kinect frames-->
        <node pkg="tf" type="static_transform_publisher" name="overhead_kinect1" args="-0.37 0.94 1.04 0 0.83 -1.57 /world_base_link /overhead_kinect1_link  40" />
        <node pkg="tf" type="static_transform_publisher" name="overhead_kinect2" args=" 0.37 0.98 1.02 0 0.80 -1.57 /world_base_link /overhead_kinect2_link  40" />

    <include file="$(find openni_launch)/launch/openni.launch">
        <arg name="camera" value="overhead_kinect1"/>
        <arg name="depth_registration" value="false" />
        <!--<arg name="device_id" value="A00365911792039A"/>-->
        <arg name="device_id" value="002@18"/>
    </include>

    <include file="$(find openni_launch)/launch/openni.launch">
        <arg name="camera" value="overhead_kinect2"/>
        <arg name="depth_registration" value="false" />
        <!--<arg name="device_id" value="000000000000000"/>-->
        <arg name="device_id" value="002@20"/>
    </include>
<!--
        <node pkg="rviz" type="rviz" name="rviz"
         args="-d $(find ar_marker_detection_multiple)/ar_marker_detection.vcg"/>
 -->
        <node pkg="ar_marker_detection_multiple" type="ar_kinect" name="ar_kinect" respawn="false" output="screen"/>

</launch>

and part of the code responsible for merging:

ros::Publisher pub;
tf::TransformListener *listener;
sensor_msgs::PointCloud2 output, output1, output2;
pcl::PointCloud<pcl::PointXYZ> output_pcl, output1_pcl, output2_pcl;

void cloud_cb1(const sensor_msgs::PointCloud2ConstPtr& input1) {
    listener->waitForTransform("/world_base_link", (*input1).header.frame_id, (*input1).header.stamp, ros::Duration(5.0));
    sensor_msgs::PointCloud &pcout) const 
    pcl_ros::transformPointCloud("/world_base_link", *input1, output1, *listener);
    pcl::fromROSMsg(output1, output1_pcl);
    output_pcl = output1_pcl;
    output_pcl += output2_pcl;
    pcl::toROSMsg(output_pcl, output);
    pub.publish(output);
}

void cloud_cb2(const sensor_msgs::PointCloud2ConstPtr& input2) {
    listener->waitForTransform("/world_base_link", (*input2).header.frame_id, (*input2).header.stamp, ros::Duration(5.0));
    sensor_msgs::PointCloud &pcout) const 
    pcl_ros::transformPointCloud("/world_base_link", *input2, output2, *listener);
    pcl::fromROSMsg(output2, output2_pcl);
    output_pcl = output2_pcl;
    output_pcl += output1_pcl;
    pcl::toROSMsg(output_pcl, output);
    pub.publish(output);
}

int main (int argc, char **argv)
{
    ros::init (argc, argv, "ar_kinect");
    ros::NodeHandle n;
    ARPublisher ar_kinect (n);

    listener = new tf::TransformListener();
    ros::Subscriber sub1 = n.subscribe("/overhead_kinect1/depth_registered/points", 1, cloud_cb1);
    ros::Subscriber sub2 = n.subscribe("/overhead_kinect2/depth_registered/points", 1, cloud_cb2);

    pub = n.advertise<sensor_msgs::PointCloud2>("/overhead_kinect_merged/depth_registered/points", 1);
    ros::spin ();

    return 0;
}

When I run one kinect alone I get data from /camera/deprth_registered/points, but when I merge - no response from /overhead_kinect_merged/depth_registered/points. Also the serial number of one kinect is zeros (which is rather weird), that's why I switched to bus parameters.

I am running out of ideas what could be the cause for it. I would be very thankful for any help or idea.

2016-04-12 09:35:11 -0500 received badge  Teacher (source)
2016-04-12 09:35:11 -0500 received badge  Self-Learner (source)
2015-01-18 13:06:56 -0500 commented answer ar_pose and kinect

I added the launch file to my answer above under 5). I hope it's what you need.

2014-11-11 15:12:32 -0500 received badge  Notable Question (source)
2014-11-11 02:14:05 -0500 commented answer tf linker error

Thanks, but the problem is solved. Please find the answer below.

2014-11-10 12:36:13 -0500 received badge  Popular Question (source)
2014-11-10 07:55:06 -0500 answered a question tf linker error

Adding tf to find_package in CMakeLists.txt solved the problem. I had:

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg)

Should be:

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg tf)
2014-11-10 04:39:23 -0500 asked a question tf linker error

Hi all,

I have a linker issue while using tf library. Here is my callback. Without this only line in the callback there is NO linker error. Please, find below the linker error itself.

void callback (const sensor_msgs::PointCloud2ConstPtr& input)
{
  listener->waitForTransform("/world_base_link", (*input).header.frame_id, (*input).header.stamp, ros::Duration(5.0));
 ...
}

int main (int argc, char** argv)
{
  ros::init(argc, argv, "subscriber");
  ros::NodeHandle n;
  ros::Subscriber sub = n.subscribe("/kinect2/depth/points", 1, callback);
  ros::spin ();
}

Linker error:

Linking CXX executable range_image_border_extraction
CMakeFiles/range_image_border_extraction.dir/range_image_border_extraction.cpp.o: In function `callback(boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&)':
range_image_border_extraction.cpp:(.text+0x18c): undefined reference to `tf::Transformer::waitForTransform(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ros::Time const&, ros::Duration const&, ros::Duration const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >*) const'
collect2: ld returned 1 exit status
make[2]: *** [range_image_border_extraction] Error 1
make[1]: *** [CMakeFiles/range_image_border_extraction.dir/all] Error 2
make: *** [all] Error 2

CMakeLists.txt

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)

project(range_image_border_extraction)

find_package(PCL 1.7 REQUIRED)
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg tf pcl_ros)

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_executable(range_image_border_extraction range_image_border_extraction.cpp)
target_link_libraries(range_image_border_extraction ${PCL_LIBRARIES})
target_link_libraries(range_image_border_extraction ${catkin_LIBRARIES})

Any ideas how to resolve this linker error?

2014-10-22 18:53:45 -0500 received badge  Famous Question (source)
2014-04-16 11:44:34 -0500 received badge  Notable Question (source)
2014-04-16 10:44:51 -0500 answered a question Merging 2 pcl from kinects

Finally found the solution to my problem. The solution is that both kinects have to be connected to the different buses on a computer. As far as kinects are connected to 2 different buses their clouds are not competing between each other anymore, but recognized and merged as 2 separated.

2014-04-09 07:09:33 -0500 received badge  Popular Question (source)
2014-04-08 22:20:22 -0500 commented question Merging 2 pcl from kinects

I don't know why, but when I changed 'depth_registered' to 'depth' it started giving me a merged point cloud. So it's solved, but why it did not work for 'depth_registered' is still a question.

2014-04-08 22:00:23 -0500 commented question Merging 2 pcl from kinects

Both situations. If I run roslaunch openni_launch openni.launch for the 1st and then for the 2nd kinect - I get the data. When I run the lunch file specified above I get data from /overhead_kinect1 ( and 2) /depth_registered/points, but not from /overhead_kinect_merged/depth_registered/points

2014-04-08 22:00:23 -0500 received badge  Commentator
2014-04-08 21:05:56 -0500 commented question Merging 2 pcl from kinects

Yes, both of them work absolutely fine separately

2014-03-24 09:54:03 -0500 received badge  Famous Question (source)
2014-03-17 23:36:06 -0500 answered a question ar_pose and kinect

So, I got some progress and stuck in the different place. I will write everything I've got, maybe it could be useful for understanding the problem I have now and for others to refer in the future.

1) Calibration. I follow the instruction described on wiki page for visp_camera_calibration

rosdep install visp_camera_calibration
rosmake visp_camera_calibration
roslaunch launch/lagadic_grid.launch

At the end you find all calibration parameters you need for the launch file as it is described there or in ~/.ros/calibration.ini

2) Launch file looks like this for me:

<launch>
    <arg name="kinect" default="false"/>
    <param name="use_sim_time" value="false"/>

    <node pkg="rviz" type="rviz" name="rviz" />
        args="-d $(find ar_pose)/demo/demo_single.vcg"/> 

    <node pkg="tf" type="static_transform_publisher" name="world_to_cam"
        args="1 0 0 0 0 0 world camera_link 10" />

    <node name="camera" pkg="openni_camera" type="openni_node" respawn="false" output="log">

        <param name="camera_frame_id" type="string" value="camera"/>
        <param name="video_device" type="string" value="/dev/bus/usb/002/009"/>
        <param name="camera_frame_id" type="string" value="camera"/>

        <param name="io_method" type="string" value="mmap"/>
        <param name="image_width" type="int" value="640"/>
        <param name="image_height" type="int" value="480"/>
        <param name="pixel_format" type="string" value="mjpeg"/> 

        <rosparam param="D">[-0.01019, 0.00000, 0.00000, 0.00000, 0.00000]</rosparam>
        <rosparam param="K">[548.83913,0.00000,309.68288,0.00000,541.05367,246.39086, 0.00000, 0.00000, 1.00000]</rosparam>
        <rosparam param="R">[1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]</rosparam>
        <rosparam param="P">[548.83913,0.00000,309.68288,0.00000,0.00000,541.05367,246.39086, 0.00000, 0.00000 0.00000, 1.00000, 0.00000]</rosparam>

    </node>

    <node name="ar_pose" pkg="ar_pose" type="ar_single" respawn="false" output="screen">
        <param name="marker_pattern" type="string" value="data/patt.hiro"/>

        <param name="marker_width" type="double" value="80.0"/>
        <param name="marker_center_x" type="double" value="0.0"/>
        <param name="marker_center_y" type="double" value="0.0"/>
        <param name="threshold" type="int" value="100"/>
        <param name="use_history" type="bool" value="true"/>    

        <remap if="$(arg kinect)" from="/usb_cam/image_raw"   to="/camera/rgb/image_color"/>
            <remap if="$(arg kinect)" from="/usb_cam/camera_info" to="/camera/rgb/camera_info"/>

            <remap unless="$(arg kinect)" from="/usb_cam/image_raw" to="/wide_stereo/left/image_rect_color"/>
            <remap unless="$(arg kinect)" from="/usb_cam/camera_info" to="/wide_stereo/left/camera_info"/>  

    </node>

</launch>

Two crucial lines were(pay attention to the names of package and types you specify):

 args="1 0 0 0 0 0 world camera_link 10" />

<node name="camera" pkg="openni_camera" type="openni_node" respawn="false" output="log">

3) Rviz. I rviz I've chosen 3 topics: TF, Camera (/camera/rgb/image_rect_color) and Marker (visualization_marker). Fixed frame - /world and nothing for Target Frame. I get image from the camera and the transformation between world and camera seem to ok, but ar markers are not recognized.

4) I changed camera topics in include/ar_pose/ar_single.h to the following existing topics:

const std::string cameraImageTopic_ = "/camera/rgb/image_raw";
const std::string cameraInfoTopic_  = "/camera/rgb/camera_info ...
(more)
2014-03-10 14:46:47 -0500 received badge  Notable Question (source)
2014-03-10 05:14:25 -0500 commented answer ar_pose and kinect

Transform [sender=/camera_nodelet_manager] For frame [/camera_rgb_optical_frame]: No transform to fixed frame [/world]. TF error: [Unable to lookup transform, cache is empty, when looking up transform from frame [/camera_rgb_optical_frame] to frame [/world]]

2014-03-10 05:14:24 -0500 commented answer ar_pose and kinect

When I set Fixed Frame to /world, choose /camera/rgb/image_rect_color for camera, add marker and TF, I am getting the following error for camera:

2014-03-10 02:37:54 -0500 commented answer ar_pose and kinect

Tried adding the marker topic, but it did not help. What topics should I set in Fixed Frame and Target Frame and what option should I choose in camera topic?

2014-03-10 02:33:20 -0500 received badge  Editor (source)
2014-03-10 02:22:07 -0500 received badge  Popular Question (source)
2014-03-10 02:08:01 -0500 commented answer ar_pose and kinect

Yes, I have that remap in my launch file. I am afraid that there are some other options which are wrong. I added the content of my launch file to the question above

2014-03-10 02:06:22 -0500 edited question ar_pose and kinect

Hi all,

I have a question regarding the usage of ar_pose with kinect. So, what I did so far. I rosmake the ar_pose node and to make everything run I execute the following commands:

roslaunch openni_launch openni.launch

(for kinect) and

roslaunch ar_pose ar_pose_single.launch

In the list of topics I have /ar_marker, /world and topics related to the camera. I tried choosing different topics for fixed and target frames as well as for camera topic. I am getting an image from the camera, but the target (I use standard pattHiro.pdf mentioned in ros wiki for ar_pose) is not recognized. I also tried changing options for my kinect in launch file, but without success.

Here is the content of the launch file for ar_pose:

<launch>
   <arg name="kinect" default="false"/>
  <param name="use_sim_time" value="false"/>

    <node pkg="rviz" type="rviz" name="rviz" 
      args="-d $(find ar_pose)/launch/live_single.vcg"/>

   <node pkg="tf" type="static_transform_publisher" name="world_to_cam" 
     args="1 1 0.3 0 0 0 world ar_marker 10" />

    <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" respawn="false" output="log">
        <param name="video_device" type="string" value="/dev/video1"/>
        <param name="camera_frame_id" type="string" value="usb_cam"/>
        <param name="io_method" type="string" value="mmap"/>
        <param name="image_width" type="int" value="640"/>
        <param name="image_height" type="int" value="480"/>
        <param name="pixel_format" type="string" value="mjpeg"/>
        <rosparam param="D">[0.025751483065329935, -0.10530741936574876,-0.0024821434601277623, -0.0031632353637182972, 0.0000]</rosparam>
        <rosparam param="K">[558.70655574536931, 0.0, 316.68428342491319, 0.0, 553.44501004322387, 238.23867473419315, 0.0, 0.0, 1.0]</rosparam>
        <rosparam param="R">[1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]</rosparam>
        <rosparam param="P">[558.70655574536931, 0.0, 316.68428342491319, 0.0, 0.0, 553.44501004322387, 238.23867473419315, 0.0, 0.0, 0.0, 1.0, 0.0]</rosparam>
   </node>

    <node name="ar_pose" pkg="ar_pose" type="ar_single" respawn="false" output="screen">
        <param name="marker_pattern" type="string" value="data/patt.hiro"/>
        <param name="marker_width" type="double" value="80.0"/>
        <param name="marker_center_x" type="double" value="0.0"/>
        <param name="marker_center_y" type="double" value="0.0"/>
        <param name="threshold" type="int" value="100"/>
        <param name="use_history" type="bool" value="true"/>

     <remap if="$(arg kinect)" from="/usb_cam/image_raw"   to="/camera/rgb/image_raw"/>
        <remap if="$(arg kinect)" from="/usb_cam/camera_info" to="/camera/rgb/camera_info"/>

        <remap unless="$(arg kinect)" from="/usb_cam/image_raw" to="/wide_stereo/left/image_rect_color"/>
        <remap unless="$(arg kinect)" from="/usb_cam/camera_info" to="/wide_stereo/left/camera_info"/>

    </node>
</launch>

Could anyone please help me with settings needed for kinect to recognize ar target in ar_pose and topics I should subscribe to?

Thank you

2014-03-10 01:53:07 -0500 received badge  Enthusiast
2014-03-07 09:52:27 -0500 commented answer RoboEarth installation problem

After that I had the exact same problem as listed here http://answers.ros.org/question/68773/problem-compiling-re_comm/ and deleting UnizarRoboEarthInterface.java from ~/fuerte_workspace/stacks/roboearth/re_comm/src/roboearth/wp1 fixed the problem

2014-03-07 09:49:58 -0500 commented answer RoboEarth installation problem

That helped! Thank you! After installation I had to add the path to it manually by 'export ROS_PACKAGE_PATH=/opt/ros/fuerte/stacks/client_rosjava_jni'. Afterwards I had the same problem with other packages from stacks folder and I manually added them to $ROS_PACKAGE_PATH, what fixed the problem

2014-02-26 00:44:22 -0500 received badge  Famous Question (source)
2014-02-23 20:10:16 -0500 commented answer RoboEarth installation problem

Yes, I did. Currently it contains those 2 lines: source /opt/ros/fuerte/setup.bash source /home/andriimatviienko/fuerte_workspace/setup.bash You also mentioned that those things might not work in fuerte. What version of ROS would you then recommend to use for roboEarth?

2014-02-19 23:19:18 -0500 received badge  Notable Question (source)
2014-02-19 21:25:49 -0500 received badge  Popular Question (source)
2014-02-19 20:16:13 -0500 commented answer RoboEarth installation problem

Thank you for your feedback, Moritz However, I already have rosjava_jni installed. I checked it's there in /opt/ros/fuerte/stacks/client_rosjava_jni . When I try to rosmake knowrob according to the procedure you mentioned it gives me the same error: cannot find required resource: client_rosjava_jni

2014-02-19 03:27:09 -0500 asked a question RoboEarth installation problem

Hi all,

I want to install RoboEarth on Ubuntu 12.04. So far, I followed this guide ros wiki with some minor modifications. I've done the following steps:

1.

rosinstall ~/ros /opt/ros/fuerte 'ros wiki source'

That gave me an error, so i just downloaded the roboearth.rosinstall file and used the path to that instead of the url.

2. Added "source ~/ros/setup.bash" to the .bashrc

3.

sudo apt-get install ros-fuerte-ias-common ros-fuerte-perception-pcl ros-fuerte-opencv2 ros-fuerte-octomap-mapping ros-fuerte-client-rosjava-jni libsuitesparse-dev

...and what is important but not listed there

sudo apt-get install ros-fuerte-knowrob

4.

rosmake roboearth

My problem is when I execute rosmake roboearth I get the following and cannot find a way to proceed any further:

[ rosmake ] rosmake starting...                                                 
[ rosmake ] Packages requested are: ['roboearth']                               
[ rosmake ] Logging to directory /home/$user_name/.ros/rosmake/rosmake_output-20140219-162008
[ rosmake ] Expanded args ['roboearth'] to:
['re_msgs', 're_ontology', 're_comm', 're_2dmap_extractor', 're_vision', 're_object_detector_gui', 're_object_recorder', 'ar_bounding_box', 're_kinect_object_detector', 're_srvs', 're_comm_core']
cannot find required resource: client_rosjava_jni
ROS path [0]=/opt/ros/fuerte/share/ros
ROS path [1]=/home/$user_name/fuerte_workspace/stacks/knowrob_addons
ROS path [2]=/home/$user_name/fuerte_workspace/stacks/knowrob
ROS path [3]=/home/$user_name/fuerte_workspace/pkgs/tum-ros-pkg/knowledge
ROS path [4]=/home/$user_name/fuerte_workspace/stacks/ccny_vision
ROS path [5]=/home/$user_name/fuerte_workspace/stacks/roboearth
ROS path [6]=/home/$user_name/fuerte_workspace/vision_visp
ROS path [7]=/home/$user_name/fuerte_workspace/qr
ROS path [8]=/opt/ros/fuerte/stacks
ROS path [9]=/opt/ros/fuerte/share
ROS path [10]=/opt/ros/fuerte/share/ros

Thanks in advance for you help!