The robot model in Rviz shakes between base_link and odom [closed]

asked 2021-11-11 10:56:00 -0500

sidharth.jeyabal gravatar image

updated 2021-11-12 10:50:28 -0500

Ranjit Kathiriya gravatar image
  1. During g-mapping the robot in rviz oscillates between the base_link and odom frame

  2. Please refer to the Image below .The Laser lines are not correctly aligned with the robot in rviz when compared to how it should be with respect to robot position in gazebo. The robot with respect to laser lines or vice- versa seems to be oriented at 90 degree to with respect to each other(in rviz).

image description

EDIT - 1

The link to urdf

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

 <material name="blue">
      <color rgba="0 0 0.8 1"/>
   </material>

   <material name="green">
      <color rgba="0.0 0.8 0.0 1.0"/>
   </material>

   <material name="white">
    <color rgba="1 1 1 1"/>
   </material>

<link name= "base_link">
    <inertial >
          <origin xyz="0 0 0" rpy = "0 0 0"/>
          <mass value="20"/>
              <inertia
          ixx="0.1666666667" ixy="0" ixz="0"
              iyy="0.5666666667" iyz="0"
              izz="0.4333333333"/>
    </inertial>

    <visual>
       <origin xyz="0 0 0.052 " rpy="0 0 1.5708"/>
       <geometry>
         <box size="0.5 0.3 0.1"/>
       </geometry>
            <material name="blue" />
    </visual>

    <collision>
       <origin xyz="0 0 0.052 " rpy="0 0 1.5708"/>
        <geometry>
        <box size="0.5 0.3 0.1"/>
        </geometry>
    </collision>
         <!-- caster front -->
    <collision name="caster_front_collision">
      <origin rpy=" 0 0 0" xyz="0 -0.15 0"/>
      <geometry>
        <sphere radius="0.05"/>
      </geometry>
      <surface>
        <friction>
          <ode>
            <mu>1</mu>
            <mu2>1</mu2>
            <slip1>0.0</slip1>
            <slip2>0.0</slip2>
            <fdir1>1 0 0</fdir1>
          </ode>
        </friction>
      </surface>
    </collision>
    <visual name="caster_front_visual">
      <origin rpy=" 0 0 0" xyz="0 -0.15 0"/>
      <geometry>
        <sphere radius="0.05"/>
      </geometry>
    </visual>
</link>

<link name= "left_wheel">
    <inertial >
          <origin xyz="0 0 0" rpy = "0 0 0"/>
          <mass value="3"/>
              <inertia
          ixx="0.0079" ixy="0" ixz="0"
              iyy="0.0079" iyz="0"
              izz="0.015"/>
    </inertial>


    <visual>
       <origin xyz="0 0 0 " rpy="0 0 0"/>
       <geometry>
         <cylinder radius="0.1" length ="0.04"/>
       </geometry>
            <material name="white" />
    </visual>

    <collision>
     <origin xyz="0 0 0 " rpy="0 0 0"/>
        <geometry>
         <cylinder radius="0.1" length ="0.04"/>
        </geometry>
    </collision>
</link>

<joint name="left_joint" type="continuous">
     <axis xyz="0 0 1"/>
     <origin xyz="0.15 0.1 0.05" rpy="0 1.5708 0"/>
     <parent link="base_link"/>
     <child link="left_wheel"/>
 </joint>


<link name= "right_wheel">
    <inertial >
          <origin xyz="0 0 0" rpy = "0 0 0"/>
          <mass value="3"/>
              <inertia
          ixx="0.0079" ixy="0" ixz="0"
              iyy="0.0079" iyz="0"
              izz="0.015"/>
    </inertial>

    <visual>
       <origin xyz="0 0 0 " rpy="0 0 0"/>
       <geometry>
         <cylinder radius="0.1" length ="0 ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sidharth.jeyabal
close date 2021-11-15 04:11:48.688649

Comments

In an empty world trying to localize (I assume its amcl) in a given map cannot work. Its not the map for this world. Only when you input a "wrong" initial position (scan in no way aligning with the map) the shaking starts. Could be re initialization or something similar. It seems to be resetting in an endless loop somehow. What does the logs say?

Dragonslayer gravatar image Dragonslayer  ( 2021-11-11 11:07:25 -0500 )edit

thanks for taking time reading my query.. how to give you log.Could you guide me how to take log?

sidharth.jeyabal gravatar image sidharth.jeyabal  ( 2021-11-11 11:12:23 -0500 )edit

@Dragonslayer I have changed my problem statement since the robot Is shaking during the initial process i.e, during mapping itself.

sidharth.jeyabal gravatar image sidharth.jeyabal  ( 2021-11-11 12:30:03 -0500 )edit
  1. in your home directory is a hidden .ros folder there are the logs. also the console logs alot, but that was about the initial question.
  2. If odometry doesnt work correct mapping will not work well. Do you use wheel encoders? A video would be better then a picture.

To me it seems the laserscan is 90° counter clockwise, while the base is not. Possibly the sensor(scan) is not correct aligned in the urdf.

Dragonslayer gravatar image Dragonslayer  ( 2021-11-11 14:45:43 -0500 )edit

@Dragonslayer 1. Console logs a lot - Yes there are lots of folders inside the .ros folder.

  1. I don't have encoders because I'm not working with real robots. If you need anything so that you can help please tell. I want to stop this robot from bouncing.
sidharth.jeyabal gravatar image sidharth.jeyabal  ( 2021-11-11 20:59:47 -0500 )edit

@Dragonslayer I found the root cause of robot shaking in rviz,it was because tf to Odom was broadcasted by both amcl and slam(g-mapping).So during mapping I commented amcl node to avoid it. THen another thing You said the sensor is not correctly aligned in urdf: I have tried many things but still cant bring it to alignment. Any ideas on this?

sidharth.jeyabal gravatar image sidharth.jeyabal  ( 2021-11-12 04:25:03 -0500 )edit

Yes, mapping and navigation/localization usually are two different launch files. "I have tried many things" Did you try rotating the joint in the urdf? <origin xyz="YOUR VALUES" rpy="0 0 -1.570796"/> I would give a try.

Dragonslayer gravatar image Dragonslayer  ( 2021-11-12 07:20:27 -0500 )edit

Yes @Dragonslayer still the lasers are showing the same results.Here is the image. I have done change here :

<joint name="hokuyo_joint" type="fixed"> <origin xyz="0 -0.15 0.20" rpy="0 0 **-1.57**"/> <parent link="base_link"/> <child link="hokuyo_link"/> </joint>enter code here

sidharth.jeyabal gravatar image sidharth.jeyabal  ( 2021-11-12 09:17:37 -0500 )edit