[MoveIt!] Cannot update robot's state
Hey everyone!
My problem is related to this one: http://answers.ros.org/question/252114/failed-to-validate-trajectory-couldnt-receive-full-current-joint-state-within-1s-error/. Also to this one: http://answers.ros.org/question/254927/failed-to-validate-trajectory-after-updating-moveit-feb-2017/.
The thing is, much like the OP of these questions, Often I would receive the following warning message from MoveIt! when trying to execute trajectories (in Gazebo):
Failed to validate trajectory: couldn't receive full current joint state within 1s
After that, I am no longer able to execute more trajectories with MoveIt! until I restart the whole simulation.
Unlike what the comments and answers of the previously referenced questions suggest, my movegroup node is subscribed to the correct jointstates topic, and the joint angles of the robots are being published here (@50Hz). In fact, while I have this problem in ROS Kinetic, my set-up works just fine in ROS Indigo.
Even when the previous warning does not appear, I would get this other one:
Failed to fetch current robot state
After this warning, I can still work with MoveIt!, although it is a strong indicative that the robot's state is not being monitored and/or updated by the move_group node.
I am working with a Barrett WAM simulated arm (actually, with a couple of them combined into a single robot). As I said, I am working with ROS Kinetic and with the version of MoveIt! that is being shipped by the Ubuntu's repository. Also, everything works fine in ROS Indigo (which, of course, comes with an older MoveIt!'s version). Below you can see a fragment of a log I got in a session with MoveIt! in Kinetic:
[ INFO] [1490477334.335206408, 42.968000000]: Cancelling execution for iri_wam_picker_controller
[ WARN] [1490477335.335728535, 43.168000000]: Failed to receive current joint state
[ INFO] [1490477335.336702721, 43.168000000]: Execution completed: TIMED_OUT
[ WARN] [1490477380.333069544, 52.725000000]: Failed to fetch current robot state.
[ INFO] [1490477380.333307431, 52.725000000]: Planning request received for MoveGroup action. Forwarding to planning pipeline.
[ INFO] [1490477380.345604383, 52.725000000]: Planner configuration 'picker[RRTConnectkConfigDefault]' will use planner 'geometric::RRTConnect'. Additional configuration parameters will be set when the planner i$
constructed.
[ INFO] [1490477380.357309208, 52.728000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.359983571, 52.729000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.364642171, 52.729000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.368296469, 52.730000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.529691461, 52.771000000]: picker[RRTConnectkConfigDefault]: Created 4 states (2 start + 2 goal)
[ INFO] [1490477380.547800109, 52.775000000]: picker[RRTConnectkConfigDefault]: Created 5 states (2 start + 3 goal)
[ INFO] [1490477380.549793251, 52.776000000]: picker[RRTConnectkConfigDefault]: Created 4 states (2 start + 2 goal)
[ INFO] [1490477380.562846623, 52.777000000]: picker[RRTConnectkConfigDefault]: Created 4 states (2 start + 2 goal)
[ INFO] [1490477380.564459663, 52.777000000]: ParallelPlan::solve(): Solution found by one or more threads in 0.209642 seconds
[ INFO] [1490477380.564928778, 52.777000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.567619783, 52.778000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.568293949, 52.778000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.580059275, 52.781000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.753351315, 52.804000000]: picker[RRTConnectkConfigDefault]: Created 4 states (2 start + 2 goal)
[ INFO] [1490477380.768773426, 52.805000000]: picker[RRTConnectkConfigDefault]: Created 5 states (2 start + 3 goal)
[ INFO] [1490477380.774875723, 52.808000000]: picker[RRTConnectkConfigDefault]: Created 5 states (2 start + 3 goal)
[ INFO] [1490477380.780975532, 52.808000000]: picker[RRTConnectkConfigDefault]: Created 5 states (2 start + 3 goal)
[ INFO] [1490477380.781611245, 52.808000000]: ParallelPlan::solve(): Solution found by one or more threads in 0.216859 seconds
[ INFO] [1490477380.782329675, 52.809000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.783739404, 52.809000000]: picker[RRTConnectkConfigDefault]: Starting planning with 1 states already in datastructure
[ INFO] [1490477380.947474992, 52.844000000]: picker[RRTConnectkConfigDefault]: Created 5 states (2 start + 3 goal)
[ INFO] [1490477381.007068114, 52.857000000]: picker[RRTConnectkConfigDefault]: Created 5 states (2 start + 3 goal)
[ INFO] [1490477381.007319507, 52.857000000]: ParallelPlan::solve(): Solution found by one or more threads in 0.225111 seconds
[ INFO] [1490477381.150956902, 52.893000000]: SimpleSetup: Path simplification took 0.143422 seconds and changed from 3 to 17 states
[ INFO] [1490477388.151700910, 54.544000000]: Execution request received for ExecuteTrajectory action.
[ WARN] [1490477389.152529500, 54.731000000]: Failed to validate trajectory: couldnt receive full current joint state within 1s
[ INFO] [1490477389.152749783, 54.731000000]: Execution completed: ABORTED
[ WARN] [1490477421.458512817, 62.028000000]: Failed to fetch current robot state.
An this is my launch file:
<?xml version="1.0" ?>
<launch>
<!-- these are the arguments you can pass this launch file, for example paused:=true -->
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="robot" default="iri_wam_combined"/>
<arg name="rviz" default="false"/>
<arg name="config" default="$(find iri_task_motion_integration_gazebo)/config/iri_wam_combined.rviz" />
<arg name="perception_pipeline" default="false"/>
<arg name="experiment" default="1"/>
<!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find iri_task_motion_integration_gazebo)/worlds/experiment$(arg experiment).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)"/>
<arg name="headless" value="$(arg headless)"/>
</include>
<param name="use_gui" value="$(arg gui)" />
<group ns="$(arg robot)">
<param name="robot_description" command="$(find xacro)/xacro '$(find robots_description)/xacro/$(arg robot).urdf.xacro' --inorder" />
<!-- Load the URDF into the ROS Parameter Server -->
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model $(arg robot) -param robot_description"/>
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find iri_task_motion_integration_gazebo)/config/$(arg robot)_control.yaml" command="load"/>
<!-- load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="true"
output="screen" args="joint_state_controller iri_wam_picker_controller iri_wam_catcher_controller" />
<!-- Convert joint states to TF transforms for rviz, etc -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen">
<!--<remap from="joint_states" to="/joint_states"/>-->
</node>
<include file="$(find robots_description)/launch/$(arg robot)_move_group.launch" />
</group>
<node if="$(arg rviz)" name="rviz" pkg="rviz" type="rviz" args="-d $(arg config)"/>
<include if="$(arg perception_pipeline)" file="$(find iri_perception_pipeline)/launch/start_pipeline.launch">
<arg name="freenect_driver" value="false" />
</include>
</launch>
I could provide a screenshot of rqtgraph if I had enough points. Since that's not the case, I can guarantee you that much as I have previously said, movegroup is subscribed to the same topic where Gazebo is publishing the joints (and I guarantee you that the state of all the 14 joints of the robot appear here).
I have asked for help also in the MoveIt! Google group, hoping to reach as many people as possible that have had or has the same problem. Here is the link to the other message: https://groups.google.com/forum/#!topic/moveit-users/_bmwijmlUWM.
Anyway, I would highly appreciate any clue or hint on this topic since I really don't know what else should I check.
Thanks in advance!! Alejandro
EDIT 2017-03-27: I've set the allowed start tolerance to 0, as per suggestion of v4hn's answer in http://answers.ros.org/question/254927/failed-to-validate-trajectory-after-updating-moveit-feb-2017/. With that, I won't get the "Failed to validate trajectory: couldn't receive full current joint state within 1s" warning in Kinetic, although I still receive this other warning in Rviz when trying to read the robot's current state:
Maybe failed to update robot state, time diff: 0,209s
Anyway, I am not sure I want to skip the start-state validation (it's not like I do notice any difference, but I do not know which are the repercussions of doing that). Neither do I understand why I need this in Kinetic while the robot's state updates just fine when working in Indigo.
Asked by asuarez on 2017-03-25 18:14:13 UTC
Comments
Are you sure all joints of the robot are published via /joint_states? Could you compare the list of joints published between indigo/kinetic?
Asked by v4hn on 2017-03-27 05:17:34 UTC
Thank you very much for your interest. Yes, I am pretty sure that all the 14 (7 per arm) joints are being published into the /joint_states topic, both in Indigo and in Kinetic. There is a relevant update, tho. I've managed to make it work in Kinetic changing something seemingly unrelated.
Asked by asuarez on 2017-03-27 06:08:45 UTC
deactivating the validation is not unrelated at all :) But it does not fix the underlying problem that apparently your move_group does not receive the current state of the robot. Did you check the timestamps of the joint_state message? If there is too much delay to the "current" simulation time
Asked by v4hn on 2017-03-27 10:39:52 UTC
then this could explain the failure to update the state too.
Asked by v4hn on 2017-03-27 10:40:33 UTC
Sorry, "unrelated" was a poorly selected word D: Probably I was thinking of "unwanted" or "undesired". Right now I cannot test this on my laptop (I'm working on my lab's computer, the one that has Indigo installed), but I'll check as soon as I can. I'll let you know. Thanks!
Asked by asuarez on 2017-03-27 11:04:39 UTC
I am not sure, but I believe that the error is related to the timestamps, as you suggest, and Rviz already provided a good hint ("Maybe failed to update robot state, time diff: 0,209s"). I think there is a significant difference between the last published joint_states messages and the current time.
Asked by asuarez on 2017-03-30 11:39:59 UTC
Hi, have you managed to fix the problem, and if so, how? I'm running into the same issue. Thanks!
Asked by retepvan on 2017-07-20 11:10:19 UTC
The root of this problem seemed to be the outdated joint state messages. If the delay exceeds one second then you have a serious problem with your setup.
Apart from this, the
waitForCurrentState
method expects a background spinner to process incoming joint state messages.Asked by v4hn on 2017-07-21 05:24:48 UTC
So you have to have an additional spinner thread (e.g. an
ros::AsyncSpinner
) around, if you use the method in your own code.Asked by v4hn on 2017-07-21 05:25:31 UTC
I am having the same Problem. Everything seems to be set up correctly and i got it to work. After moving the robot in an other namespace (i need two of them) moveit stopped working. How can i check if the timestamps are the problem? Where does the move group look for the robots states?
Asked by Panda1638 on 2017-08-14 08:58:07 UTC
Hello, did anybody manage to solve it? I'm exactly in the same situation
Asked by hpoleselo on 2018-09-13 07:37:05 UTC
In my case, the issue was that the system time on the command-sending computer was different to Baxter's system time. I just opened Time & Date settings and changed the time to match Baxter's to the second...
Asked by retepvan on 2018-09-17 08:31:08 UTC