0
$\begingroup$

Rosanswers logo

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/image_rect_color" />

  <!-- View computed disparity maps -->
  <node pkg="image_view" type="image_view" name="image_view" args="image:=/elas/disparity" />

  <!-- Launch Rviz -->
  <node pkg="rviz" type="rviz" name="rviz">
    <param name="/use_sim_time" value="true" />
  </node>


</launch>

However, this results in the following tf tree:

image description

I am very confused about what's going on. First of all, can you even do this with static transforms or have I missed something? It makes sense to me that you could publish a static transform between two clearly static reference frames (i.e., fixed cameras on a robot) but maybe I am wrong. Also, why does it seem to think 100 (the broadcast rate) is a child frame? I have tried a million different things and am totally confused.

Also, at one point I used this same launch file on a different computer and the tf tree was connected properly. I have since reinstalled Ubuntu/ROS and have the same issue. I'm using ROS fuerte.

Any help would be greatly appreciated!!


Originally posted by antonella on ROS Answers with karma: 259 on 2013-05-23

Post score: 3


Original comments

Comment by Stephan on 2013-05-24:
Your posted launch file is invalid. Please post a complete working example.

Comment by Stephan on 2013-05-24:
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".

Comment by Stephan on 2013-05-24:
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.

Comment by antonella on 2013-05-26:
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.

Comment by antonella on 2013-05-26:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by antonella with karma: 259 on 2013-05-27

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.