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

robot jumps when spawn

asked 2021-05-27 05:42:38 -0500

harish556 gravatar image

updated 2021-05-27 13:15:17 -0500

when ever robot is spawn into gazebo it jumps there is the video below

https://drive.google.com/file/d/1h_Ku...

edit

<?xml version="1.0"?>

<robot name="mark" xmlns:xacro="http://ros.org/wiki/xacro">

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

  <!-- Includes -->
    <xacro:include filename="$(find mark_description)/urdf/mark_base.urdf.xacro"/>
    <xacro:include filename="$(find mark_description)/urdf/mark_caster.urdf.xacro"/>
    <xacro:include filename="$(find mark_description)/urdf/mark_wheel.urdf.xacro"/>

    <!-- Differential Drive Plugin -->
 <gazebo>
    <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>10.0</updateRate> 
        <robotBaseFrame>base_link</robotBaseFrame>
        <publishWheelTF>true</publishWheelTF>
        <publishWheelJointState>true</publishWheelJointState>
        <wheelAcceleration>1</wheelAcceleration>
        <leftJoint>left_wheel_joint</leftJoint>
        <rightJoint>right_wheel_joint</rightJoint>
        <wheelSeparation>0.33</wheelSeparation>
        <wheelDiameter>0.17</wheelDiameter>
        <wheelTorque>20</wheelTorque>
        <commandTopic>cmd_vel</commandTopic>
        <odometryTopic>odom</odometryTopic>
        <odometryFrame>odom</odometryFrame>
    </plugin>
  </gazebo>

    <!-- Base -->
    <xacro:mark_base prefix="base"/>


    <!-- Left Wheel -->
    <xacro:mark_wheel prefix="left_wheel" 
                        joint_x="-0.099185" 
                        joint_y="0.23646" 
                        joint_z="-0.059645" 
                        joint_roll="0.0" 
                        joint_pitch="0.0" 
                        joint_yaw="0.0"  
                                            r="-1.57075"
                        parent_link="base_link" />

    <!-- Right Wheel     -->                    
    <xacro:mark_wheel prefix="right_wheel" 
                        joint_x="-0.099185" 
                        joint_y="-0.23646" 
                        joint_z="-0.059645" 
                        joint_roll="0.0" 
                        joint_pitch="0.0" 
                        joint_yaw="0.0"  
                                            r="1.57075"
                        parent_link="base_link" />

    <!-- Caster -->  
    <xacro:mark_caster prefix="front_caster" 

                         x="0.2347" 
                         y="0.0" 
                         z="-0.083329" 
                         roll="0.0"
                         pitch="0.0" 
                         yaw="0.0"  
                         parent_link="base_link" />
</robot>

caster wheel xacro

<?xml version="1.0"?>

<robot xmlns:xacro="http://ros.org/wiki/xacro">
    <xacro:macro name="mark_caster" params="prefix x y z roll pitch yaw parent_link">

        <link name="${prefix}_base_link">
            <inertial>
                <mass value="0.01" />
                <origin xyz="0 0 0" />
                <inertia ixx="1e-6" ixy="0.0" ixz="0.0" iyy="1e-6"  iyz="0.0" izz="1e-6" />
            </inertial>

            <visual>
                <origin rpy="0 0 0" xyz="0 0 0"/>
                <geometry>
                    <mesh filename="package://mark_description/mesh/caster/un.dae"/>
                </geometry>

                <material name="Grey"/>
            </visual>

            <collision>
                <origin rpy="0 0 0" xyz="0 0 0"/>

                <geometry>
                     <mesh filename="package://mark_description/mesh/caster/un.dae"/>               
                </geometry>
            </collision>
        </link>

        <gazebo reference="${prefix}_base_link">
            <material>Gazebo/Grey</material>
            <mu1>0.0</mu1>
            <mu2>0.0</mu2>
            <kp>1000000.0</kp>
            <kd>100.0</kd>
            <minDepth>0.001</minDepth>
            <maxVel>1.0</maxVel>        
        </gazebo>

        <joint name="${prefix}_base_joint" type="fixed">
            <parent link="${parent_link}"/>
            <child link="${prefix}_base_link"/>
            <origin rpy="${roll} ${pitch} ${yaw}" xyz="${x} ${y} ${z}"/>
            <axis xyz="0 0 0"/>
        </joint>


        <link name="${prefix}_rotate_link">
            <inertial>
                <mass value="0.01" />
                <origin xyz="0 0 0" />
                <inertia ixx="1e-6" ixy="0.0" ixz="0.0" iyy="1e-6" iyz="0.0" izz="1e-6" />
            </inertial>

            <visual>
                <origin rpy="0 0 0" xyz="0 0 0"/>
                <geometry>
                    <mesh filename="package://mark_description/mesh/caster/caster_rot.stl"/>    
                </geometry>

                <material name="Grey"/>
            </visual>

            <collision>
                <origin rpy="0 0 0" xyz="0 0 0"/>
                <geometry>
                    <mesh filename="package://mark_description/mesh/caster/caster_rot ...
(more)
edit retag flag offensive close merge delete

Comments

Not 100% sure this would work, but have you tried setting the inertia values ixx, iyy, and izz to a non-zero value for the links caster_rotate_link and caster_base_link?

abhishek47 gravatar image abhishek47  ( 2021-05-27 06:06:20 -0500 )edit

Yes I tried same thing happens

harish556 gravatar image harish556  ( 2021-05-27 06:11:40 -0500 )edit

Like @abhishek47kashyap said, the inertias should probably be non-zero. In addition, I've seen this kind of behavior when there's overlapping geometry (inherent collisions). Such situations can cause the solver to "explode" the model. Since you're using meshes, I can't tell if there is a collision, so you'll have to do a close inspection of the model before starting the simulation. Remember that visual and collision elements aren't necessarily the same.

On a side note, the inconsistent formatting of your URDF makes it difficult to read. Others may be more encouraged to answer if the information you provide is easier to assimilate :).

tryan gravatar image tryan  ( 2021-05-27 09:26:59 -0500 )edit

@tryan If you want I can send you my urdf file it will be a huge help

harish556 gravatar image harish556  ( 2021-05-27 11:55:38 -0500 )edit

What does inherent collision means

harish556 gravatar image harish556  ( 2021-05-27 12:00:01 -0500 )edit

I can send you my urdf file

If you have extra info, please edit your post to add/link it.

What does inherent collision means

I just mean that the robot may be defined in such a way that parts of it collide with each other. For example, if a wheel happens to be placed such that it intersects part of the chassis.

tryan gravatar image tryan  ( 2021-05-28 15:24:14 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-05-27 23:39:35 -0500

aprotyas gravatar image

From personal experience, this is most likely due to overlaps between the environment geometry and the initially spawned robot geometry (so, you basically have collisions present). You can spawn the robot at a higher z value to see if that fixes things.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-05-27 05:42:38 -0500

Seen: 309 times

Last updated: May 27 '21