Gazebo is not able to send the joint states to generate tf tree.
Hi everyone,
I am trying to see my robot in gazebo and rviz, but I am not able to send the joint states to robot_state_publisher directly from gazebo to generate the tf tree. For this reason, the robot does not appear correctly in rviz. When I use the joint_state_publisher, the robot is correctly shown in rviz but it not move like in gazebo.
This is the graph: https://drive.google.com/file/d/1JWmT...
If I remove the joint_state_publisher, rviz loose the transformation between movable joints.
What am I doing wrong?
EDIT: Here follows the launch file:
<?xml version="1.0"?>
<launch>
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="debug" default="false"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find mm_description)/worlds/mm.world"/>
<arg name="debug" value="$(arg debug)" />
<arg name="gui" value="$(arg gui)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
</include>
<!-- Robot model -->
<param name="robot_description" command="$(find xacro)/xacro '$(find mm_description)/urdf/mm.xacro'" />
<arg name="x" default="0"/>
<arg name="y" default="0"/>
<arg name="z" default="0.5"/>
<!-- Spawn the robot model -->
<node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen" args="-urdf -param robot_description -model mm -x $(arg x) -y $(arg y) -z $(arg z)" />
<!-- send joint values -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<remap from="/joint_states" to="/mm/joint_states" />
<param name="use_gui" value="True"/>
</node>
<node name="joint_state_spawner" pkg="controller_manager" type="spawner"
respawn="false" output="screen" ns="/mm"
args="joint_state_controller">
</node>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="false" output="screen">
<remap from="/joint_states" to="/mm/joint_states" />
</node>
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find mm_control)/config/mm_state_controller.yaml" command="load"/>
<rosparam file="$(find mm_control)/config/mm_controllers.yaml" command="load"/>
<rosparam file="$(find mm_control)/config/mm_actuators.yaml" command="load"/>
<!-- load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/mm" args="position_controller">
</node>
<!-- Show in Rviz -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mm_description)/launch/config.rviz"/>
</launch>
The command rostopic echo returns:
header:
seq: 48780
stamp:
secs: 53 nsecs: 311000000 frame_id: ''
name: [frame__crank]
position: [-0.1847331807173509]
velocity: [-0.027513476836548797]
effort: [14.126169875336736]
--- header:
seq: 48781
stamp:secs: 53 nsecs: 312000000
frame_id: ''
name: [frame__crank]
position: [-0.18476008023893709]
velocity: [-0.027133224871914673]
effort: [14.117217536586715]
Could you post your launch files? Maybe this makes it easy to answer your question correctly.
Hi Teo, thank you for helping. I have edited the question and put the launch file.
Weird, this looks right to me. Deactivate the joint_state GUI and if is possible, post the result of
Did you using joint_state_publisher only with
or did you try with this parameter set False ?
I have edited and put the rostopic echo response.
I am using just joint_state_publisher. I delete the line param name="use_gui" value="True"
I tried to check the main reason for failure, however, I couldn' t find. If there is any public github repository with the project I would like to know. Otherwise, really sorry, but I don't know how I can help you.
Thank you for your help Teo. I think that I have found a solution (maybe not the best one, but it works... hehe).