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

Unable to connect Gazebo to ROS_Control

asked 2015-05-02 11:17:10 -0500

Cerin gravatar image

updated 2015-05-02 13:06:54 -0500

I'm trying to follow the Gazebo ROS Control tutorial but when I run the line:

roslaunch myrobot_gazebo myrobot_world.launch

I get the error output:

[ INFO] [1430582458.651473605]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1430582458.655485962]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
spawn_model script started
[INFO] [WallTime: 1430582458.938102] [0.000000] Loading model xml from ros parameter
[INFO] [WallTime: 1430582458.941118] [0.000000] Waiting for service /gazebo/spawn_urdf_model
[ INFO] [1430582459.741922815, 0.023000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1430582459.819138448, 0.096000000]: Physics dynamic reconfigure ready.
[INFO] [WallTime: 1430582459.855947] [0.132000] Calling service /gazebo/spawn_urdf_model
[INFO] [WallTime: 1430582460.083841] [0.295000] Spawn status: SpawnModel: Successfully spawned model
[ INFO] [1430582460.118077443, 0.295000000]: Loading gazebo_ros_control plugin
[ INFO] [1430582460.118570188, 0.295000000]: Starting gazebo_ros_control plugin in namespace: /myrobot
[ INFO] [1430582460.120080182, 0.295000000]: gazebo_ros_control plugin is waiting for model URDF in parameter [/robot_description] on the ROS param server.
[ERROR] [1430582460.223045545, 0.295000000]: No valid hardware interface element found in joint 'torso_to_front_right_leg_joint'.
[ERROR] [1430582460.223576289, 0.295000000]: Failed to load joints for transmission 'torso_to_front_right_leg_joint_trans'.
[ INFO] [1430582460.363040693, 0.295000000]: Loaded gazebo_ros_control.
[urdf_spawner-3] process has finished cleanly
log file: /home/chris/.ros/log/6b610a90-f0e4-11e4-bb58-001c1091e5ab/urdf_spawner-3*.log
[ERROR] [1430582476.852961975, 16.562000000]: Exception thrown while initializing controller torso_to_front_right_leg_joint_position_controller.
Could not find resource 'torso_to_front_right_leg_joint' in 'hardware_interface::EffortJointInterface'.
[ERROR] [1430582476.853310724, 16.563000000]: Initializing controller 'torso_to_front_right_leg_joint_position_controller' failed

My robot's urdf is just a single box "torso" with a single box "leg", and all the joints and interfaces and transmissions are defined:

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

    <xacro:macro name="box_inertia" params="mass x y z">
        <inertia
            ixx="${mass*(y*y+z*z)/12}" ixy="0" ixz="0"
            iyy="${mass*(x*x+z*z)/12}" iyz="0" izz="${mass*(x*x+z*z)/12}" /> 
    </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" />

    <!-- distance from ground to shoulders when standing at full height -->
    <property name="total_leg_height" value="0.158" />

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

    <property name="upper_leg_depth" value="0.003" />
    <property name="upper_leg_length" value="0.04" />
    <property name="upper_leg_thickness" value="0.005" />

    <link name="base_footprint">
        <visual>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <geometry>
                <box size="0.001 0.001 0.001" />
            </geometry>
        </visual>
        <inertial>
            <mass value="0.0001" />
            <origin xyz="0 0 0" />
            <inertia
                ixx="0.0001" ixy="0.0" ixz="0.0"
                iyy="0.0001" iyz="0.0" izz="0.0001" />
        </inertial>
    </link>
    <gazebo reference="base_footprint">
        <turnGravityOff>false</turnGravityOff>
    </gazebo>

    <joint name="base_footprint_joint" type="fixed">
        <origin xyz="0 0 ${total_leg_height}" rpy="0 0 0" />
        <parent link="base_footprint"/>
        <child link="base_link" />
    </joint>

    <link name="base_link">
        <visual>
            <geometry>
                <box size="${torso_x_size} ${torso_y_size} ${torso_z_size}" />
            </geometry ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-05-02 13:27:35 -0500

Cerin gravatar image

updated 2015-05-03 06:03:47 -0500

gvdhoorn gravatar image

Turns out the problem was the location of my <inertia> tags. The Gazebo tutorial lead me to believe that:

An <inertia> element within each <link> element must be properly specified and configured.

This is, at best, ambiguously worded. The <inertia> tag must not be directly inside your link. I only got it to work after I added an <inertial><inertia ...></inertial> tag inside all my links.

edit flag offensive delete link more

Comments

It's probably a good idea to update the tutorial, or at the very least report this to the Gazebo people.

gvdhoorn gravatar image gvdhoorn  ( 2015-05-03 06:03:35 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-05-02 11:17:10 -0500

Seen: 1,122 times

Last updated: May 03 '15