Differential Drive Gazebo wheels at origin

asked 2019-07-29 23:35:25 -0600

pondr gravatar image

I have created a plugin that drives a robot using cmd_vel commands. I developed the plugin using a husky robot without problems. I then moved on to create my own robot following tutorials (urdf). Now when using my personally developed robot the wheels appear at the origin in gazebo.

When I comment out the "my controller" node, everything works perfectly. Rviz shows the wheels in the correct place either way.

Launch File <launch> <arg name="use_sim_time" default="true"/> <arg name="world" default="empty"/>

<group if="$(arg use_sim_time)">
    <param name="/use_sim_time" value="true"/>
</group>

<include file="$(find mybot_gazebo)/launch/mybot_world.launch"> 
<!--arg name="world_pass" value="$(arg world)"/-->
</include>

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

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

<!-- convert joint states to TF transforms for rviz, etc -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" respawn="false" output="screen">
    <param name="robot_description" command="$(find xacro)/xacro '$(find mybot_description)/urdf/mybot.xacro'"/>
    <remap from="/joint_states" to="/mybot/joint_states" />
</node>

<node name="mybot_controller" pkg="mybot_controller" type="mybot_controller" output="screen">
    <rosparam command="load" file="$(find mybot_controller)/config/default.yaml"/>
</node>

<!--
<node name="rviz" pkg="rviz" type="rviz" output="screen"/>
-->

</launch>

URDF

<?xml version='1.0'?>

<robot <a="" href="http://xmlns:xacro="http://www.ros.org/wiki/xacro%22" name="myrobot">xmlns:xacro="http://www.ros.org/wiki/...></robot>

<xacro:property name="PI" value="3.1415926535897931"/>

<xacro:property name="chassisHeight" value="0.1"/>
<xacro:property name="chassisLength" value="0.4"/>
<xacro:property name="chassisWidth" value="0.25"/>
<xacro:property name="chassisMass" value="50"/>

<xacro:property name="casterRadius" value="0.04"/>
<xacro:property name="casterMass" value="5"/>

<xacro:property name="wheelWidth" value="0.05"/>
<xacro:property name="wheelRadius" value="0.08"/>
<xacro:property name="wheelPos" value="0.05"/>
<xacro:property name="wheelMass" value="5"/>

<xacro:property name="cameraSize" value="0.07"/>
<xacro:property name="cameraMass" value="0.1"/>

<xacro:include filename="$(find mybot_description)/urdf/mybot.gazebo" />
<xacro:include filename="$(find mybot_description)/urdf/materials.xacro" />
<xacro:include filename="$(find mybot_description)/urdf/macros.xacro" />

<link name="footprint" />

<joint name="base_joint" type="fixed">
    <parent link="footprint"/>
    <child link="chassis"/>
</joint>

<link name="chassis">
    <collision> 
        <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0"/> 
        <geometry> 
            <box size="${chassisLength} ${chassisWidth} ${chassisHeight}"/> 
        </geometry> 
    </collision>
    <visual> 
        <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0"/> 
        <geometry> 
            <box size="${chassisLength} ${chassisWidth} ${chassisHeight}"/> 
        </geometry> 
        <material name="orange"/>
    </visual>
    <inertial> 
        <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0"/> 
        <mass value="${chassisMass}"/> 
        <box_inertia m="${chassisMass}" x="${chassisLength}" y="${chassisWidth}" z="${chassisHeight}"/>
    </inertial>
< ...
(more)
edit retag flag offensive close merge delete