Go to the documentation of this file.
52 M_string::const_iterator it = remappings.find(
"__master");
53 if (it != remappings.end())
60 char *master_uri_env = NULL;
62 _dupenv_s(&master_uri_env, NULL,
"ROS_MASTER_URI");
64 master_uri_env = getenv(
"ROS_MASTER_URI");
69 g_uri = master_uri_env;
85 ROS_FATAL(
"Couldn't parse the master URI [%s] into a host:port pair.",
g_uri.c_str());
109 ROS_FATAL(
"retry timeout must not be negative.");
119 return execute(
"getPid", args, result, payload,
false);
128 if (!
execute(
"getPublishedTopics", args, result, payload,
true))
134 for (
int i = 0; i < payload.
size(); i++)
136 topics.push_back(
TopicInfo(std::string(payload[i][0]), std::string(payload[i][1])));
147 if (!
execute(
"getSystemState", args, result, payload,
true))
153 for (
int i = 0; i < payload.
size(); ++i)
155 for (
int j = 0; j < payload[i].
size(); ++j)
158 for (
int k = 0; k < val.
size(); ++k)
160 std::string name = payload[i][j][1][k];
161 node_set.insert(name);
166 nodes.insert(nodes.end(), node_set.begin(), node_set.end());
171 #if defined(__APPLE__)
172 boost::mutex g_xmlrpc_call_mutex;
179 std::string master_host =
getHost();
180 uint32_t master_port =
getPort();
182 bool printed =
false;
189 #if defined(__APPLE__)
190 boost::mutex::scoped_lock lock(g_xmlrpc_call_mutex);
200 if (!printed && wait_for_master)
202 ROS_ERROR(
"[%s] Failed to contact master at [%s:%d]. %s", method.c_str(), master_host.c_str(), master_port, wait_for_master ?
"Retrying..." :
"");
206 if (!wait_for_master)
239 ROS_INFO(
"Connected to master at [%s:%d]", master_host.c_str(), master_port);
const std::string response
ROSCPP_DECL bool check()
Check whether the master is up.
void init(const M_string &remappings)
ROSCPP_DECL uint32_t getPort()
Get the port where the master runs.
bool execute(const char *method, XmlRpcValue const ¶ms, XmlRpcValue &result)
ROSCPP_DECL bool getTopics(V_TopicInfo &topics)
Get the list of topics that are being published by all nodes.
ROSCPP_DECL bool ok()
Check whether it's time to exit.
std::vector< TopicInfo > V_TopicInfo
const ROSCPP_DECL std::string & getHost()
Get the hostname where the master runs.
static const XMLRPCManagerPtr & instance()
ROSCPP_DECL bool execute(const std::string &method, const XmlRpc::XmlRpcValue &request, XmlRpc::XmlRpcValue &response, XmlRpc::XmlRpcValue &payload, bool wait_for_master)
Execute an XMLRPC call on the master.
const ROSCPP_DECL std::string & getName()
Returns the name of the current node.
ROSCPP_DECL bool getNodes(V_string &nodes)
Retreives the currently-known list of nodes from the master.
ros::WallDuration g_retry_timeout
std::set< std::string > S_string
ROSCPP_DECL bool isShuttingDown()
Returns whether or not ros::shutdown() has been (or is being) called.
std::vector< std::string > V_string
const ROSCPP_DECL std::string & getDefaultMasterURI()
returns the default master uri that is used if no other is specified, e.g. by defining ROS_MASTER_URI...
Contains information retrieved from the master about a topic.
const ROSCPP_DECL std::string & getURI()
Get the full URI to the master (eg. http://host:port/)
ROSCPP_DECL bool splitURI(const std::string &uri, std::string &host, uint32_t &port)
ROSCPP_DECL void setRetryTimeout(ros::WallDuration timeout)
Set the max time this node should spend looping trying to connect to the master.
std::map< std::string, std::string > M_string
roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
, Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:35