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

tf tree for viso2

asked 2013-05-23 23:53:57 -0500

antonella gravatar image

updated 2013-11-14 11:10:38 -0500

tfoote gravatar image

I'm trying to set up a tf tree to use with viso2 to reconstruct point clouds, but I'm running into a lot of issues. Right now I'm just trying to set up a chain of dummy static transforms in order to get something working (i.e., I know the reconstruction will be bad because the transforms are arbitrary/incorrect, but I just want to see that I can get data displayed).

I've tried to set up a bunch of static transforms as follows, with the intent of creating the tf tree:

map -> odom -> base_link -> caodom -> camera_optical_frame

->base_link -> odom_combined -> base_footprint

(base_link is the parent of both caodom and odom_combined frames)

<launch>

  <arg name="simtime" value="true" />

  <!-- Get name of bagfile (passed in to roslaunch as arg) -->
  <!--  <arg name="bagfile" />-->

  <!-- Play bag file. -->
  <!-- not working right now <node pkg="rosbag" type="play" name="rosbag" args="$(find stereo_data)/$(arg bagfile).bag" />-->
  <!--  <node pkg="rosbag" type="play" name="rosbag" args="SCRIPPS.bag" />-->
  <node pkg="rosbag" type="play" name="rosbag" args="$(find stereo_data)/SCRIPPS.bag --clock" />


  <!-- Publish transforms -->

  <!-- Transform from camera odom frame to camera_optical_frame -->
  <node pkg="tf" type="static_transform_publisher" name="caodom_to_camera_optical_frame" args="0 0 0 0.1 0.1 0.1 /caodom /camera_optical_frame 100 --clock">
    <param name="queue_size" value="50" />
    <param name="/use_sim_time" value="simtime" />
  </node>

  <!-- Transform from base_link to caodom -->
  <node pkg="tf" type="static_transform_publisher" name="base_link_to_caodom" args="0 0 0 0.1 0.1 0.1 /base_link /caodom 100 --clock">
    <param name="queue_size" value="50" />
    <param name="/use_sim_time" value="simtime" />
  </node>

  <!-- Transform from base_link to odom_combined -->
  <node pkg="tf" type="static_transform_publisher" name="base_link_to_odom_combined" args="0 0 0 0.1 0.1 0.1 /base_link /odom_combined 100 --clock">
    <param name="queue_size" value="50" />
    <param name="/use_sim_time" value="simtime" />
  </node>

  <!-- Transform from odom_combined to base_footprint -->
  <node pkg="tf" type="static_transform_publisher" name="odom_combined_to_base_footprint" args="0 0 0 0.1 0.1 0.1 /odom_combined /base_footprint 100 --clock">
    <param name="queue_size" value="50" />
    <param name="/use_sim_time" value="simtime" />
  </node>



  <!-- Debayer and rectify images -->
  <group ns="stereo/left">
    <node pkg="image_proc" type="image_proc" name="image_proc_left">
      <param name="/use_sim_time" value="simtime" />
    </node>  
  </group>

  <group ns="stereo/right">
    <node pkg="image_proc" type="image_proc" name="image_proc_right">
      <param name="/use_sim_time" value="simtime" />
    </node>
  </group>

  <!-- Visual odometry node -->
  <node pkg="viso2_ros" type="stereo_odometer" name="vo2" 
      args="stereo:=stereo image:=image_rect _odom_frame_id:=/odom_combined _base_link_frame_id:=/base_footprint _publish_tf:=true">
    <param name="approximate_sync" value="true" />
    <param name="/use_sim_time" value="simtime" />
  </node>

  <!-- Compute disparities for images -->
  <node pkg="elas_ros" type="elas_ros" name="elas" args="stereo:=stereo image:=image_rect_color" respawn="true">
    <param name="approximate_sync" value="true" />
    <param name="queue_size" value="10" />
    <param name="/use_sim_type" value="simtime" />
  </node>

  <!-- Compute 3D point clouds from disparities -->
  <node pkg="elas_ros" type="pc_construction" name="elas_pc" 
    args="frame_data:=/elas/frame_data pose:=/vo2/pose base_frame_id:=/odom_combined pose_frame_id:=/base_footprint">
      <param name="approximate_sync" value="true" />
      <param name="queue_size" value="10" />
      <param name="/use_sim_time" value="simtime" />
  </node>

  <!-- View debayered/rectified images -->
  <node pkg="image_view" type="image_view" name="image_view_left" args="image:=stereo/left/image_rect_color" />
  <node pkg="image_view" type="image_view" name="image_view_right" args="image:=stereo/right ...
(more)
edit retag flag offensive close merge delete

Comments

Your posted launch file is invalid. Please post a complete working example.

Stephan gravatar image Stephan  ( 2013-05-24 06:15:22 -0500 )edit

What are you trying to achieve by setting the parameter /use_sim_time four times to "simtime"? If you are playing back a bagfile using rosbag play --clock ... and want the system to use the simulated time you'll have to set /use_sim_time (only once) to "true".

Stephan gravatar image Stephan  ( 2013-05-24 06:17:52 -0500 )edit

If a frame in your tree is called /100 that's an indicator that you ran static_transform_publisher with wrong arguments. Carefully count them! See rosrun tf static_transform_publisher (without arguments) for examples.

Stephan gravatar image Stephan  ( 2013-05-24 06:19:30 -0500 )edit

I updated the question with the complete launch file. simtime is a variable that is set to true at the beginning of the file. I was under the impression that any node needing to use the use_sim_time parameter had to have that parameter set, which is why it's set for every node.

antonella gravatar image antonella  ( 2013-05-26 19:03:09 -0500 )edit

I have read how static_transform_publisher works, and I only see 6 arguments for x y z yaw pitch roll. This is part of the reason I'm stumped. When I try adding a seventh argument to use quaternions (x y z qx qy qz qw) I get an error.

antonella gravatar image antonella  ( 2013-05-26 19:14:32 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-05-27 10:24:01 -0500

antonella gravatar image

updated 2013-05-27 10:26:24 -0500

I got it working. I was setting the --clock flag for each static_transform_publisher node, which was what was causing the /100 frame and also the incorrect number of arguments (I was doing this because I read somewhere that setting --clock was necessary when running static_transform_publisher if rosbag play was using --clock but I guess that's not the case). Everything is working now, and now the tree is correct:

image description

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-23 23:53:57 -0500

Seen: 1,051 times

Last updated: May 27 '13