failed to fetch current robot state

asked 2018-09-03 11:34:19 -0500

iabadia gravatar image

Dear all,

I want to use MoveIt to make Baxter follow a trajectory in cartesian space (first on simulation and then on the real robot). Unfortunately I am facing an issue when trying to get the robot's current joints state and have no clue on how to fix it (I have already tried the remapping from="joint_states" to="robot/joint_states as suggested in many posts).

Here is the procedure I'm following:

-Launch Baxter in Gazebo as usual.

 roslaunch baxter_gazebo baxter_world.launch

-Launch the joint trajectory action server and baxter_moveit. This I do all together in a launch file as follows:

<launch>
    <!-- Run joint trajectory action server node (required for MoveIt!) -->
    <node pkg="baxter_interface" type="joint_trajectory_action_server.py" name="trajectory_node" >
    </node>
    <!-- Run launch file that runs MoveIt!. Remap the joint state topic -->
    <include file="$(find baxter_moveit_config)/launch/baxter_grippers.launch"/>
      <remap from="joint_states" to="robot/joint_states"/>
</launch>

-Then launch the following very simple node just to test that it's working fine:

#!/usr/bin/env python
import sys
import copy
import rospy
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
from math import pi
from std_msgs.msg import String
from moveit_commander.conversions import pose_to_list

class Simple_test(object):

    def __init__(self):
        rospy.init_node('simple_node', anonymous=True)
        moveit_commander.roscpp_initialize(sys.argv)
        robot = moveit_commander.RobotCommander()
        scene = moveit_commander.PlanningSceneInterface()
        left_group = moveit_commander.MoveGroupCommander('left_arm')

        planning_frame = left_group.get_planning_frame()
        print "============ Reference frame: %s" % planning_frame

        eef_link = left_group.get_end_effector_link()
        print "============ End effector: %s" % eef_link

        group_names = robot.get_group_names()
        print "============ Robot Groups:", robot.get_group_names()

        print "============ Printing robot state"
        print robot.get_current_state()
        print ""


        print "============ Current values:"
        current_state = left_group.get_current_joint_values()
        print current_state


def main():
    print ("Creating Simple_Test")
    example = Simple_test()

if __name__ == '__main__':
    try:
        main()
    except rospy.ROSInterruptException:
       pass

It works fine until it reaches the "Printing robot state" part, where it shows 0.0 position for every joint (when that's not the real position of the joints) and then in the "current values" part it displays the error "Failed to fetch current robot state". As follows:

============ Printing robot state
[ WARN] [1535990091.503402457, 271.621000000]: Joint values for monitored state are requested but the full state is not known
joint_state:
  header:
    seq: 0
    stamp:
      secs: 0
      nsecs:         0
    frame_id: "/world"
  name: [head_pan, left_s0, left_s1, left_e0, left_e1, left_w0, left_w1, left_w2, l_gripper_l_finger_joint,
  l_gripper_r_finger_joint, right_s0, right_s1, right_e0, right_e1, right_w0, right_w1,
  right_w2, r_gripper_l_finger_joint, r_gripper_r_finger_joint]
  position: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
  velocity: []
  effort: []
multi_dof_joint_state:
  header:
    seq: 0
    stamp:
      secs: 0
      nsecs:         0
    frame_id: "/world"
  joint_names: []
  transforms: []
  twist: []
  wrench: []
attached_collision_objects: []
is_diff: False

============ Current values:
[ INFO] [1535990092.513833652, 272.248000000]: Didn't received robot state (joint angles) with recent timestamp within 1 seconds.
Check clock synchronization if your are running ROS across multiple machines!
[ERROR] [1535990092.513963976, 272.248000000]: Failed to fetch current robot state
[]

I have also tried doing the remapping via command line instead of doing it in the launch file as follows:

rostopic echo /robot ...
(more)
edit retag flag offensive close merge delete

Comments

Hello. I met the same error. Have you fixed it? Could you help me to figure out what is wrong?

zhanghanbo163 gravatar imagezhanghanbo163 ( 2019-03-20 03:37:12 -0500 )edit