acowley / roshask

Haskell client library for the ROS robotics framework.
BSD 3-Clause "New" or "Revised" License
107 stars 18 forks source link

XML-RPC call [requestTopic] didn't return an array #14

Closed rgleichman closed 10 years ago

rgleichman commented 10 years ago

I am publishing to the /r_gripper_controller/gripper_action/goal from roshask. The /r_gripper_controller/gripper_action_node subscribes to that topic. The roshask node seems to be publishing the topic correctly (rostopic info /r_gripper_controller/gripper_action/goal prints out the correct messages), but the gripper_action_node does not produce the correct output (/r_gripper_controller/command messages). Using rxconsole I found that when the roshask node starts, the gripper_action_node emits the debug message

XML-RPC call [requestTopic] didn't return an array

after what I think is a normal message Began asynchronous xmlrpc connection to [rll3:47128] (rll3 is the machine name). The gripper_action_node is started with roslaunch pr2_gazebo pr2_empty_world.launch. I am running ROS Fuerte on Ubuntu 12.04. Here the source that logs the debug message (line 202). The equivalent Python program actuates the simulated gripper and does not produce the XML-RPC call ... debug message.

Full rxconsole paste, and roshask program below: rxconsole paste:

header: 
  seq: 394386
  stamp: 3827.744000000
  frame_id: 
level: 1
name: /r_gripper_controller/gripper_action_node
msg: Began asynchronous xmlrpc connection to [rll3:47128]
file: /tmp/buildd/ros-fuerte-ros-comm-1.8.16-1precise-20130502-1635/clients/cpp/roscpp/src/libros/subscription.cpp
function: Subscription::negotiateConnection
line: 419
topics[]
  topics[0]: /rosout
  topics[1]: /r_gripper_controller/gripper_action/result
  topics[2]: /r_gripper_controller/gripper_action/feedback
  topics[3]: /r_gripper_controller/gripper_action/status
  topics[4]: /r_gripper_controller/command

header: 
  seq: 394440
  stamp: 3828.418000000
  frame_id: 
level: 1
name: /r_gripper_controller/gripper_action_node
msg: XML-RPC call [requestTopic] didn't return an array
file: /tmp/buildd/ros-fuerte-ros-comm-1.8.16-1precise-20130502-1635/clients/cpp/roscpp/src/libros/xmlrpc_manager.cpp
function: XMLRPCManager::validateXmlrpcResponse
line: 203
topics[]
  topics[0]: /rosout
  topics[1]: /r_gripper_controller/gripper_action/result
  topics[2]: /r_gripper_controller/gripper_action/feedback
  topics[3]: /r_gripper_controller/gripper_action/status
  topics[4]: /r_gripper_controller/command

My roshask program

module GripperTalker (main) where

import Ros.Node (Topic)
import Ros.Node (topicRate)
import Ros.Node (runNode)
import Ros.Node (advertise)
import Ros.Topic (repeatM)
import Ros.Pr2_controllers_msgs.Pr2GripperCommandGoal
import Ros.Pr2_controllers_msgs.Pr2GripperCommandActionGoal
import Ros.Pr2_controllers_msgs.Pr2GripperCommand
import qualified Ros.Std_msgs.Header as H
import qualified Ros.Actionlib_msgs.GoalID as GID

open :: Double
open = 0.09

closed :: Double
closed = 0.0

moveGripper :: Topic IO Pr2GripperCommandActionGoal
moveGripper = repeatM msg
  where msg = return $ Pr2GripperCommandActionGoal{
          header= H.Header {H.seq= 0,
                            H.stamp = (0,0),
                            H.frame_id= ""},
          goal_id= GID.GoalID {
            GID.stamp = (0,0),
            GID.id = ""
                          },
          goal=Pr2GripperCommandGoal{
             command = Pr2GripperCommand{
                position = 0.09, max_effort = (-1)
                                        }
             }
          }

main :: IO ()
main = runNode "GripperTakler" $ advertise topicName (topicRate 1 moveGripper)
  where topicName = "/r_gripper_controller/gripper_action/goal"
acowley commented 10 years ago

This is an outstanding bug report. I can't run ROS at the moment, but I'm guessing the problem is with Ros.SlaveAPI.requestTopic (line 133). It should be returning a list of triples rather than just the one.

(As an aside, it's curious that this hasn't caused a problem before, it would be good to know what made a difference. I don't have any guesses at the moment.)

rgleichman commented 10 years ago

It seems that rospy works with the roshask program, so as a workaround I made a Python node that just forwards the message.

acowley commented 10 years ago

I guess that explains it! So it's a roscpp compatibility bug in roshask. Hopefully the fix is as simple as it seems.

acowley commented 10 years ago

Progress! Maybe! I'm not sure if this is the same issue you encountered, but I've been able to reproduce one major issue with roscpp vs. haxr (the Haskell XML-RPC library used by roshask): roscpp will emit XML-RPC fragments like <value>TCPROS</value> when haxr expects <value><string>TCPROC</string></value>. This is okay according to the spec, so haxr needs to be patched.

Stay tuned.

acowley commented 10 years ago

I submitted a PR to haxr. You can try installing my fork until the new version makes its way to hackage. https://github.com/acowley/haxr

Simple tests of roshask <-> roscpp are working for me now.

I knew I liked rospy for a reason!

acowley commented 10 years ago

The latest haxr is now on hackage.

acowley commented 10 years ago

This should be fixed, but I didn't reproduce the exact error message you did so confirmation would be good.

rgleichman commented 10 years ago

It works now. Thank you.