Ask Your Question
0

ar_pose and kinect

asked 2014-03-09 00:24:35 -0600

Andrii Matviienko gravatar image

updated 2016-10-24 08:36:14 -0600

ngrennan gravatar image

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

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2014-03-17 23:36:06 -0600

Andrii Matviienko gravatar image

updated 2015-01-18 13:06:22 -0600

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)
edit flag offensive delete link more

Comments

I am trying to calibrate the Kinect camera using Visp and I followed the wiki page instructions for visp_camera_calibration. Unfortunately, although I have an image_view, I get only a black screen on the visp_calibration . Could you please provide me with your .launch file for calibrating Kinect?

Zoid gravatar imageZoid ( 2015-01-15 04:28:37 -0600 )edit

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

Andrii Matviienko gravatar imageAndrii Matviienko ( 2015-01-18 13:06:56 -0600 )edit

Is that the launch/lagadic_grid.launch file for Kinect of visp_camera_calibration? That is the file I am looking for. Thank you.

Zoid gravatar imageZoid ( 2015-02-02 09:32:02 -0600 )edit

Any progress using ar_pose with kinect ? I have the same problem.

Leandro gravatar imageLeandro ( 2015-05-14 16:00:16 -0600 )edit
0

answered 2014-03-09 03:43:24 -0600

cdrwolfe gravatar image

Assuming you are using RViz, do you have a marker included in your panel?

Didn't realise it myself but when running the seperate package ar_kinect, nothing was showing until I put a marker and set the top to visualization_marker.

edit flag offensive delete link more

Comments

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?

Andrii Matviienko gravatar imageAndrii Matviienko ( 2014-03-10 02:37:54 -0600 )edit

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:

Andrii Matviienko gravatar imageAndrii Matviienko ( 2014-03-10 05:14:24 -0600 )edit

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]]

Andrii Matviienko gravatar imageAndrii Matviienko ( 2014-03-10 05:14:25 -0600 )edit
0

answered 2014-03-09 03:01:46 -0600

davinci gravatar image

Did you remap the image topic? You should remap the /camera/rgb/image_raw to /usb_cam/image_raw

edit flag offensive delete link more

Comments

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

Andrii Matviienko gravatar imageAndrii Matviienko ( 2014-03-10 02:08:01 -0600 )edit

Hi, Have you solved this problem? I had the the same problem now. Thanks.

yuky gravatar imageyuky ( 2014-08-24 09:15:24 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2014-03-09 00:24:35 -0600

Seen: 914 times

Last updated: Jan 18 '15