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

Why does RVIZ complain that I have to transform from right_wheel to base_link?

asked 2019-09-11 20:28:42 -0500

horseatinweeds gravatar image

Hello,

Here is my output from check_urdf:

---------- Successfully Parsed XML ---------------
root Link: base_link has 1 child(ren)
    child(1):  chassis
        child(1):  left_wheel_assembly
            child(1):  left_wheel
        child(2):  right_wheel_assembly
            child(1):  right_wheel

When I open my model in RVIZ, I add a robot model, then add the TF, then specify my fixed frame (base_link). But I have an error under RobotModel saying "No transform from [left_wheel] to [base_link]" and "No transform from [right_wheel] to [base_link].

I'm not sure what's causing the issue and I'm running out of ideas. Can anyone give me advice? Thanks. Here is my launch file and urdf model.

bot_empty.launch

<launch> 
  <!-- these are the arguments you can pass this launch file, for example paused:=true --> 
  <arg name="paused" default="false"/> 
  <arg name="use_sim_time" default="true"/> 
  <arg name="gui" default="true"/> 
  <arg name="headless" default="false"/> 
  <arg name="debug" default="false"/> 
  <arg name="use_gui" value="true" />


    <!-- Load joint controller configuration from YAML file to parameter server -->
    <rosparam file="$(find ack_control)/config/ack_control.yaml" command="load" />

    <!-- load the controllers --> 
    <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" ns="/ack" args="joint_rwh_position_controller joint_lwh_position_controller joint_state_controller"/>



  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
    respawn="false" output="screen">
    <remap from="/joint_states" to="/ack/joint_states" />
  </node>

  <!-- Start Joint state publisher node which will publish the joint values -->
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />


  <!-- Load the URDF into the ROS Parameter Server  
  <param name="robot_description" 
     command="$(find xacro)/xacro.py '$(find ack_description)/urdf/ackermann_1.urdf'" /> -->

  <param name="robot_description" textfile="$(find ack_description)/urdf/ackermann_1.urdf" />

  <include file="$(find gazebo_ros)/launch/empty_world.launch"> 
    <arg name="world_name" value="$(find ack_gazebo)/worlds/empty.world"/> 
    <arg name="debug" value="$(arg debug)" /> 
    <arg name="gui" value="$(arg gui)" /> 
    <arg name="paused" value="$(arg paused)"/> 
    <arg name="use_sim_time" value="$(arg use_sim_time)"/> 
    <arg name="headless" value="$(arg headless)"/> 
  </include>  

  <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot --> 

  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model ackermann_1 -param robot_description"/>  

  <!-- Launch rviz -->
  <node name="rviz" pkg="rviz" type="rviz" 
    args="-d $(find ack_description)/urdf.rviz" required="true" />

</launch>

ackermann_1.urdf

<?xml version="1.0"?> 
<robot name="ackermann_1" xmlns:xacro="http://www.ros.org/wiki/xacro"> 

    <!-- Base link -->  
  <link name="base_link">
    <visual>  
      <geometry>
        <box size="0.01 0.01 0.01"/>
      </geometry>
    </visual>
  </link> 

    <!-- Chassis START-->  
    <joint name="base_joint" type="fixed">
    <parent link="base_link"/> 
    <child link="chassis"/> 
  </joint> 

  <link name="chassis"> 
    <collision> 
      <origin xyz="0 0 0.3" rpy="0 0 0"/> 
      <geometry> 
            <box size="1 0.2 0.1"/> 
      </geometry> 
    </collision> 
    <visual> ...
(more)
edit retag flag offensive close merge delete

Comments

Can you please add the image of rqt_tf_tree

Humpelstilzchen gravatar image Humpelstilzchen  ( 2019-09-12 04:19:11 -0500 )edit

Hi Humpelstizchen, I've added a screenshot. Thanks.

horseatinweeds gravatar image horseatinweeds  ( 2019-09-12 05:07:02 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-09-12 05:13:32 -0500

Reamees gravatar image

your problem is with ROS and Rviz, so the launch file to reproduce the problem could shortened quite a bit to make the problem more clear. ROS and robot state relevant launch file:

<launch> 

  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
    respawn="false" output="screen">
    <remap from="/joint_states" to="/ack/joint_states" />
  </node>

  <!-- Start Joint state publisher node which will publish the joint values -->
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />


  <!-- Load the URDF into the ROS Parameter Server  -->

  <param name="robot_description" textfile="$(find ack_description)/urdf/ackermann_1.urdf" />

  <!-- Launch rviz -->
  <node name="rviz" pkg="rviz" type="rviz" 
    args="-d $(find ack_description)/urdf.rviz" required="true" />

</launch>

There are quite a few things I don't like about this launch file in general. But the transforms will be found if you remove the line <remap from="/joint_states" to="/ack/joint_states" />. You are launching controller_spawner in ack namespace, so I'm guessing you added that remap because of that node. If that is true, add the remap inside the controller_spawner node instead.


Other notes about the shortened launch file:

The robot_description is loaded after the state publishers, I guess it works, but it is not a logical order for the flow.

You have the required="true" argument for rviz node. In my experience this is usually a bad idea. Rviz will crash if you try to visualize anything substantial on it for some period of time and the required arg will take down all of the nodes you have launched. If your goal is to always have rviz open then use the respawn="true" argument instead.

edit flag offensive delete link more

Comments

To add the remap to controller_spawner you will need to reverse the from an to. Check with rosnode info controller_spawner if the node is subscribing and publishing to what you expect.

Reamees gravatar image Reamees  ( 2019-09-12 05:17:27 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-09-11 20:28:42 -0500

Seen: 905 times

Last updated: Sep 12 '19