RVIZ No transform from [/links to [odom]
ubuntu : 16.04 os: kinetic robot : evarobot
I'm trying to work on real robot , i have a simple urdf file that is wheels connected with baselink with diff drive. I launched a real state file that contain robotstate publisher , jointstate publisher and odomtobase tf broadcaster, my urdf file look good odom ->baselink.however, in rviz my model has no wheels and i have warning (No transform from [/links to [odom] )
my URDF file :
<?xml version="1.0" encoding="UTF-8"?>
<robot name="evarobotmodel">
<!--BASE -->
<link name="base_link">
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.4 0.3 0.3"/>
</geometry>
</collision>
<visual>
<origin xyz="0.065 -0.11 -0.15" rpy="0 0 0" />
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/base.dae"/>
</geometry>
<material name="Gazebo/Black" />
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="10.0"/>
<inertia
ixx="1.0" ixy="0" ixz="0"
iyy="1.0" iyz="0"
izz="1.0"/>
</inertial>
</link>
<gazebo reference="base_link">
<material>Gazebo/Black</material>
</gazebo>
<link name="basecolor_link">
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.0001 0.0001 0.0001"/>
</geometry>
</collision>
<visual>
<origin xyz="0.065 -0.11 -0.15" rpy="0 0 0" />
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/base_orange.dae"/>
</geometry>
<material name="Orange" />
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="0.0001"/>
<inertia
ixx="1e-6" ixy="0.0" ixz="0.0"
iyy="1e-6" iyz="0.0"
izz="1e-6"/>
</inertial>
</link>
<gazebo reference="basecolor_link">
<material>Gazebo/Orange</material>
</gazebo>
<joint name="basecolor_joint" type="fixed">
<axis xyz="0 1 0" />
<origin xyz="0 0 0" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="basecolor_link"/>
</joint>
<!-- LEFT WHEEL -->
<link name="left_wheel_link">
<collision>
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="0.035" radius="0.085"/>
</geometry>
</collision>
<visual>
<origin rpy="0 0 1.57079632679" xyz="0 0 0"/>
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/rim.dae" scale="1 1 1"/>
</geometry>
<material name="Grey"/>
</visual>
<inertial>
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
<mass value="0.85"/>
<inertia
ixx="0.001" ixy="0" ixz="0"
iyy="0.001" iyz="0"
izz="0.001"/>
</inertial>
</link>
<gazebo reference="left_wheel_link">
<material>Gazebo/Grey</material>
<mu1>1.0</mu1>
<mu2>1.0</mu2>
<kp>1000000.0</kp>
<kd>100.0</kd>
<minDepth>0.001</minDepth>
<maxVel>1.0</maxVel>
</gazebo>
<joint name="left_wheel_joint" type="continuous">
<axis xyz="0 1 0"/>
<parent link="base_link"/>
<child link="left_wheel_link"/>
<origin rpy="0 0 0" xyz="0 0.16 -0.119"/>
</joint>
<link name="left_wheeltire_link">
<collision>
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="0.001" radius="0.001"/>
</geometry>
</collision>
<visual>
<origin rpy="0 0 1.57079632679" xyz="0 0 0"/>
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/tire.dae"/>
</geometry>
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="0.001"/>
<inertia
ixx="0.001" ixy="0" ixz="0"
iyy="0.001" iyz="0"
izz="0.001"/>
</inertial>
</link>
<gazebo reference="left_wheeltire_link">
<material>Gazebo/Black</material>
</gazebo>
<joint name="left_wheeltire_joint" type="fixed">
<axis xyz="0 1 0"/>
<parent link="left_wheel_link"/>
<child link="left_wheeltire_link"/>
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
</joint>
<!-- RIGHT WHEEL -->
<link name="right_wheel_link">
<collision>
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="0.035" radius="0.085"/>
</geometry>
</collision>
<visual>
<origin rpy="0 0 1.57079632679" xyz="0 0 0"/>
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/rim.dae" scale="1 1 1"/>
</geometry>
<material name="Grey"/>
</visual>
<inertial>
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
<mass value="0.85"/>
<inertia
ixx="0.001" ixy="0" ixz="0"
iyy="0.001" iyz="0"
izz="0.001"/>
</inertial>
</link>
<gazebo reference="right_wheel_link">
<material>Gazebo/Grey</material>
<mu1>1.0</mu1>
<mu2>1.0</mu2>
<kp>1000000.0</kp>
<kd>100.0</kd>
<minDepth>0.001</minDepth>
<maxVel>1.0</maxVel>
</gazebo>
<joint name="right_wheel_joint" type="continuous">
<axis xyz="0 1 0"/>
<parent link="base_link"/>
<child link="right_wheel_link"/>
<origin rpy="0.0 0.0 0.0" xyz="0.0 -0.16 -0.119"/>
</joint>
<link name="right_wheeltire_link">
<collision>
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="0.001" radius="0.001"/>
</geometry>
</collision>
<visual>
<origin rpy="0 0 1.57079632679" xyz="0 0 0"/>
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/tire.dae" scale="1 1 1"/>
</geometry>
<material name="Black"/>
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="0.001"/>
<inertia
ixx="0.001" ixy="0" ixz="0"
iyy="0.001" iyz="0"
izz="0.001"/>
</inertial>
</link>
<gazebo reference="right_wheeltire_link">
<material>Gazebo/Black</material>
</gazebo>
<joint name="right_wheeltire_joint" type="fixed">
<axis xyz="0 1 0"/>
<parent link="right_wheel_link"/>
<child link="right_wheeltire_link"/>
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
</joint>
<!-- FRONT CASTER -->
<link name="front_caster_base_link">
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<box size="0.06 0.06 0.0135"/>
</geometry>
</collision>
<visual>
<origin rpy="3.1415926535897931 0 0" xyz="-0.005 -0.01075 0.00675"/>
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/caster_base.dae" scale="1 1 1"/>
</geometry>
<material name="Grey"/>
</visual>
<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>
</link>
<gazebo reference="front_caster_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="front_caster_base_joint" type="fixed">
<parent link="base_link"/>
<child link="front_caster_base_link"/>
<origin rpy="0.0 0.0 0.0" xyz="0.1604 0.0 -0.15675"/>
<axis xyz="0 0 0"/>
</joint>
<link name="front_caster_rotate_link">
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="0.023" radius="0.0215"/>
</geometry>
</collision>
<visual>
<origin rpy="3.1415926535897931 0 1.57079632679" xyz="0 0 0.01"/>
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/caster_rot.dae"/>
</geometry>
</visual>
<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>
</link>
<gazebo reference="front_caster_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="front_caster_base_rotate_joint" type="continuous">
<parent link="front_caster_base_link"/>
<child link="front_caster_rotate_link"/>
<origin rpy="0 0 0" xyz="0.0 0.0 -0.0185"/>
<axis xyz="0 0 1"/>
</joint>
<link name="front_caster_wheel_link">
<collision>
<origin rpy="1.57079632679 0 0" xyz="0 0 0"/>
<geometry>
<sphere radius="0.0175"/>
</geometry>
</collision>
<visual>
<origin rpy="1.57079632679 0 0" xyz="0 0 0"/>
<geometry>
<sphere radius="0.0175"/>
</geometry>
</visual>
<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>
</link>
<gazebo reference="front_caster_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="front_caster_rotate_wheel_joint" type="continuous">
<parent link="front_caster_rotate_link"/>
<child link="front_caster_wheel_link"/>
<origin rpy="0 0 0" xyz="-0.014632 0.0 -0.0115"/>
<axis xyz="0.577350269 0.577350269 0.577350269"/>
</joint>
<!--REAR CASTER -->
<link name="rear_caster_base_link">
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<box size="0.06 0.06 0.0135"/>
</geometry>
</collision>
<visual>
<origin rpy="3.1415926535897931 0 0" xyz="-0.005 -0.01075 0.00675"/>
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/caster_base.dae" scale="1 1 1"/>
</geometry>
<material name="Grey"/>
</visual>
<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>
</link>
<gazebo reference="rear_caster_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="rear_caster_base_joint" type="fixed">
<parent link="base_link"/>
<child link="rear_caster_base_link"/>
<origin rpy="0.0 0.0 0.0" xyz="-0.1604 0.0 -0.15675"/>
<axis xyz="0 0 0"/>
</joint>
<link name="rear_caster_rotate_link">
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="0.023" radius="0.0215"/>
</geometry>
</collision>
<visual>
<origin rpy="3.1415926535897931 0 1.57079632679" xyz="0 0 0.01"/>
<geometry>
<mesh filename="package://evarobotmodel_description/meshes/caster_rot.dae" scale="1 1 1"/>
</geometry>
<material name="Grey"/>
</visual>
<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>
</link>
<gazebo reference="rear_caster_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="rear_caster_base_rotate_joint" type="continuous">
<parent link="rear_caster_base_link"/>
<child link="rear_caster_rotate_link"/>
<origin rpy="0 0 0" xyz="0.0 0.0 -0.0185"/>
<axis xyz="0 0 1"/>
</joint>
<link name="rear_caster_wheel_link">
<collision>
<origin rpy="1.57079632679 0 0" xyz="0 0 0"/>
<geometry>
<sphere radius="0.0175"/>
</geometry>
</collision>
<visual>
<origin rpy="1.57079632679 0 0" xyz="0 0 0"/>
<geometry>
<sphere radius="0.0175"/>
</geometry>
<material name="Yellow"/>
</visual>
<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>
</link>
<gazebo reference="rear_caster_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="rear_caster_rotate_wheel_joint" type="continuous">
<parent link="rear_caster_rotate_link"/>
<child link="rear_caster_wheel_link"/>
<origin rpy="0 0 0" xyz="-0.014632 0.0 -0.0115"/>
<axis xyz="0.577350269 0.577350269 0.577350269"/>
</joint>
<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>right_wheel_joint</leftJoint>
<rightJoint>left_wheel_joint</rightJoint>
<wheelSeparation>0.33</wheelSeparation>
<wheelDiameter>0.17</wheelDiameter>
<wheelTorque>20</wheelTorque>
<commandTopic>cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotNamespace>/</robotNamespace>
<legacyMode>true</legacyMode>
<publishTf>true</publishTf>
</plugin>
</gazebo>
<gazebo>
<plugin name="joint_state_publisher" filename="libgazebo_ros_joint_state_publisher.so">
<robotNamespace>/</robotNamespace>
<jointName>left_wheel_joint,right_wheel_joint,front_caster_base_rotate_joint,rear_caster_base_rotate_joint,front_caster_rotate_wheel_joint,rear_caster_rotate_wheel_joint</jointName>
<updateRate>10.0</updateRate>
<alwaysOn>true</alwaysOn>
</plugin>
</gazebo>
</robot>
my realstate launch file :
<?xml version="1.0"?>
<launch>
<arg name="robot_ns" default="/" />
<param name="robot_description" command="cat $(find evarobotmodel_description)/urdf/evarobotmodel.urdf" />
<node pkg="evarobot_state_publisher" name="odom_to_base" ns="$(arg robot_ns)" type="odom_to_base" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" >
<param name="tf_prefix" type="string" value="/" />
<remap from="joint_states" to="/joint_states" />
</node>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<param name="/use_gui" value="False"/>
<param name="rate" value="10"/>
</node>
</launch>
-odomtobase tf broadcaster :
#include "ros/ros.h"
#include "tf/transform_broadcaster.h"
#include "nav_msgs/Odometry.h"
#include "geometry_msgs/PoseWithCovarianceStamped.h"
geometry_msgs::TransformStamped odom_trans;
geometry_msgs::TransformStamped combined_odom_trans;
void Callback(const nav_msgs::Odometry::ConstPtr& msg)
{
odom_trans.header.stamp = msg->header.stamp;//ros::Time::now();
odom_trans.header.frame_id = msg->header.frame_id;
odom_trans.child_frame_id = msg->child_frame_id;
odom_trans.transform.translation.x = msg->pose.pose.position.x;
odom_trans.transform.translation.y = msg->pose.pose.position.y;
odom_trans.transform.translation.z = msg->pose.pose.position.z;
odom_trans.transform.rotation = msg->pose.pose.orientation;
}
void CallbackCombined(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr& msg)
{
combined_odom_trans.header.stamp = ros::Time::now();
combined_odom_trans.header.frame_id = "odom_combined";
combined_odom_trans.child_frame_id = "base_link";
combined_odom_trans.transform.translation.x = msg->pose.pose.position.x;
combined_odom_trans.transform.translation.y = msg->pose.pose.position.y;
combined_odom_trans.transform.translation.z = msg->pose.pose.position.z;
combined_odom_trans.transform.rotation = msg->pose.pose.orientation;
}
int main(int argc, char** argv){
ros::init(argc, argv, "odom_to_base");
ros::NodeHandle n;
// ros::Publisher odom_pub = n.advertise<nav_msgs::Odometry>("odom", 50);
ros::Subscriber sub_odom = n.subscribe("odom", 1, Callback);
ros::Subscriber sub_odom_combined = n.subscribe("robot_pose_ekf/odom_combined", 1, CallbackCombined);
tf::TransformBroadcaster odom_broadcaster;
tf::TransformBroadcaster combined_odom_broadcaster;
ros::Rate r(100);
while(n.ok())
{
// check for incoming messages
ros::spinOnce();
//send the transform
odom_broadcaster.sendTransform(odom_trans);
// combined_odom_broadcaster.sendTransform(combined_odom_trans);
r.sleep();
}
}
- RVIZ :-
-TF tree:-
-rqt_graph:- C:\fakepath\rqt_grapgh.png
how to solve this problem and have my wheels connected correctly .
Asked by q8wwe on 2020-02-18 09:26:29 UTC
Answers
It looks like joint_state_publisher plugin joints' links in your urdf not connected to odom while working with real robot. Can you try the add robot_description param again "< param name="robot_description" command="cat $(find evarobotmodel_description)/urdf/evarobotmodel.urdf" /> " inside the joint_state_publisher node in launch file.
Asked by DidemÖzüpekTas on 2020-02-18 11:53:12 UTC
Comments
I tried to add the robot description tag to joint_state_publisher but didn't work, it gave same errors .
Asked by q8wwe on 2020-02-18 13:14:51 UTC
Maybe there is a time conflict between odom -> base_link and base_link-> other_links. Can you listen /tf topic and analyse the ros time odom->base_link and base_link-> not transform links. If it is the problem you can change the header.stamp in odom_to_base tf broadcaster like this: odom_trans.header.stamp = ros::Time::now();
Asked by DidemÖzüpekTas on 2020-02-19 03:14:37 UTC
I tried to add : odom_trans.header.stamp = ros::Time::now(); , but it didn't work it gave same error . is there any other solution or idea i can try to solve this problem .
Asked by q8wwe on 2020-02-19 11:35:49 UTC
I have reproduce your problem with your code and launch file with Indigo Evarobot and Kinetic ROS Slave PC. ros::Time::now() solved the issue. I have no better idea.
Asked by DidemÖzüpekTas on 2020-02-20 01:14:14 UTC
Comments