Class: ROS::ParameterManager
- Inherits:
-
Object
- Object
- ROS::ParameterManager
- Defined in:
- lib/ros/parameter_manager.rb
Overview
ROS parameter sever inteface. API document is here ros.org/wiki/ROS/Parameter%20Server%20API
Instance Method Summary collapse
-
#delete_param(key) ⇒ Boolean
delete parameter ‘key’.
-
#get_param(key) ⇒ String
get parameter named ‘key’.
-
#get_param_names ⇒ Array
get the all keys of parameters.
-
#has_param(key) ⇒ String, ...
check if the master has the key.
-
#initialize(master_uri, caller_id, remappings) ⇒ ParameterManager
constructor
A new instance of ParameterManager.
-
#search_param(key) ⇒ Array
search the all namespace for key.
-
#set_param(key, value) ⇒ Boolean
set parameter for ‘key’.
Constructor Details
#initialize(master_uri, caller_id, remappings) ⇒ ParameterManager
Returns a new instance of ParameterManager.
23 24 25 26 27 28 |
# File 'lib/ros/parameter_manager.rb', line 23 def initialize(master_uri, caller_id, remappings) @caller_id = caller_id @master_uri = master_uri @remappings = remappings @server = XMLRPC::Client.new2(@master_uri) end |
Instance Method Details
#delete_param(key) ⇒ Boolean
delete parameter ‘key’
69 70 71 72 73 74 75 76 77 |
# File 'lib/ros/parameter_manager.rb', line 69 def delete_param(key) code, , value = @server.call("deleteParam", @caller_id, key) case code when 1 return true else return false end end |
#get_param(key) ⇒ String
get parameter named ‘key’
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ros/parameter_manager.rb', line 34 def get_param(key) if @remappings[key] return @remappings[key] end code, , value = @server.call("getParam", @caller_id, key) case code when 1 return value else return nil end end |
#get_param_names ⇒ Array
get the all keys of parameters
115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/ros/parameter_manager.rb', line 115 def get_param_names code, , value = @server.call("getParamNames", @caller_id) case code when 1 return value when -1 raise else return false end end |
#has_param(key) ⇒ String, ...
check if the master has the key
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/ros/parameter_manager.rb', line 99 def has_param(key) code, , value = @server.call("hasParam", @caller_id, key) case code when 1 return value when -1 raise else return false end end |
#search_param(key) ⇒ Array
search the all namespace for key
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/ros/parameter_manager.rb', line 83 def search_param(key) code, , value = @server.call("searchParam", @caller_id, key) case code when 1 return value when -1 raise else return false end end |
#set_param(key, value) ⇒ Boolean
set parameter for ‘key’
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ros/parameter_manager.rb', line 53 def set_param(key, value) code, , value = @server.call("setParam", @caller_id, key, value) case code when 1 return true when -1 raise else return false end end |