Class: Orocos::ROS::ROS_XMLRPC
- Inherits:
-
Object
- Object
- Orocos::ROS::ROS_XMLRPC
- Defined in:
- lib/orocos/ros/rpc.rb
Overview
Common handling for the ROS master/slave API
Defined Under Namespace
Classes: CallFailed
Instance Attribute Summary collapse
-
#caller_id ⇒ Object
readonly
- String
-
the caller ID for this process.
-
#server ⇒ Object
readonly
- XMLRPC::Client
-
The remote server.
Instance Method Summary collapse
- #call(method_name, *args) ⇒ Object
-
#initialize(uri, caller_id) ⇒ ROS_XMLRPC
constructor
A new instance of ROS_XMLRPC.
Constructor Details
#initialize(uri, caller_id) ⇒ ROS_XMLRPC
Returns a new instance of ROS_XMLRPC
46 47 48 49 |
# File 'lib/orocos/ros/rpc.rb', line 46 def initialize(uri, caller_id) @server = XMLRPC::Client.new2(uri) @caller_id = caller_id end |
Instance Attribute Details
#caller_id ⇒ Object (readonly)
- String
-
the caller ID for this process
44 45 46 |
# File 'lib/orocos/ros/rpc.rb', line 44 def caller_id @caller_id end |
#server ⇒ Object (readonly)
- XMLRPC::Client
-
The remote server
42 43 44 |
# File 'lib/orocos/ros/rpc.rb', line 42 def server @server end |
Instance Method Details
#call(method_name, *args) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/orocos/ros/rpc.rb', line 51 def call(method_name, *args) code, status_msg, result = server.call(method_name, *args) if code == -1 raise ArgumentError, status_msg elsif code == 0 raise CallFailed, status_msg else result end rescue Errno::ECONNREFUSED, Errno::EPIPE, Errno::ECONNRESET => e raise ComError, e., e.backtrace end |