0
$\begingroup$

Rosanswers logo

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

https://drive.google.com/file/d/1h_KuQWqSG-fN56pFwcY_P6YahA0ftZVe/view?usp=sharing

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.stl"/>    
                </geometry>
            </collision>
        </link>
        
        <gazebo reference="${prefix}_rotate_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_rotate_joint" type="continuous">
            <parent link="${prefix}_base_link"/>
            <child link="${prefix}_rotate_link"/>
            <origin rpy="0 0 0" xyz="0.0 0.0 0.01"/>
            <axis xyz="0 0 1"/>
        </joint>                        
                                    
        <link name="${prefix}_wheel_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_wheel.dae"/>          
                </geometry>
                <material name="Yellow"/>
            </visual>
            
            <collision>
                <origin rpy="0 0 0" xyz="0 0 0"/>
                <geometry>
                    <mesh filename="package://mark_description/mesh/caster/caster_wheel.dae"/>
                </geometry>
            </collision>    
        </link>
        
        <gazebo reference="${prefix}_wheel_link">
            <material>Gazebo/Yellow</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}_rotate_wheel_joint" type="continuous">
            <parent link="${prefix}_rotate_link"/>
            <child link="${prefix}_wheel_link"/>
            <origin rpy="0 0 0" xyz="0.013 0 -0.03"/>
            <axis xyz="0 1 0"/>
        </joint>    

    </xacro:macro>  
</robot>

it all started when i entered caster_rotate_link


Originally posted by harish556 on ROS Answers with karma: 74 on 2021-05-27

Post score: 0


Original comments

Comment by abhishek47 on 2021-05-27:
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?

Comment by harish556 on 2021-05-27:
Yes I tried same thing happens

Comment by tryan on 2021-05-27:
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 :).

Comment by harish556 on 2021-05-27:
@tryan If you want I can send you my urdf file it will be a huge help

Comment by harish556 on 2021-05-27:
What does inherent collision means

Comment by tryan on 2021-05-28:\

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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by aprotyas with karma: 456 on 2021-05-27

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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