expose node namespace in API and pass to rcl (#316)

* expose node namespace in API and pass to rcl

* name_space -> namespace_
This commit is contained in:
William Woodall 2017-04-08 02:04:41 -07:00 committed by GitHub
parent dbe674deb7
commit e6e1848b97
6 changed files with 38 additions and 10 deletions

View file

@ -68,22 +68,29 @@ public:
/// Create a new lifecycle node with the specified name.
/**
* \param[in] node_name Name of the node.
* \param[in] node_name Namespace of the node.
* \param[in] use_intra_process_comms True to use the optimized intra-process communication
* pipeline to pass messages between nodes in the same process using shared memory.
*/
RCLCPP_LIFECYCLE_PUBLIC
explicit LifecycleNode(const std::string & node_name, bool use_intra_process_comms = false);
explicit LifecycleNode(
const std::string & node_name,
const std::string & namespace_ = "",
bool use_intra_process_comms = false);
/// Create a node based on the node name and a rclcpp::context::Context.
/**
* \param[in] node_name Name of the node.
* \param[in] node_name Namespace of the node.
* \param[in] context The context for the node (usually represents the state of a process).
* \param[in] use_intra_process_comms True to use the optimized intra-process communication
* pipeline to pass messages between nodes in the same process using shared memory.
*/
RCLCPP_LIFECYCLE_PUBLIC
LifecycleNode(
const std::string & node_name, rclcpp::context::Context::SharedPtr context,
const std::string & node_name,
const std::string & namespace_,
rclcpp::context::Context::SharedPtr context,
bool use_intra_process_comms = false);
RCLCPP_LIFECYCLE_PUBLIC

View file

@ -38,18 +38,23 @@
namespace rclcpp_lifecycle
{
LifecycleNode::LifecycleNode(const std::string & node_name, bool use_intra_process_comms)
LifecycleNode::LifecycleNode(
const std::string & node_name,
const std::string & namespace_,
bool use_intra_process_comms)
: LifecycleNode(
node_name,
namespace_,
rclcpp::contexts::default_context::get_global_default_context(),
use_intra_process_comms)
{}
LifecycleNode::LifecycleNode(
const std::string & node_name,
const std::string & namespace_,
rclcpp::context::Context::SharedPtr context,
bool use_intra_process_comms)
: node_base_(new rclcpp::node_interfaces::NodeBase(node_name, context)),
: node_base_(new rclcpp::node_interfaces::NodeBase(node_name, namespace_, context)),
node_graph_(new rclcpp::node_interfaces::NodeGraph(node_base_.get())),
node_timers_(new rclcpp::node_interfaces::NodeTimers(node_base_.get())),
node_topics_(new rclcpp::node_interfaces::NodeTopics(node_base_.get())),