0
$\begingroup$

Rosanswers logo

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> 
      <origin xyz="0 0 0.3" rpy="0 0 0"/> 
      <geometry> 
         <box size="1 0.2 0.1"/> 
      </geometry> 
      <material name="orange"/> 
    </visual> 
    <inertial> 
      <mass value="1"/> 
      <origin xyz="0 0 0.3" rpy="0 0 0"/> 
      <inertia ixx="0.4" ixy="0.1" ixz="0.1" iyy="0.4" iyz="0.1" izz="0.2"/> 
    </inertial> 
  </link>    

  <gazebo reference="chassis"> 
    <!--Stiffness -->  
    <kp>1000000.0</kp> 
    <!--Dampening-->  
    <kd>0.1</kd> 
    <dampingFactor>0</dampingFactor> 
    <material>Gazebo/White</material> 
    <selfCollide>true</selfCollide> 
    <turnGravityOff>false</turnGravityOff> 
    <mu1 value="0.1"/> 
    <mu2 value="0.1"/> 
    <fdir1 value="0 0 0"/> 
  </gazebo> 
    <!-- Chassis END --> 

  <!-- Right Wheel - Start --> 
    <link name="right_wheel"> 
        
        <collision> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" />
          <geometry> 
           <cylinder length="0.05" radius="0.1"/> 
          </geometry> 
        </collision> 

        <visual> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" /> 
          <geometry> 
            <cylinder length="0.05" radius="0.1"/> 
          </geometry> 
          <material name="black"/> 
        </visual>       

        <inertial> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" /> 
          <mass value="0.2"/> 
          <cylinder_inertia m="0.2" r="0.3" h="0.1"/> 
      <inertia ixx="0.4" ixy="0.1" ixz="0.1" iyy="0.4" iyz="0.1" izz="0.2"/> 
      </inertial> 

    </link> 
  <gazebo reference="right_wheel"> 
    <mu1 value="2.0"/> 
    <mu2 value="2.0"/> 
    <kp  value="10000000.0" /> 
    <kd  value="1.0" /> 
    <fdir1 value="0 1 0"/> 
    <material>Gazebo/Blue</material> 
  </gazebo>

    <link name="right_wheel_assembly">
        <collision> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" />
          <geometry> 
           <cylinder length="0.001" radius="0.04"/> 
          </geometry> 
        </collision> 

        <visual> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" /> 
          <geometry> 
            <cylinder length="0.001" radius="0.04"/> 
          </geometry> 
          <material name="white"/> 
        </visual>       

        <inertial> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" /> 
          <mass value="0.2"/> 
          <cylinder_inertia m="0.2" r="0.3" h="0.1"/> 
      <inertia ixx="0.4" ixy="0.1" ixz="0.1" iyy="0.4" iyz="0.1" izz="0.2"/> 
      </inertial>
    </link>  

  <gazebo reference="right_wheel_assembly"> 
    <mu1 value="2.0"/> 
    <mu2 value="2.0"/> 
    <kp  value="10000000.0" /> 
    <kd  value="1.0" /> 
    <fdir1 value="0 1 0"/> 
    <material>Gazebo/White</material> 
  </gazebo>

  <joint name="right_wheel_hinge" type="revolute"> 
    <parent link="chassis"/> 
    <child link="right_wheel_assembly"/> 
    <origin xyz="0.4 0.125 0.3" rpy="0 0 0" />  
    <axis xyz="0 0 1" rpy="0 0 0" /> 
    <limit effort="100" velocity="1" lower="-1" upper="1"/> 
    <dynamics damping="0.0" friction="0.0"/> 
  </joint> 

  <joint name="right_wheel_rotate" type="continuous"> 
    <parent link="right_wheel_assembly"/> 
    <child link="right_wheel"/> 
    <origin xyz="0.0 0.025 0.0" rpy="0 0 0" />  
    <axis xyz="0 1 0" rpy="0 0 0" /> 
    <limit effort="0" velocity="0"/> 
    <dynamics damping="0.0" friction="0.0"/> 
  </joint>


  <transmission name="tran1">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="right_wheel_hinge">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor1">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <transmission name="tran4">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="right_wheel_hinge">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor1">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <!-- Right Wheel - End -->  

  <!-- Left Wheel - Start  -->
    <link name="left_wheel"> 
        
        <collision> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" />
          <geometry> 
           <cylinder length="0.05" radius="0.1"/> 
          </geometry> 
        </collision> 

        <visual> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" /> 
          <geometry> 
            <cylinder length="0.05" radius="0.1"/> 
          </geometry> 
          <material name="black"/> 
        </visual>       

        <inertial> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" /> 
          <mass value="0.2"/> 
          <cylinder_inertia m="0.2" r="0.3" h="0.1"/> 
      <inertia ixx="0.4" ixy="0.1" ixz="0.1" iyy="0.4" iyz="0.1" izz="0.2"/> 
      </inertial> 

    </link> 
  <gazebo reference="left_wheel"> 
    <mu1 value="2.0"/> 
    <mu2 value="2.0"/> 
    <kp  value="10000000.0" /> 
    <kd  value="1.0" /> 
    <fdir1 value="0 1 0"/> 
    <material>Gazebo/Blue</material> 
  </gazebo>

    <link name="left_wheel_assembly">
        <collision> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" />
          <geometry> 
           <cylinder length="0.001" radius="0.04"/> 
          </geometry> 
        </collision> 

        <visual> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" /> 
          <geometry> 
            <cylinder length="0.001" radius="0.04"/> 
          </geometry> 
          <material name="white"/> 
        </visual>       

        <inertial> 
          <origin xyz="0 0 0" rpy="0 1.5708 1.5708" /> 
          <mass value="0.2"/> 
          <cylinder_inertia m="0.2" r="0.3" h="0.1"/> 
      <inertia ixx="0.4" ixy="0.1" ixz="0.1" iyy="0.4" iyz="0.1" izz="0.2"/> 
      </inertial>
    </link>  

  <gazebo reference="left_wheel_assembly"> 
    <mu1 value="2.0"/> 
    <mu2 value="2.0"/> 
    <kp  value="10000000.0" /> 
    <kd  value="1.0" /> 
    <fdir1 value="0 1 0"/> 
    <material>Gazebo/White</material> 
  </gazebo>

  <joint name="left_wheel_hinge" type="revolute"> 
    <parent link="chassis"/> 
    <child link="left_wheel_assembly"/> 
    <origin xyz="0.4 -0.125 0.3" rpy="0 0 0" />  
    <axis xyz="0 0 1" rpy="0 0 0" /> 
    <limit effort="100" velocity="1" lower="-1" upper="1"/> 
    <dynamics damping="0.0" friction="0.0"/> 
  </joint> 

  <joint name="left_wheel_rotate" type="continuous"> 
    <parent link="left_wheel_assembly"/> 
    <child link="left_wheel"/> 
    <origin xyz="0.0 -0.025 0.0" rpy="0 0 0" />  
    <axis xyz="0 1 0" rpy="0 0 0" /> 
    <limit effort="0" velocity="0"/> 
    <dynamics damping="0.0" friction="0.0"/> 
  </joint>


  <transmission name="tran2">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="left_wheel_hinge">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor2">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <!-- Left Wheel - End -->

    <gazebo>
        <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
          <robotNamespace>/ack</robotNamespace>
            <legacyModeNS>true</legacyModeNS>
        </plugin>
    </gazebo>


  

</robot> 

Originally posted by horseatinweeds on ROS Answers with karma: 160 on 2019-09-11

Post score: 0


Original comments

Comment by Humpelstilzchen on 2019-09-12:
Can you please add the image of rqt_tf_tree

Comment by horseatinweeds on 2019-09-12:
Hi Humpelstizchen, I've added a screenshot. Thanks.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Reamees with karma: 591 on 2019-09-12

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Reamees on 2019-09-12:
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.

$\endgroup$

Your Answer

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