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

Rviz reporting no fixed frame

asked 2015-04-26 23:12:02 -0500

Cerin gravatar image

updated 2015-04-27 13:47:49 -0500

I'm trying to complete the robot state publisher tutorial, but when I run:

roslaunch myrobot_description myrobot_rviz.launch

Rviz shows no model and in the left-hand panel reports the error "Fixed Frame [map] does not exist".

myrobot.urdf.xarco:

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

    <xacro:macro name="default_inertial" params="mass">
        <inertial>
                <mass value="${mass}" />
                <inertia
                    ixx="1.0" ixy="0.0" ixz="0.0"
                    iyy="1.0" iyz="0.0" izz="1.0" />
        </inertial>
    </xacro:macro>

    <xacro:include filename="$(find myrobot_description)/urdf/materials.urdf.xacro" />

    <!-- width in meters -->
    <property name="torso_x_size" value="0.1" />

    <!-- length in meters -->
    <property name="torso_y_size" value="0.205" />

    <!-- height in meters -->
    <property name="torso_z_size" value="0.03" />

    <!-- torso mass (not including legs) in kg -->
    <property name="torso_mass" value="0.920" />

    <!-- mass of a single upper leg piece in kg -->
    <property name="upper_leg_mass" value="0.010" />

    <link name="base_link">
        <visual>
            <geometry>
                <box size="${torso_x_size} ${torso_y_size} ${torso_z_size}" />
            </geometry>
            <material name="red"/>
        </visual>
        <collision>
            <geometry>
                <box size="${torso_x_size} ${torso_y_size} ${torso_z_size}" />
            </geometry>
        </collision>
        <xacro:default_inertial mass="${torso_mass}"/>
    </link>
    <xacro:macro name="leg" params="name reflect_x reflect_y">
        <link name="${name}">
            <visual>
                <geometry>
                    <box size="0.003 0.04 0.005" />
                </geometry>
                <origin xyz="0 0.04 0" rpy="0 0 0"/>
                <material name="blue" />
            </visual>
            <collision>
                <geometry>
                    <box size="0.003 0.04 0.005" />
                </geometry>
                <origin xyz="0 0.04 0" rpy="0 0 0"/>
            </collision>
            <xacro:default_inertial mass="${upper_leg_mass}"/>
        </link>
        <joint name="torso_to_${name}" type="fixed">
            <parent link="base_link"/>
            <child link="${name}"/>
            <origin xyz="${torso_x_size/2*reflect_x} ${torso_y_size/2*reflect_y} 0" />
            <axis xyz="0 1 0" rpy="0 0 0" />
        </joint>
    </xacro:macro>
    <xacro:leg name="front_right_leg" reflect_x="1" reflect_y="1" />
</robot>

myrobot_rviz.launch:

<launch>
  <param name="robot_description" command="$(find xacro)/xacro.py '$(find myrobot_description)/urdf/myrobot.urdf.xacro'" />

  <!-- source that publishes the joint positions as a sensor_msgs/JointState -->
  <param name="use_gui" value="true"/>
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />

  <!-- robot visualization -->
  <node name="rviz" pkg="rviz" type="rviz" required="true" />

  <!-- publish all the frames to TF -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
    <param name="publish_frequency" value="50"/> <!-- Hz -->
  </node>
</launch>

I googled that error, and other pages claim the it means there's no base_link defined in my model, but there clearly is. What am I doing wrong?

Edit: I changed my launch file to:

<launch>
    <arg name="model" />
    <arg name="gui" default="True" />
    <param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
    <param name="use_gui" value="$(arg gui)"/>
    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
        <param name="publish_frequency" value="50"/> <!-- Hz -->
    </node>
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find myrobot_description)/urdf.rviz" required="true" />
</launch>

and now call it like:

roslaunch myrobot_description myrobot_rviz.launch model:='$(find myrobot_description)/urdf/myrobot.urdf.xacro'

and that makes the model show in Rviz, but it doesn't look any different from a the other xacrodisplay launches the tutorial goes over. Is the tutorial incomplete, or am I ... (more)

edit retag flag offensive close merge delete

Comments

Would you please open a new question for the issue you added in your last edit? The title of the question is "RViz reporting no fixed frame", your last edit is about something different. That makes it hard to keep answers on-topic and findable.

gvdhoorn gravatar image gvdhoorn  ( 2015-04-27 14:24:59 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-04-27 01:59:39 -0500

gvdhoorn gravatar image

updated 2015-04-27 14:19:28 -0500

Have you set the Fixed Frame to base_link after RViz has started?


Edit:

I don't understand your question. I posted all my code. As you can see, I have a base_link defined.

The question is whether you have configured RViz correctly. I can see you have a base_link, but if you don't set the Fixed Frame configuration option to base_link, RViz will not know 'where' your TF tree starts, to put it like that.

It renders fine in Rviz when I run the tutorial's other roslaunch examples like roslaunch urdf_tutorial xacrodisplay.launch model:='$(find myrobot_description)/urdf/myrobot.urdf.xacro'

Yes, and that is because the xacrodisplay.launch file instructs RViz to load the urdf_tutorial/urdf.rviz file, which sets the Fixed Frame configuration option to base_link (from xacrodisplay.launch):

<launch>
    ...
    <arg name="rvizconfig" default="$(find urdf_tutorial)/urdf.rviz" />
    ...
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
</launch>

And from urdf_tutorial/urdf.rviz:

...
  Global Options:
    Background Color: 48; 48; 48
    Fixed Frame: /base_link
...

That option is shown under Global Options in the tree on the left in the main RViz window.


Edit2:

When I changed my rviz tag to point to urdf.rviz, that fixed that error. [..]

Note that you could've just as easily used the dropdown next to Fixed Frame in the RViz window.

Now I see the model, but I still don't see the "Joint State Publisher" dialog shown here. Why is that?

Note that this is unrelated to your initial issue(s). I'm not sure, but it could be a parameter resolution issue. Try making the use_gui parameter private to the joint_state_publisher node (it is the only node using that parameter anyway).

edit flag offensive delete link more

Comments

I don't understand your question. I posted all my code. As you can see, I have a base_link defined. It renders fine in Rviz when I run the tutorial's other roslaunch examples like roslaunch urdf_tutorial xacrodisplay.launch model:='$(find myrobot_description)/urdf/myrobot.urdf.xacro'

Cerin gravatar image Cerin  ( 2015-04-27 10:16:44 -0500 )edit

Ah, thanks for the edit. That makes sense. When I changed my rviz tag to point to urdf.rviz, that fixed that error. Now I see the model, but I still don't see the "Joint State Publisher" dialog shown here. Why is that?

Cerin gravatar image Cerin  ( 2015-04-27 13:38:49 -0500 )edit

To clarify, I see "process[joint_state_publisher-2]: started with pid [7581]" in the console, so I think it's running. What effect should that have in Rviz?

Cerin gravatar image Cerin  ( 2015-04-27 13:39:39 -0500 )edit

What effect should that have in Rviz?

None. The joint_state_publisher is a stand-alone node. It has no relation to RViz whatsoever.

gvdhoorn gravatar image gvdhoorn  ( 2015-04-27 14:20:27 -0500 )edit

What do you mean by "private parameter"? I tried replacing the node with <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"><param name="use_gui" value="true"/></node> but that had no effect.

Cerin gravatar image Cerin  ( 2015-04-27 14:44:24 -0500 )edit

That should've worked. Are you sure the window isn't hidden behind the RViz window? The joint_state_publisher window is not part of RViz, nor is it a child window.

gvdhoorn gravatar image gvdhoorn  ( 2015-04-27 15:07:32 -0500 )edit

You're absolutely right. From the screenshot, I thought it was inside the Rviz screen, but it's a separate window. I was on dual monitors, and it's tiny and showed up on a different monitor, so I didn't notice. Thanks.

Cerin gravatar image Cerin  ( 2015-04-29 08:34:39 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-04-26 23:12:02 -0500

Seen: 2,684 times

Last updated: Apr 27 '15