The robot model in Rviz shakes between base_link and odom [closed]
During g-mapping the robot in rviz oscillates between the base_link and odom frame
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).
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 ...
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?
thanks for taking time reading my query.. how to give you log.Could you guide me how to take log?
@Dragonslayer I have changed my problem statement since the robot Is shaking during the initial process i.e, during mapping itself.
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 1. Console logs a lot - Yes there are lots of folders inside the .ros folder.
@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?
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.
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