ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Found Empty jointstate message

asked 2021-02-11 04:07:35 -0500

Logan_Zhang gravatar image

updated 2021-02-12 14:19:10 -0500

jayess gravatar image

Hi, I am currently working on iiwa lbr arm in ros and using compute_ik service to calculate the inverse kinematics and send the joint state message to /joint_state topic, which unity in windows is subscribe to this topic through rosbridge. I wrote the script to basically publish the joint state part of the IK solution to /joint_state. However, while it does give me a response with error_code 1 which I believe it means it is successful, it keeps giving me Found Empty jointstate message error, what exactly could be causing it? my setup is a robot arm mounted upside down and the values I am giving it to compute IK solution is: [0.2 0.3 0.1 0.0 30.0 0.0], and here is my code to get IK solution in python:

def IK_compute(data):
    global JointPub
    #Wait for theIK service to become available
    rospy.wait_for_service('compute_ik')
    #rospy.init_node('service_query')
    #Construct the request
    request = GetPositionIKRequest()
    request.ik_request.group_name = "kuka_iiwa"
    request.ik_request.attempts = 20
    request.ik_request.pose_stamped.header.frame_id = "base"

    #Set the desired orientation for the end effector HERE
    request.ik_request.pose_stamped.pose.position.x = data[0]
    request.ik_request.pose_stamped.pose.position.y = data[1]
    request.ik_request.pose_stamped.pose.position.z = data[2]

    q = quaternion_from_euler(np.deg2rad(data[3]), np.deg2rad(data[4]), np.deg2rad(data[5]))
    request.ik_request.pose_stamped.pose.orientation = Quaternion(*q)

    #Create the function used to call the service
    compute_ik = rospy.ServiceProxy('compute_ik', GetPositionIK)
    try:
        #Send the request to the service
        response = compute_ik(request)
        #response.solution.joint_state.velocity = [0, 0, 0, 0, 0, 0, 0]
        #response.solution.joint_state.effort = [0, 0, 0, 0, 0, 0, 0]
        print(response)
        JointPub.publish(response.solution.joint_state)
        '''
        if response.error_code == 1:
            print("success")
        elif response.error_code == -31:
            print("NO IK solution")
        '''
    except  rospy.ServiceException, e:
        print "Service callfailed: %s"%e

and my terminal loginfo are:

[INFO] [1613099932.751784]: solution:
  joint_state:
    header:
    seq: 0
    stamp:
        secs: 0
        nsecs:      0
    frame_id: "/world"
    name: [joint_a1, joint_a2, joint_a3, joint_a4, joint_a5, joint_a6, joint_a7]
    position: [-0.1507822277522531, 2.0425807428651455, 1.1103473810090956, -1.9972497454495166, 1.449649742196664, 1.9401822415585879, 1.2651551284903115]
    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
error_code:
  val: 1

for an example IK response and

[ERROR] [1613099932.525326494]: Found empty JointState message

For a sample error message from rviz Any help will be appreciated!

edit retag flag offensive close merge delete

Comments

I indented your code because it looked like it wasn't indented properly. Feel free to change it

jayess gravatar image jayess  ( 2021-02-11 21:13:43 -0500 )edit

Please add terminal output, since you're printing the response in your code (consider using rospy.loginfo instead, btw)

fvd gravatar image fvd  ( 2021-02-11 21:13:50 -0500 )edit

Hi thanks for the reply, I have updated the info you talked about in the post

Logan_Zhang gravatar image Logan_Zhang  ( 2021-02-11 21:26:00 -0500 )edit

Is there a reason you need to pass this message through the /joint_states topic? That's where the current state of the robots is expected to be published. Would your problem be solved if you just changed the topic name?

fvd gravatar image fvd  ( 2021-02-11 21:28:01 -0500 )edit

Hi I have changed the topic name as well and I also tried stop publishing as well but rviz is giving me the same message, it looks like it is not a publishing issue

Logan_Zhang gravatar image Logan_Zhang  ( 2021-02-11 21:33:26 -0500 )edit

Is anything else arriving on the /joint_states that is or could look like an empty message? Is anything publishing to it that is not a robot driver or simulation?

fvd gravatar image fvd  ( 2021-02-12 23:39:10 -0500 )edit

Yes by echoing it gives me teh same information as the loginfo

Logan_Zhang gravatar image Logan_Zhang  ( 2021-02-12 23:41:43 -0500 )edit

I can't dig further right now, but the error is displayed here. Make sure no empty message arrives on /joint_state (even though you don't publish the result at all?), and isolate when the error occurs (when you call the IK?). Please don't forget to post your findings.

fvd gravatar image fvd  ( 2021-02-12 23:57:08 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-02-13 00:38:48 -0500

fvd gravatar image

I think you are supplying the empty RobotState in your PositionIKRequest message, and the error is thrown when it is parsed. The error message is not very helpful, though, so I posted this issue about it.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-02-11 04:07:35 -0500

Seen: 1,127 times

Last updated: Feb 13 '21