Class: ROS::SlaveProxy
- Inherits:
-
Object
- Object
- ROS::SlaveProxy
- Defined in:
- lib/ros/slave_proxy.rb
Overview
you can access to ROS Slave nodes.
Instance Attribute Summary collapse
-
#caller_id ⇒ String
Caller_id of this caller.
-
#slave_uri ⇒ String
URI of target.
Instance Method Summary collapse
-
#get_bus_info ⇒ Array
Bus information.
-
#get_bus_stats ⇒ Array
Stats.
-
#get_master_uri ⇒ String
URI of master.
-
#get_pid ⇒ Integer
Pid of the slave process.
-
#get_publications ⇒ Array
Publications.
-
#get_subscriptions ⇒ Array
Topiccs.
-
#initialize(caller_id, slave_uri) ⇒ SlaveProxy
constructor
A new instance of SlaveProxy.
-
#param_update(param_key, param_value) ⇒ Boolean
True.
-
#publisher_update(topic, publishers) ⇒ Boolean
True.
- #request_topic(topic, protocols) ⇒ Object
- #shutdown(msg = '') ⇒ Object
Constructor Details
#initialize(caller_id, slave_uri) ⇒ SlaveProxy
Returns a new instance of SlaveProxy.
23 24 25 26 27 |
# File 'lib/ros/slave_proxy.rb', line 23 def initialize(caller_id, slave_uri) @caller_id = caller_id @slave_uri = slave_uri @proxy = XMLRPC::Client.new2(@slave_uri).proxy end |
Instance Attribute Details
#caller_id ⇒ String
Returns caller_id of this caller.
151 152 153 |
# File 'lib/ros/slave_proxy.rb', line 151 def caller_id @caller_id end |
#slave_uri ⇒ String
Returns URI of target.
148 149 150 |
# File 'lib/ros/slave_proxy.rb', line 148 def slave_uri @slave_uri end |
Instance Method Details
#get_bus_info ⇒ Array
Returns bus information.
42 43 44 45 46 47 48 49 |
# File 'lib/ros/slave_proxy.rb', line 42 def get_bus_info code, , info = @proxy.getBusInfo(@caller_id) if code == 1 return info else raise end end |
#get_bus_stats ⇒ Array
Returns stats.
31 32 33 34 35 36 37 38 |
# File 'lib/ros/slave_proxy.rb', line 31 def get_bus_stats code, , stats = @proxy.getBusStats(@caller_id) if code == 1 return stats else raise end end |
#get_master_uri ⇒ String
Returns URI of master.
53 54 55 56 57 58 59 60 |
# File 'lib/ros/slave_proxy.rb', line 53 def get_master_uri code, , uri = @proxy.getMasterUri(@caller_id) if code == 1 return uri else raise end end |
#get_pid ⇒ Integer
Returns pid of the slave process.
77 78 79 80 81 82 83 84 |
# File 'lib/ros/slave_proxy.rb', line 77 def get_pid code, , pid = @proxy.getPid(@caller_id) if code == 1 return pid else raise end end |
#get_publications ⇒ Array
Returns publications.
99 100 101 102 103 104 105 106 |
# File 'lib/ros/slave_proxy.rb', line 99 def get_publications code, , topic = @proxy.getPublications(@caller_id) if code == 1 return topic else raise end end |
#get_subscriptions ⇒ Array
Returns topiccs.
88 89 90 91 92 93 94 95 |
# File 'lib/ros/slave_proxy.rb', line 88 def get_subscriptions code, , topic = @proxy.getSubscriptions(@caller_id) if code == 1 return topic else raise end end |
#param_update(param_key, param_value) ⇒ Boolean
Returns true.
112 113 114 115 116 117 118 119 |
# File 'lib/ros/slave_proxy.rb', line 112 def param_update(param_key, param_value) code, , val = @proxy.paramUpdate(@caller_id, param_key, param_value) if code == 1 return true else raise end end |
#publisher_update(topic, publishers) ⇒ Boolean
Returns true.
125 126 127 128 129 130 131 132 |
# File 'lib/ros/slave_proxy.rb', line 125 def publisher_update(topic, publishers) code, , val = @proxy.publisherUpdate(@caller_id, topic, publishers) if code == 1 return true else raise end end |
#request_topic(topic, protocols) ⇒ Object
136 137 138 139 140 141 142 143 144 145 |
# File 'lib/ros/slave_proxy.rb', line 136 def request_topic(topic, protocols) code, , protocol = @proxy.requestTopic(@caller_id, topic, protocols) if code == 1 return protocol else raise end end |
#shutdown(msg = '') ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ros/slave_proxy.rb', line 64 def shutdown(msg='') code, , val = @proxy.shutdown(@caller_id, msg) if code == 1 return true elsif code == 0 return false else raise end end |