Remove namespaces and namespace escalation e.g. node::
(#416)
* Remove publisher:: namespace * Remove subscription:: namespace * Remove client:: namespace * Remove service:: namespace * Remove parameter_client:: namespace * Remove parameter_service:: namespace * Remove rate:: namespace * Remove timer:: namespace * Remove node:: namespace * Remove any_service_callback:: namespace * Remove any_subscription_callback:: namespace * Remove event:: namespace * Remove ContextSharedPtr escalation Users can use the directive themselves if they want * Remove single_threaded_executor:: namespace * Remove multi_threaded_executor:: namespace * Remove context:: namespace * node:: removal from new logger additions * Fix linter issues that has been triggered with uncrustify * Remove utilities:: namespace
This commit is contained in:
parent
713ee8059c
commit
6129a12df5
83 changed files with 398 additions and 503 deletions
|
@ -42,11 +42,11 @@ struct AnyExecutable
|
||||||
virtual ~AnyExecutable();
|
virtual ~AnyExecutable();
|
||||||
|
|
||||||
// Only one of the following pointers will be set.
|
// Only one of the following pointers will be set.
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription;
|
rclcpp::SubscriptionBase::SharedPtr subscription;
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription_intra_process;
|
rclcpp::SubscriptionBase::SharedPtr subscription_intra_process;
|
||||||
rclcpp::timer::TimerBase::SharedPtr timer;
|
rclcpp::TimerBase::SharedPtr timer;
|
||||||
rclcpp::service::ServiceBase::SharedPtr service;
|
rclcpp::ServiceBase::SharedPtr service;
|
||||||
rclcpp::client::ClientBase::SharedPtr client;
|
rclcpp::ClientBase::SharedPtr client;
|
||||||
// These are used to keep the scope on the containing items
|
// These are used to keep the scope on the containing items
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group;
|
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group;
|
||||||
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base;
|
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base;
|
||||||
|
|
|
@ -27,9 +27,6 @@
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace any_service_callback
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename ServiceT>
|
template<typename ServiceT>
|
||||||
class AnyServiceCallback
|
class AnyServiceCallback
|
||||||
{
|
{
|
||||||
|
@ -100,7 +97,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace any_service_callback
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__ANY_SERVICE_CALLBACK_HPP_
|
#endif // RCLCPP__ANY_SERVICE_CALLBACK_HPP_
|
||||||
|
|
|
@ -30,9 +30,6 @@
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace any_subscription_callback
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename MessageT, typename Alloc>
|
template<typename MessageT, typename Alloc>
|
||||||
class AnySubscriptionCallback
|
class AnySubscriptionCallback
|
||||||
{
|
{
|
||||||
|
@ -209,7 +206,6 @@ private:
|
||||||
MessageDeleter message_deleter_;
|
MessageDeleter message_deleter_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace any_subscription_callback
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__ANY_SUBSCRIPTION_CALLBACK_HPP_
|
#endif // RCLCPP__ANY_SUBSCRIPTION_CALLBACK_HPP_
|
||||||
|
|
|
@ -59,19 +59,19 @@ public:
|
||||||
explicit CallbackGroup(CallbackGroupType group_type);
|
explicit CallbackGroup(CallbackGroupType group_type);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
const std::vector<rclcpp::subscription::SubscriptionBase::WeakPtr> &
|
const std::vector<rclcpp::SubscriptionBase::WeakPtr> &
|
||||||
get_subscription_ptrs() const;
|
get_subscription_ptrs() const;
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
const std::vector<rclcpp::timer::TimerBase::WeakPtr> &
|
const std::vector<rclcpp::TimerBase::WeakPtr> &
|
||||||
get_timer_ptrs() const;
|
get_timer_ptrs() const;
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
const std::vector<rclcpp::service::ServiceBase::WeakPtr> &
|
const std::vector<rclcpp::ServiceBase::WeakPtr> &
|
||||||
get_service_ptrs() const;
|
get_service_ptrs() const;
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
const std::vector<rclcpp::client::ClientBase::WeakPtr> &
|
const std::vector<rclcpp::ClientBase::WeakPtr> &
|
||||||
get_client_ptrs() const;
|
get_client_ptrs() const;
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
|
@ -87,27 +87,27 @@ protected:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
add_subscription(const rclcpp::subscription::SubscriptionBase::SharedPtr subscription_ptr);
|
add_subscription(const rclcpp::SubscriptionBase::SharedPtr subscription_ptr);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
add_timer(const rclcpp::timer::TimerBase::SharedPtr timer_ptr);
|
add_timer(const rclcpp::TimerBase::SharedPtr timer_ptr);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
add_service(const rclcpp::service::ServiceBase::SharedPtr service_ptr);
|
add_service(const rclcpp::ServiceBase::SharedPtr service_ptr);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
add_client(const rclcpp::client::ClientBase::SharedPtr client_ptr);
|
add_client(const rclcpp::ClientBase::SharedPtr client_ptr);
|
||||||
|
|
||||||
CallbackGroupType type_;
|
CallbackGroupType type_;
|
||||||
// Mutex to protect the subsequent vectors of pointers.
|
// Mutex to protect the subsequent vectors of pointers.
|
||||||
mutable std::mutex mutex_;
|
mutable std::mutex mutex_;
|
||||||
std::vector<rclcpp::subscription::SubscriptionBase::WeakPtr> subscription_ptrs_;
|
std::vector<rclcpp::SubscriptionBase::WeakPtr> subscription_ptrs_;
|
||||||
std::vector<rclcpp::timer::TimerBase::WeakPtr> timer_ptrs_;
|
std::vector<rclcpp::TimerBase::WeakPtr> timer_ptrs_;
|
||||||
std::vector<rclcpp::service::ServiceBase::WeakPtr> service_ptrs_;
|
std::vector<rclcpp::ServiceBase::WeakPtr> service_ptrs_;
|
||||||
std::vector<rclcpp::client::ClientBase::WeakPtr> client_ptrs_;
|
std::vector<rclcpp::ClientBase::WeakPtr> client_ptrs_;
|
||||||
std::atomic_bool can_be_taken_from_;
|
std::atomic_bool can_be_taken_from_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,6 @@ namespace node_interfaces
|
||||||
class NodeBaseInterface;
|
class NodeBaseInterface;
|
||||||
} // namespace node_interfaces
|
} // namespace node_interfaces
|
||||||
|
|
||||||
namespace client
|
|
||||||
{
|
|
||||||
|
|
||||||
class ClientBase
|
class ClientBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -282,7 +279,6 @@ private:
|
||||||
std::mutex pending_requests_mutex_;
|
std::mutex pending_requests_mutex_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace client
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__CLIENT_HPP_
|
#endif // RCLCPP__CLIENT_HPP_
|
||||||
|
|
|
@ -30,9 +30,6 @@
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace context
|
|
||||||
{
|
|
||||||
|
|
||||||
class Context
|
class Context
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -72,7 +69,6 @@ private:
|
||||||
std::mutex mutex_;
|
std::mutex mutex_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace context
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__CONTEXT_HPP_
|
#endif // RCLCPP__CONTEXT_HPP_
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace contexts
|
||||||
namespace default_context
|
namespace default_context
|
||||||
{
|
{
|
||||||
|
|
||||||
class DefaultContext : public rclcpp::context::Context
|
class DefaultContext : public rclcpp::Context
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RCLCPP_SMART_PTR_DEFINITIONS(DefaultContext)
|
RCLCPP_SMART_PTR_DEFINITIONS(DefaultContext)
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace rclcpp
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename MessageT, typename CallbackT, typename AllocatorT, typename SubscriptionT>
|
template<typename MessageT, typename CallbackT, typename AllocatorT, typename SubscriptionT>
|
||||||
typename rclcpp::subscription::Subscription<MessageT, AllocatorT>::SharedPtr
|
typename rclcpp::Subscription<MessageT, AllocatorT>::SharedPtr
|
||||||
create_subscription(
|
create_subscription(
|
||||||
rclcpp::node_interfaces::NodeTopicsInterface * node_topics,
|
rclcpp::node_interfaces::NodeTopicsInterface * node_topics,
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace event
|
|
||||||
{
|
|
||||||
|
|
||||||
class Event
|
class Event
|
||||||
{
|
{
|
||||||
|
@ -52,7 +50,6 @@ private:
|
||||||
std::atomic_bool state_;
|
std::atomic_bool state_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace event
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__EVENT_HPP_
|
#endif // RCLCPP__EVENT_HPP_
|
||||||
|
|
|
@ -38,10 +38,7 @@ namespace rclcpp
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration is used in convenience method signature.
|
// Forward declaration is used in convenience method signature.
|
||||||
namespace node
|
|
||||||
{
|
|
||||||
class Node;
|
class Node;
|
||||||
} // namespace node
|
|
||||||
|
|
||||||
namespace executor
|
namespace executor
|
||||||
{
|
{
|
||||||
|
@ -124,7 +121,7 @@ public:
|
||||||
/// Convenience function which takes Node and forwards NodeBaseInterface.
|
/// Convenience function which takes Node and forwards NodeBaseInterface.
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual void
|
virtual void
|
||||||
add_node(std::shared_ptr<rclcpp::node::Node> node_ptr, bool notify = true);
|
add_node(std::shared_ptr<rclcpp::Node> node_ptr, bool notify = true);
|
||||||
|
|
||||||
/// Remove a node from the executor.
|
/// Remove a node from the executor.
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +137,7 @@ public:
|
||||||
/// Convenience function which takes Node and forwards NodeBaseInterface.
|
/// Convenience function which takes Node and forwards NodeBaseInterface.
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual void
|
virtual void
|
||||||
remove_node(std::shared_ptr<rclcpp::node::Node> node_ptr, bool notify = true);
|
remove_node(std::shared_ptr<rclcpp::Node> node_ptr, bool notify = true);
|
||||||
|
|
||||||
/// Add a node to executor, execute the next available unit of work, and remove the node.
|
/// Add a node to executor, execute the next available unit of work, and remove the node.
|
||||||
/**
|
/**
|
||||||
|
@ -162,7 +159,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience function which takes Node and forwards NodeBaseInterface.
|
/// Convenience function which takes Node and forwards NodeBaseInterface.
|
||||||
template<typename NodeT = rclcpp::node::Node, typename T = std::milli>
|
template<typename NodeT = rclcpp::Node, typename T = std::milli>
|
||||||
void
|
void
|
||||||
spin_node_once(
|
spin_node_once(
|
||||||
std::shared_ptr<NodeT> node,
|
std::shared_ptr<NodeT> node,
|
||||||
|
@ -185,7 +182,7 @@ public:
|
||||||
/// Convenience function which takes Node and forwards NodeBaseInterface.
|
/// Convenience function which takes Node and forwards NodeBaseInterface.
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
spin_node_some(std::shared_ptr<rclcpp::node::Node> node);
|
spin_node_some(std::shared_ptr<rclcpp::Node> node);
|
||||||
|
|
||||||
/// Complete all available queued work without blocking.
|
/// Complete all available queued work without blocking.
|
||||||
/**
|
/**
|
||||||
|
@ -236,7 +233,7 @@ public:
|
||||||
}
|
}
|
||||||
std::chrono::nanoseconds timeout_left = timeout_ns;
|
std::chrono::nanoseconds timeout_left = timeout_ns;
|
||||||
|
|
||||||
while (rclcpp::utilities::ok()) {
|
while (rclcpp::ok()) {
|
||||||
// Do one item of work.
|
// Do one item of work.
|
||||||
spin_once(timeout_left);
|
spin_once(timeout_left);
|
||||||
// Check if the future is set, return SUCCESS if it is.
|
// Check if the future is set, return SUCCESS if it is.
|
||||||
|
@ -295,24 +292,24 @@ protected:
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
static void
|
static void
|
||||||
execute_subscription(
|
execute_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription);
|
rclcpp::SubscriptionBase::SharedPtr subscription);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
static void
|
static void
|
||||||
execute_intra_process_subscription(
|
execute_intra_process_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription);
|
rclcpp::SubscriptionBase::SharedPtr subscription);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
static void
|
static void
|
||||||
execute_timer(rclcpp::timer::TimerBase::SharedPtr timer);
|
execute_timer(rclcpp::TimerBase::SharedPtr timer);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
static void
|
static void
|
||||||
execute_service(rclcpp::service::ServiceBase::SharedPtr service);
|
execute_service(rclcpp::ServiceBase::SharedPtr service);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
static void
|
static void
|
||||||
execute_client(rclcpp::client::ClientBase::SharedPtr client);
|
execute_client(rclcpp::ClientBase::SharedPtr client);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
|
@ -324,7 +321,7 @@ protected:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr
|
rclcpp::callback_group::CallbackGroup::SharedPtr
|
||||||
get_group_by_timer(rclcpp::timer::TimerBase::SharedPtr timer);
|
get_group_by_timer(rclcpp::TimerBase::SharedPtr timer);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
|
|
|
@ -35,7 +35,7 @@ spin_some(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
spin_some(rclcpp::node::Node::SharedPtr node_ptr);
|
spin_some(rclcpp::Node::SharedPtr node_ptr);
|
||||||
|
|
||||||
/// Create a default single-threaded executor and spin the specified node.
|
/// Create a default single-threaded executor and spin the specified node.
|
||||||
/** \param[in] node_ptr Shared pointer to the node to spin. */
|
/** \param[in] node_ptr Shared pointer to the node to spin. */
|
||||||
|
@ -45,13 +45,13 @@ spin(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
spin(rclcpp::node::Node::SharedPtr node_ptr);
|
spin(rclcpp::Node::SharedPtr node_ptr);
|
||||||
|
|
||||||
namespace executors
|
namespace executors
|
||||||
{
|
{
|
||||||
|
|
||||||
using rclcpp::executors::multi_threaded_executor::MultiThreadedExecutor;
|
using rclcpp::executors::MultiThreadedExecutor;
|
||||||
using rclcpp::executors::single_threaded_executor::SingleThreadedExecutor;
|
using rclcpp::executors::SingleThreadedExecutor;
|
||||||
|
|
||||||
/// Spin (blocking) until the future is complete, it times out waiting, or rclcpp is interrupted.
|
/// Spin (blocking) until the future is complete, it times out waiting, or rclcpp is interrupted.
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +81,7 @@ spin_node_until_future_complete(
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename NodeT = rclcpp::node::Node, typename ResponseT, typename TimeT = std::milli>
|
template<typename NodeT = rclcpp::Node, typename ResponseT, typename TimeT = std::milli>
|
||||||
rclcpp::executor::FutureReturnCode
|
rclcpp::executor::FutureReturnCode
|
||||||
spin_node_until_future_complete(
|
spin_node_until_future_complete(
|
||||||
rclcpp::executor::Executor & executor,
|
rclcpp::executor::Executor & executor,
|
||||||
|
@ -109,7 +109,7 @@ spin_until_future_complete(
|
||||||
return executors::spin_node_until_future_complete<FutureT>(executor, node_ptr, future, timeout);
|
return executors::spin_node_until_future_complete<FutureT>(executor, node_ptr, future, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename NodeT = rclcpp::node::Node, typename FutureT, typename TimeT = std::milli>
|
template<typename NodeT = rclcpp::Node, typename FutureT, typename TimeT = std::milli>
|
||||||
rclcpp::executor::FutureReturnCode
|
rclcpp::executor::FutureReturnCode
|
||||||
spin_until_future_complete(
|
spin_until_future_complete(
|
||||||
std::shared_ptr<NodeT> node_ptr,
|
std::shared_ptr<NodeT> node_ptr,
|
||||||
|
|
|
@ -28,8 +28,6 @@ namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace executors
|
namespace executors
|
||||||
{
|
{
|
||||||
namespace multi_threaded_executor
|
|
||||||
{
|
|
||||||
|
|
||||||
class MultiThreadedExecutor : public executor::Executor
|
class MultiThreadedExecutor : public executor::Executor
|
||||||
{
|
{
|
||||||
|
@ -63,7 +61,6 @@ private:
|
||||||
size_t number_of_threads_;
|
size_t number_of_threads_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace multi_threaded_executor
|
|
||||||
} // namespace executors
|
} // namespace executors
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@ namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace executors
|
namespace executors
|
||||||
{
|
{
|
||||||
namespace single_threaded_executor
|
|
||||||
{
|
|
||||||
|
|
||||||
/// Single-threaded executor implementation
|
/// Single-threaded executor implementation
|
||||||
// This is the default executor created by rclcpp::spin.
|
// This is the default executor created by rclcpp::spin.
|
||||||
|
@ -64,7 +62,6 @@ private:
|
||||||
RCLCPP_DISABLE_COPY(SingleThreadedExecutor)
|
RCLCPP_DISABLE_COPY(SingleThreadedExecutor)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace single_threaded_executor
|
|
||||||
} // namespace executors
|
} // namespace executors
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ public:
|
||||||
*/
|
*/
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
uint64_t
|
uint64_t
|
||||||
add_subscription(subscription::SubscriptionBase::SharedPtr subscription);
|
add_subscription(SubscriptionBase::SharedPtr subscription);
|
||||||
|
|
||||||
/// Unregister a subscription using the subscription's unique id.
|
/// Unregister a subscription using the subscription's unique id.
|
||||||
/**
|
/**
|
||||||
|
@ -187,14 +187,14 @@ public:
|
||||||
template<typename MessageT, typename Alloc>
|
template<typename MessageT, typename Alloc>
|
||||||
uint64_t
|
uint64_t
|
||||||
add_publisher(
|
add_publisher(
|
||||||
typename publisher::Publisher<MessageT, Alloc>::SharedPtr publisher,
|
typename Publisher<MessageT, Alloc>::SharedPtr publisher,
|
||||||
size_t buffer_size = 0)
|
size_t buffer_size = 0)
|
||||||
{
|
{
|
||||||
auto id = IntraProcessManager::get_next_unique_id();
|
auto id = IntraProcessManager::get_next_unique_id();
|
||||||
size_t size = buffer_size > 0 ? buffer_size : publisher->get_queue_size();
|
size_t size = buffer_size > 0 ? buffer_size : publisher->get_queue_size();
|
||||||
auto mrb = mapped_ring_buffer::MappedRingBuffer<
|
auto mrb = mapped_ring_buffer::MappedRingBuffer<
|
||||||
MessageT,
|
MessageT,
|
||||||
typename publisher::Publisher<MessageT, Alloc>::MessageAlloc
|
typename Publisher<MessageT, Alloc>::MessageAlloc
|
||||||
>::make_shared(size, publisher->get_allocator());
|
>::make_shared(size, publisher->get_allocator());
|
||||||
impl_->add_publisher(id, publisher, mrb, size);
|
impl_->add_publisher(id, publisher, mrb, size);
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -48,14 +48,14 @@ public:
|
||||||
~IntraProcessManagerImplBase() = default;
|
~IntraProcessManagerImplBase() = default;
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
add_subscription(uint64_t id, subscription::SubscriptionBase::SharedPtr subscription) = 0;
|
add_subscription(uint64_t id, SubscriptionBase::SharedPtr subscription) = 0;
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
remove_subscription(uint64_t intra_process_subscription_id) = 0;
|
remove_subscription(uint64_t intra_process_subscription_id) = 0;
|
||||||
|
|
||||||
virtual void add_publisher(
|
virtual void add_publisher(
|
||||||
uint64_t id,
|
uint64_t id,
|
||||||
publisher::PublisherBase::WeakPtr publisher,
|
PublisherBase::WeakPtr publisher,
|
||||||
mapped_ring_buffer::MappedRingBufferBase::SharedPtr mrb,
|
mapped_ring_buffer::MappedRingBufferBase::SharedPtr mrb,
|
||||||
size_t size) = 0;
|
size_t size) = 0;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
~IntraProcessManagerImpl() = default;
|
~IntraProcessManagerImpl() = default;
|
||||||
|
|
||||||
void
|
void
|
||||||
add_subscription(uint64_t id, subscription::SubscriptionBase::SharedPtr subscription)
|
add_subscription(uint64_t id, SubscriptionBase::SharedPtr subscription)
|
||||||
{
|
{
|
||||||
subscriptions_[id] = subscription;
|
subscriptions_[id] = subscription;
|
||||||
// subscription->get_topic_name() -> const char * can be used as the key,
|
// subscription->get_topic_name() -> const char * can be used as the key,
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
|
|
||||||
void add_publisher(
|
void add_publisher(
|
||||||
uint64_t id,
|
uint64_t id,
|
||||||
publisher::PublisherBase::WeakPtr publisher,
|
PublisherBase::WeakPtr publisher,
|
||||||
mapped_ring_buffer::MappedRingBufferBase::SharedPtr mrb,
|
mapped_ring_buffer::MappedRingBufferBase::SharedPtr mrb,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
|
@ -258,9 +258,9 @@ private:
|
||||||
|
|
||||||
using AllocSet = std::set<uint64_t, std::less<uint64_t>, RebindAlloc<uint64_t>>;
|
using AllocSet = std::set<uint64_t, std::less<uint64_t>, RebindAlloc<uint64_t>>;
|
||||||
using SubscriptionMap = std::unordered_map<
|
using SubscriptionMap = std::unordered_map<
|
||||||
uint64_t, subscription::SubscriptionBase::WeakPtr,
|
uint64_t, SubscriptionBase::WeakPtr,
|
||||||
std::hash<uint64_t>, std::equal_to<uint64_t>,
|
std::hash<uint64_t>, std::equal_to<uint64_t>,
|
||||||
RebindAlloc<std::pair<const uint64_t, subscription::SubscriptionBase::WeakPtr>>>;
|
RebindAlloc<std::pair<const uint64_t, SubscriptionBase::WeakPtr>>>;
|
||||||
|
|
||||||
struct strcmp_wrapper : public std::binary_function<const char *, const char *, bool>
|
struct strcmp_wrapper : public std::binary_function<const char *, const char *, bool>
|
||||||
{
|
{
|
||||||
|
@ -286,7 +286,7 @@ private:
|
||||||
|
|
||||||
PublisherInfo() = default;
|
PublisherInfo() = default;
|
||||||
|
|
||||||
publisher::PublisherBase::WeakPtr publisher;
|
PublisherBase::WeakPtr publisher;
|
||||||
std::atomic<uint64_t> sequence_number;
|
std::atomic<uint64_t> sequence_number;
|
||||||
mapped_ring_buffer::MappedRingBufferBase::SharedPtr buffer;
|
mapped_ring_buffer::MappedRingBufferBase::SharedPtr buffer;
|
||||||
|
|
||||||
|
|
|
@ -81,15 +81,15 @@ public:
|
||||||
virtual rcl_allocator_t
|
virtual rcl_allocator_t
|
||||||
get_allocator() = 0;
|
get_allocator() = 0;
|
||||||
|
|
||||||
static rclcpp::subscription::SubscriptionBase::SharedPtr
|
static rclcpp::SubscriptionBase::SharedPtr
|
||||||
get_subscription_by_handle(
|
get_subscription_by_handle(
|
||||||
const rcl_subscription_t * subscriber_handle,
|
const rcl_subscription_t * subscriber_handle,
|
||||||
const WeakNodeVector & weak_nodes);
|
const WeakNodeVector & weak_nodes);
|
||||||
|
|
||||||
static rclcpp::service::ServiceBase::SharedPtr
|
static rclcpp::ServiceBase::SharedPtr
|
||||||
get_service_by_handle(const rcl_service_t * service_handle, const WeakNodeVector & weak_nodes);
|
get_service_by_handle(const rcl_service_t * service_handle, const WeakNodeVector & weak_nodes);
|
||||||
|
|
||||||
static rclcpp::client::ClientBase::SharedPtr
|
static rclcpp::ClientBase::SharedPtr
|
||||||
get_client_by_handle(const rcl_client_t * client_handle, const WeakNodeVector & weak_nodes);
|
get_client_by_handle(const rcl_client_t * client_handle, const WeakNodeVector & weak_nodes);
|
||||||
|
|
||||||
static rclcpp::node_interfaces::NodeBaseInterface::SharedPtr
|
static rclcpp::node_interfaces::NodeBaseInterface::SharedPtr
|
||||||
|
@ -99,17 +99,17 @@ public:
|
||||||
|
|
||||||
static rclcpp::callback_group::CallbackGroup::SharedPtr
|
static rclcpp::callback_group::CallbackGroup::SharedPtr
|
||||||
get_group_by_subscription(
|
get_group_by_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription,
|
rclcpp::SubscriptionBase::SharedPtr subscription,
|
||||||
const WeakNodeVector & weak_nodes);
|
const WeakNodeVector & weak_nodes);
|
||||||
|
|
||||||
static rclcpp::callback_group::CallbackGroup::SharedPtr
|
static rclcpp::callback_group::CallbackGroup::SharedPtr
|
||||||
get_group_by_service(
|
get_group_by_service(
|
||||||
rclcpp::service::ServiceBase::SharedPtr service,
|
rclcpp::ServiceBase::SharedPtr service,
|
||||||
const WeakNodeVector & weak_nodes);
|
const WeakNodeVector & weak_nodes);
|
||||||
|
|
||||||
static rclcpp::callback_group::CallbackGroup::SharedPtr
|
static rclcpp::callback_group::CallbackGroup::SharedPtr
|
||||||
get_group_by_client(
|
get_group_by_client(
|
||||||
rclcpp::client::ClientBase::SharedPtr client,
|
rclcpp::ClientBase::SharedPtr client,
|
||||||
const WeakNodeVector & weak_nodes);
|
const WeakNodeVector & weak_nodes);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,6 @@
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace node
|
|
||||||
{
|
|
||||||
|
|
||||||
/// Node is the single point of entry for creating publishers and subscribers.
|
/// Node is the single point of entry for creating publishers and subscribers.
|
||||||
class Node : public std::enable_shared_from_this<Node>
|
class Node : public std::enable_shared_from_this<Node>
|
||||||
{
|
{
|
||||||
|
@ -82,7 +79,7 @@ public:
|
||||||
const std::string & namespace_ = "",
|
const std::string & namespace_ = "",
|
||||||
bool use_intra_process_comms = false);
|
bool use_intra_process_comms = false);
|
||||||
|
|
||||||
/// Create a node based on the node name and a rclcpp::context::Context.
|
/// Create a node based on the node name and a rclcpp::Context.
|
||||||
/**
|
/**
|
||||||
* \param[in] node_name Name of the node.
|
* \param[in] node_name Name of the node.
|
||||||
* \param[in] namespace_ Namespace of the node.
|
* \param[in] namespace_ Namespace of the node.
|
||||||
|
@ -94,7 +91,7 @@ public:
|
||||||
Node(
|
Node(
|
||||||
const std::string & node_name,
|
const std::string & node_name,
|
||||||
const std::string & namespace_,
|
const std::string & namespace_,
|
||||||
rclcpp::context::Context::SharedPtr context,
|
rclcpp::Context::SharedPtr context,
|
||||||
bool use_intra_process_comms = false);
|
bool use_intra_process_comms = false);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
|
@ -137,7 +134,7 @@ public:
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename MessageT, typename Alloc = std::allocator<void>,
|
typename MessageT, typename Alloc = std::allocator<void>,
|
||||||
typename PublisherT = ::rclcpp::publisher::Publisher<MessageT, Alloc>>
|
typename PublisherT = ::rclcpp::Publisher<MessageT, Alloc>>
|
||||||
std::shared_ptr<PublisherT>
|
std::shared_ptr<PublisherT>
|
||||||
create_publisher(
|
create_publisher(
|
||||||
const std::string & topic_name, size_t qos_history_depth,
|
const std::string & topic_name, size_t qos_history_depth,
|
||||||
|
@ -152,7 +149,7 @@ public:
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename MessageT, typename Alloc = std::allocator<void>,
|
typename MessageT, typename Alloc = std::allocator<void>,
|
||||||
typename PublisherT = ::rclcpp::publisher::Publisher<MessageT, Alloc>>
|
typename PublisherT = ::rclcpp::Publisher<MessageT, Alloc>>
|
||||||
std::shared_ptr<PublisherT>
|
std::shared_ptr<PublisherT>
|
||||||
create_publisher(
|
create_publisher(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
|
@ -178,7 +175,7 @@ public:
|
||||||
typename MessageT,
|
typename MessageT,
|
||||||
typename CallbackT,
|
typename CallbackT,
|
||||||
typename Alloc = std::allocator<void>,
|
typename Alloc = std::allocator<void>,
|
||||||
typename SubscriptionT = rclcpp::subscription::Subscription<MessageT, Alloc>>
|
typename SubscriptionT = rclcpp::Subscription<MessageT, Alloc>>
|
||||||
std::shared_ptr<SubscriptionT>
|
std::shared_ptr<SubscriptionT>
|
||||||
create_subscription(
|
create_subscription(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
|
@ -209,7 +206,7 @@ public:
|
||||||
typename MessageT,
|
typename MessageT,
|
||||||
typename CallbackT,
|
typename CallbackT,
|
||||||
typename Alloc = std::allocator<void>,
|
typename Alloc = std::allocator<void>,
|
||||||
typename SubscriptionT = rclcpp::subscription::Subscription<MessageT, Alloc>>
|
typename SubscriptionT = rclcpp::Subscription<MessageT, Alloc>>
|
||||||
std::shared_ptr<SubscriptionT>
|
std::shared_ptr<SubscriptionT>
|
||||||
create_subscription(
|
create_subscription(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
|
@ -228,7 +225,7 @@ public:
|
||||||
* \param[in] group Callback group to execute this timer's callback in.
|
* \param[in] group Callback group to execute this timer's callback in.
|
||||||
*/
|
*/
|
||||||
template<typename DurationT = std::milli, typename CallbackT>
|
template<typename DurationT = std::milli, typename CallbackT>
|
||||||
typename rclcpp::timer::WallTimer<CallbackT>::SharedPtr
|
typename rclcpp::WallTimer<CallbackT>::SharedPtr
|
||||||
create_wall_timer(
|
create_wall_timer(
|
||||||
std::chrono::duration<int64_t, DurationT> period,
|
std::chrono::duration<int64_t, DurationT> period,
|
||||||
CallbackT callback,
|
CallbackT callback,
|
||||||
|
@ -236,7 +233,7 @@ public:
|
||||||
|
|
||||||
/* Create and return a Client. */
|
/* Create and return a Client. */
|
||||||
template<typename ServiceT>
|
template<typename ServiceT>
|
||||||
typename rclcpp::client::Client<ServiceT>::SharedPtr
|
typename rclcpp::Client<ServiceT>::SharedPtr
|
||||||
create_client(
|
create_client(
|
||||||
const std::string & service_name,
|
const std::string & service_name,
|
||||||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_services_default,
|
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_services_default,
|
||||||
|
@ -244,7 +241,7 @@ public:
|
||||||
|
|
||||||
/* Create and return a Service. */
|
/* Create and return a Service. */
|
||||||
template<typename ServiceT, typename CallbackT>
|
template<typename ServiceT, typename CallbackT>
|
||||||
typename rclcpp::service::Service<ServiceT>::SharedPtr
|
typename rclcpp::Service<ServiceT>::SharedPtr
|
||||||
create_service(
|
create_service(
|
||||||
const std::string & service_name,
|
const std::string & service_name,
|
||||||
CallbackT && callback,
|
CallbackT && callback,
|
||||||
|
@ -353,7 +350,7 @@ public:
|
||||||
* out of scope.
|
* out of scope.
|
||||||
*/
|
*/
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
rclcpp::event::Event::SharedPtr
|
rclcpp::Event::SharedPtr
|
||||||
get_graph_event();
|
get_graph_event();
|
||||||
|
|
||||||
/// Wait for a graph event to occur by waiting on an Event to become set.
|
/// Wait for a graph event to occur by waiting on an Event to become set.
|
||||||
|
@ -367,7 +364,7 @@ public:
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void
|
void
|
||||||
wait_for_graph_change(
|
wait_for_graph_change(
|
||||||
rclcpp::event::Event::SharedPtr event,
|
rclcpp::Event::SharedPtr event,
|
||||||
std::chrono::nanoseconds timeout);
|
std::chrono::nanoseconds timeout);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
|
@ -432,7 +429,6 @@ private:
|
||||||
bool use_intra_process_comms_;
|
bool use_intra_process_comms_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace node
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#ifndef RCLCPP__NODE_IMPL_HPP_
|
#ifndef RCLCPP__NODE_IMPL_HPP_
|
||||||
|
|
|
@ -49,8 +49,6 @@
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace node
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename MessageT, typename Alloc, typename PublisherT>
|
template<typename MessageT, typename Alloc, typename PublisherT>
|
||||||
std::shared_ptr<PublisherT>
|
std::shared_ptr<PublisherT>
|
||||||
|
@ -141,13 +139,13 @@ Node::create_subscription(
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename DurationT, typename CallbackT>
|
template<typename DurationT, typename CallbackT>
|
||||||
typename rclcpp::timer::WallTimer<CallbackT>::SharedPtr
|
typename rclcpp::WallTimer<CallbackT>::SharedPtr
|
||||||
Node::create_wall_timer(
|
Node::create_wall_timer(
|
||||||
std::chrono::duration<int64_t, DurationT> period,
|
std::chrono::duration<int64_t, DurationT> period,
|
||||||
CallbackT callback,
|
CallbackT callback,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
||||||
{
|
{
|
||||||
auto timer = rclcpp::timer::WallTimer<CallbackT>::make_shared(
|
auto timer = rclcpp::WallTimer<CallbackT>::make_shared(
|
||||||
std::chrono::duration_cast<std::chrono::nanoseconds>(period),
|
std::chrono::duration_cast<std::chrono::nanoseconds>(period),
|
||||||
std::move(callback));
|
std::move(callback));
|
||||||
node_timers_->add_timer(timer, group);
|
node_timers_->add_timer(timer, group);
|
||||||
|
@ -155,7 +153,7 @@ Node::create_wall_timer(
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceT>
|
template<typename ServiceT>
|
||||||
typename client::Client<ServiceT>::SharedPtr
|
typename Client<ServiceT>::SharedPtr
|
||||||
Node::create_client(
|
Node::create_client(
|
||||||
const std::string & service_name,
|
const std::string & service_name,
|
||||||
const rmw_qos_profile_t & qos_profile,
|
const rmw_qos_profile_t & qos_profile,
|
||||||
|
@ -164,8 +162,8 @@ Node::create_client(
|
||||||
rcl_client_options_t options = rcl_client_get_default_options();
|
rcl_client_options_t options = rcl_client_get_default_options();
|
||||||
options.qos = qos_profile;
|
options.qos = qos_profile;
|
||||||
|
|
||||||
using rclcpp::client::Client;
|
using rclcpp::Client;
|
||||||
using rclcpp::client::ClientBase;
|
using rclcpp::ClientBase;
|
||||||
|
|
||||||
auto cli = Client<ServiceT>::make_shared(
|
auto cli = Client<ServiceT>::make_shared(
|
||||||
node_base_.get(),
|
node_base_.get(),
|
||||||
|
@ -179,23 +177,23 @@ Node::create_client(
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceT, typename CallbackT>
|
template<typename ServiceT, typename CallbackT>
|
||||||
typename rclcpp::service::Service<ServiceT>::SharedPtr
|
typename rclcpp::Service<ServiceT>::SharedPtr
|
||||||
Node::create_service(
|
Node::create_service(
|
||||||
const std::string & service_name,
|
const std::string & service_name,
|
||||||
CallbackT && callback,
|
CallbackT && callback,
|
||||||
const rmw_qos_profile_t & qos_profile,
|
const rmw_qos_profile_t & qos_profile,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
||||||
{
|
{
|
||||||
rclcpp::service::AnyServiceCallback<ServiceT> any_service_callback;
|
rclcpp::AnyServiceCallback<ServiceT> any_service_callback;
|
||||||
any_service_callback.set(std::forward<CallbackT>(callback));
|
any_service_callback.set(std::forward<CallbackT>(callback));
|
||||||
|
|
||||||
rcl_service_options_t service_options = rcl_service_get_default_options();
|
rcl_service_options_t service_options = rcl_service_get_default_options();
|
||||||
service_options.qos = qos_profile;
|
service_options.qos = qos_profile;
|
||||||
|
|
||||||
auto serv = service::Service<ServiceT>::make_shared(
|
auto serv = Service<ServiceT>::make_shared(
|
||||||
node_base_->get_shared_rcl_node_handle(),
|
node_base_->get_shared_rcl_node_handle(),
|
||||||
service_name, any_service_callback, service_options);
|
service_name, any_service_callback, service_options);
|
||||||
auto serv_base_ptr = std::dynamic_pointer_cast<service::ServiceBase>(serv);
|
auto serv_base_ptr = std::dynamic_pointer_cast<ServiceBase>(serv);
|
||||||
node_services_->add_service(serv_base_ptr, group);
|
node_services_->add_service(serv_base_ptr, group);
|
||||||
return serv;
|
return serv;
|
||||||
}
|
}
|
||||||
|
@ -216,8 +214,8 @@ Node::set_parameter_if_not_set(
|
||||||
rclcpp::parameter::ParameterVariant parameter_variant;
|
rclcpp::parameter::ParameterVariant parameter_variant;
|
||||||
if (!this->get_parameter(name, parameter_variant)) {
|
if (!this->get_parameter(name, parameter_variant)) {
|
||||||
this->set_parameters({
|
this->set_parameters({
|
||||||
rclcpp::parameter::ParameterVariant(name, value),
|
rclcpp::parameter::ParameterVariant(name, value),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +246,6 @@ Node::get_parameter_or(
|
||||||
return got_parameter;
|
return got_parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace node
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__NODE_IMPL_HPP_
|
#endif // RCLCPP__NODE_IMPL_HPP_
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
NodeBase(
|
NodeBase(
|
||||||
const std::string & node_name,
|
const std::string & node_name,
|
||||||
const std::string & namespace_,
|
const std::string & namespace_,
|
||||||
rclcpp::context::Context::SharedPtr context);
|
rclcpp::Context::SharedPtr context);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
rclcpp::context::Context::SharedPtr
|
rclcpp::Context::SharedPtr
|
||||||
get_context();
|
get_context();
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
private:
|
private:
|
||||||
RCLCPP_DISABLE_COPY(NodeBase)
|
RCLCPP_DISABLE_COPY(NodeBase)
|
||||||
|
|
||||||
rclcpp::context::Context::SharedPtr context_;
|
rclcpp::Context::SharedPtr context_;
|
||||||
|
|
||||||
std::shared_ptr<rcl_node_t> node_handle_;
|
std::shared_ptr<rcl_node_t> node_handle_;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
/** \return SharedPtr to the node's context. */
|
/** \return SharedPtr to the node's context. */
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
rclcpp::context::Context::SharedPtr
|
rclcpp::Context::SharedPtr
|
||||||
get_context() = 0;
|
get_context() = 0;
|
||||||
|
|
||||||
/// Return the rcl_node_t node handle (non-const version).
|
/// Return the rcl_node_t node handle (non-const version).
|
||||||
|
|
|
@ -96,14 +96,14 @@ public:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
rclcpp::event::Event::SharedPtr
|
rclcpp::Event::SharedPtr
|
||||||
get_graph_event();
|
get_graph_event();
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
wait_for_graph_change(
|
wait_for_graph_change(
|
||||||
rclcpp::event::Event::SharedPtr event,
|
rclcpp::Event::SharedPtr event,
|
||||||
std::chrono::nanoseconds timeout);
|
std::chrono::nanoseconds timeout);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
|
@ -127,7 +127,7 @@ private:
|
||||||
/// For notifying waiting threads (wait_for_graph_change()) on changes (notify_graph_change()).
|
/// For notifying waiting threads (wait_for_graph_change()) on changes (notify_graph_change()).
|
||||||
std::condition_variable graph_cv_;
|
std::condition_variable graph_cv_;
|
||||||
/// Weak references to graph events out on loan.
|
/// Weak references to graph events out on loan.
|
||||||
std::vector<rclcpp::event::Event::WeakPtr> graph_events_;
|
std::vector<rclcpp::Event::WeakPtr> graph_events_;
|
||||||
/// Number of graph events out on loan, used to determine if the graph should be monitored.
|
/// Number of graph events out on loan, used to determine if the graph should be monitored.
|
||||||
/** graph_users_count_ is atomic so that it can be accessed without acquiring the graph_mutex_ */
|
/** graph_users_count_ is atomic so that it can be accessed without acquiring the graph_mutex_ */
|
||||||
std::atomic_size_t graph_users_count_;
|
std::atomic_size_t graph_users_count_;
|
||||||
|
|
|
@ -113,7 +113,7 @@ public:
|
||||||
*/
|
*/
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
rclcpp::event::Event::SharedPtr
|
rclcpp::Event::SharedPtr
|
||||||
get_graph_event() = 0;
|
get_graph_event() = 0;
|
||||||
|
|
||||||
/// Wait for a graph event to occur by waiting on an Event to become set.
|
/// Wait for a graph event to occur by waiting on an Event to become set.
|
||||||
|
@ -128,7 +128,7 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
wait_for_graph_change(
|
wait_for_graph_change(
|
||||||
rclcpp::event::Event::SharedPtr event,
|
rclcpp::Event::SharedPtr event,
|
||||||
std::chrono::nanoseconds timeout) = 0;
|
std::chrono::nanoseconds timeout) = 0;
|
||||||
|
|
||||||
/// Return the number of on loan graph events, see get_graph_event().
|
/// Return the number of on loan graph events, see get_graph_event().
|
||||||
|
|
|
@ -113,7 +113,7 @@ private:
|
||||||
|
|
||||||
std::map<std::string, rclcpp::parameter::ParameterVariant> parameters_;
|
std::map<std::string, rclcpp::parameter::ParameterVariant> parameters_;
|
||||||
|
|
||||||
publisher::Publisher<rcl_interfaces::msg::ParameterEvent>::SharedPtr events_publisher_;
|
Publisher<rcl_interfaces::msg::ParameterEvent>::SharedPtr events_publisher_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace node_interfaces
|
} // namespace node_interfaces
|
||||||
|
|
|
@ -45,14 +45,14 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_client(
|
add_client(
|
||||||
rclcpp::client::ClientBase::SharedPtr client_base_ptr,
|
rclcpp::ClientBase::SharedPtr client_base_ptr,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group);
|
rclcpp::callback_group::CallbackGroup::SharedPtr group);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_service(
|
add_service(
|
||||||
rclcpp::service::ServiceBase::SharedPtr service_base_ptr,
|
rclcpp::ServiceBase::SharedPtr service_base_ptr,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group);
|
rclcpp::callback_group::CallbackGroup::SharedPtr group);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -36,14 +36,14 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_client(
|
add_client(
|
||||||
rclcpp::client::ClientBase::SharedPtr client_base_ptr,
|
rclcpp::ClientBase::SharedPtr client_base_ptr,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group) = 0;
|
rclcpp::callback_group::CallbackGroup::SharedPtr group) = 0;
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_service(
|
add_service(
|
||||||
rclcpp::service::ServiceBase::SharedPtr service_base_ptr,
|
rclcpp::ServiceBase::SharedPtr service_base_ptr,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group) = 0;
|
rclcpp::callback_group::CallbackGroup::SharedPtr group) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_timer(
|
add_timer(
|
||||||
rclcpp::timer::TimerBase::SharedPtr timer,
|
rclcpp::TimerBase::SharedPtr timer,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group);
|
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_timer(
|
add_timer(
|
||||||
rclcpp::timer::TimerBase::SharedPtr timer,
|
rclcpp::TimerBase::SharedPtr timer,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group) = 0;
|
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr
|
rclcpp::PublisherBase::SharedPtr
|
||||||
create_publisher(
|
create_publisher(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
const rclcpp::PublisherFactory & publisher_factory,
|
const rclcpp::PublisherFactory & publisher_factory,
|
||||||
|
@ -58,11 +58,11 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_publisher(
|
add_publisher(
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr publisher);
|
rclcpp::PublisherBase::SharedPtr publisher);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr
|
rclcpp::SubscriptionBase::SharedPtr
|
||||||
create_subscription(
|
create_subscription(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
const rclcpp::SubscriptionFactory & subscription_factory,
|
const rclcpp::SubscriptionFactory & subscription_factory,
|
||||||
|
@ -73,7 +73,7 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_subscription(
|
add_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription,
|
rclcpp::SubscriptionBase::SharedPtr subscription,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group);
|
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr
|
rclcpp::PublisherBase::SharedPtr
|
||||||
create_publisher(
|
create_publisher(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
const rclcpp::PublisherFactory & publisher_factory,
|
const rclcpp::PublisherFactory & publisher_factory,
|
||||||
|
@ -53,11 +53,11 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_publisher(
|
add_publisher(
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr publisher) = 0;
|
rclcpp::PublisherBase::SharedPtr publisher) = 0;
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
virtual
|
virtual
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr
|
rclcpp::SubscriptionBase::SharedPtr
|
||||||
create_subscription(
|
create_subscription(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
const rclcpp::SubscriptionFactory & subscription_factory,
|
const rclcpp::SubscriptionFactory & subscription_factory,
|
||||||
|
@ -68,7 +68,7 @@ public:
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
add_subscription(
|
add_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription,
|
rclcpp::SubscriptionBase::SharedPtr subscription,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group) = 0;
|
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,6 @@
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace parameter_client
|
|
||||||
{
|
|
||||||
|
|
||||||
class AsyncParametersClient
|
class AsyncParametersClient
|
||||||
{
|
{
|
||||||
|
@ -59,13 +57,13 @@ public:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
AsyncParametersClient(
|
AsyncParametersClient(
|
||||||
const rclcpp::node::Node::SharedPtr node,
|
const rclcpp::Node::SharedPtr node,
|
||||||
const std::string & remote_node_name = "",
|
const std::string & remote_node_name = "",
|
||||||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
AsyncParametersClient(
|
AsyncParametersClient(
|
||||||
rclcpp::node::Node * node,
|
rclcpp::Node * node,
|
||||||
const std::string & remote_node_name = "",
|
const std::string & remote_node_name = "",
|
||||||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
||||||
|
|
||||||
|
@ -114,8 +112,8 @@ public:
|
||||||
typename CallbackT,
|
typename CallbackT,
|
||||||
typename Alloc = std::allocator<void>,
|
typename Alloc = std::allocator<void>,
|
||||||
typename SubscriptionT =
|
typename SubscriptionT =
|
||||||
rclcpp::subscription::Subscription<rcl_interfaces::msg::ParameterEvent, Alloc>>
|
rclcpp::Subscription<rcl_interfaces::msg::ParameterEvent, Alloc>>
|
||||||
typename rclcpp::subscription::Subscription<rcl_interfaces::msg::ParameterEvent>::SharedPtr
|
typename rclcpp::Subscription<rcl_interfaces::msg::ParameterEvent>::SharedPtr
|
||||||
on_parameter_event(CallbackT && callback)
|
on_parameter_event(CallbackT && callback)
|
||||||
{
|
{
|
||||||
using rclcpp::message_memory_strategy::MessageMemoryStrategy;
|
using rclcpp::message_memory_strategy::MessageMemoryStrategy;
|
||||||
|
@ -156,14 +154,14 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_interface_;
|
const rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_interface_;
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::GetParameters>::SharedPtr get_parameters_client_;
|
rclcpp::Client<rcl_interfaces::srv::GetParameters>::SharedPtr get_parameters_client_;
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::GetParameterTypes>::SharedPtr
|
rclcpp::Client<rcl_interfaces::srv::GetParameterTypes>::SharedPtr
|
||||||
get_parameter_types_client_;
|
get_parameter_types_client_;
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::SetParameters>::SharedPtr set_parameters_client_;
|
rclcpp::Client<rcl_interfaces::srv::SetParameters>::SharedPtr set_parameters_client_;
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::SetParametersAtomically>::SharedPtr
|
rclcpp::Client<rcl_interfaces::srv::SetParametersAtomically>::SharedPtr
|
||||||
set_parameters_atomically_client_;
|
set_parameters_atomically_client_;
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::ListParameters>::SharedPtr list_parameters_client_;
|
rclcpp::Client<rcl_interfaces::srv::ListParameters>::SharedPtr list_parameters_client_;
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::DescribeParameters>::SharedPtr
|
rclcpp::Client<rcl_interfaces::srv::DescribeParameters>::SharedPtr
|
||||||
describe_parameters_client_;
|
describe_parameters_client_;
|
||||||
std::string remote_node_name_;
|
std::string remote_node_name_;
|
||||||
};
|
};
|
||||||
|
@ -175,14 +173,14 @@ public:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
explicit SyncParametersClient(
|
explicit SyncParametersClient(
|
||||||
rclcpp::node::Node::SharedPtr node,
|
rclcpp::Node::SharedPtr node,
|
||||||
const std::string & remote_node_name = "",
|
const std::string & remote_node_name = "",
|
||||||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
SyncParametersClient(
|
SyncParametersClient(
|
||||||
rclcpp::executor::Executor::SharedPtr executor,
|
rclcpp::executor::Executor::SharedPtr executor,
|
||||||
rclcpp::node::Node::SharedPtr node,
|
rclcpp::Node::SharedPtr node,
|
||||||
const std::string & remote_node_name = "",
|
const std::string & remote_node_name = "",
|
||||||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
||||||
|
|
||||||
|
@ -246,7 +244,7 @@ public:
|
||||||
uint64_t depth);
|
uint64_t depth);
|
||||||
|
|
||||||
template<typename CallbackT>
|
template<typename CallbackT>
|
||||||
typename rclcpp::subscription::Subscription<rcl_interfaces::msg::ParameterEvent>::SharedPtr
|
typename rclcpp::Subscription<rcl_interfaces::msg::ParameterEvent>::SharedPtr
|
||||||
on_parameter_event(CallbackT && callback)
|
on_parameter_event(CallbackT && callback)
|
||||||
{
|
{
|
||||||
return async_parameters_client_->on_parameter_event(std::forward<CallbackT>(callback));
|
return async_parameters_client_->on_parameter_event(std::forward<CallbackT>(callback));
|
||||||
|
@ -269,11 +267,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rclcpp::executor::Executor::SharedPtr executor_;
|
rclcpp::executor::Executor::SharedPtr executor_;
|
||||||
rclcpp::node::Node::SharedPtr node_;
|
rclcpp::Node::SharedPtr node_;
|
||||||
AsyncParametersClient::SharedPtr async_parameters_client_;
|
AsyncParametersClient::SharedPtr async_parameters_client_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace parameter_client
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__PARAMETER_CLIENT_HPP_
|
#endif // RCLCPP__PARAMETER_CLIENT_HPP_
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace parameter_service
|
|
||||||
{
|
|
||||||
|
|
||||||
class ParameterService
|
class ParameterService
|
||||||
{
|
{
|
||||||
|
@ -42,23 +40,22 @@ public:
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
explicit ParameterService(
|
explicit ParameterService(
|
||||||
const rclcpp::node::Node::SharedPtr node,
|
const rclcpp::Node::SharedPtr node,
|
||||||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const rclcpp::node::Node::SharedPtr node_;
|
const rclcpp::Node::SharedPtr node_;
|
||||||
rclcpp::service::Service<rcl_interfaces::srv::GetParameters>::SharedPtr get_parameters_service_;
|
rclcpp::Service<rcl_interfaces::srv::GetParameters>::SharedPtr get_parameters_service_;
|
||||||
rclcpp::service::Service<rcl_interfaces::srv::GetParameterTypes>::SharedPtr
|
rclcpp::Service<rcl_interfaces::srv::GetParameterTypes>::SharedPtr
|
||||||
get_parameter_types_service_;
|
get_parameter_types_service_;
|
||||||
rclcpp::service::Service<rcl_interfaces::srv::SetParameters>::SharedPtr set_parameters_service_;
|
rclcpp::Service<rcl_interfaces::srv::SetParameters>::SharedPtr set_parameters_service_;
|
||||||
rclcpp::service::Service<rcl_interfaces::srv::SetParametersAtomically>::SharedPtr
|
rclcpp::Service<rcl_interfaces::srv::SetParametersAtomically>::SharedPtr
|
||||||
set_parameters_atomically_service_;
|
set_parameters_atomically_service_;
|
||||||
rclcpp::service::Service<rcl_interfaces::srv::DescribeParameters>::SharedPtr
|
rclcpp::Service<rcl_interfaces::srv::DescribeParameters>::SharedPtr
|
||||||
describe_parameters_service_;
|
describe_parameters_service_;
|
||||||
rclcpp::service::Service<rcl_interfaces::srv::ListParameters>::SharedPtr list_parameters_service_;
|
rclcpp::Service<rcl_interfaces::srv::ListParameters>::SharedPtr list_parameters_service_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace parameter_service
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__PARAMETER_SERVICE_HPP_
|
#endif // RCLCPP__PARAMETER_SERVICE_HPP_
|
||||||
|
|
|
@ -45,9 +45,6 @@ namespace node_interfaces
|
||||||
class NodeTopicsInterface;
|
class NodeTopicsInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace publisher
|
|
||||||
{
|
|
||||||
|
|
||||||
class PublisherBase
|
class PublisherBase
|
||||||
{
|
{
|
||||||
friend ::rclcpp::node_interfaces::NodeTopicsInterface;
|
friend ::rclcpp::node_interfaces::NodeTopicsInterface;
|
||||||
|
@ -305,8 +302,6 @@ protected:
|
||||||
MessageDeleter message_deleter_;
|
MessageDeleter message_deleter_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace publisher
|
|
||||||
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__PUBLISHER_HPP_
|
#endif // RCLCPP__PUBLISHER_HPP_
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct PublisherFactory
|
||||||
{
|
{
|
||||||
// Creates a PublisherT<MessageT, ...> publisher object and returns it as a PublisherBase.
|
// Creates a PublisherT<MessageT, ...> publisher object and returns it as a PublisherBase.
|
||||||
using PublisherFactoryFunction = std::function<
|
using PublisherFactoryFunction = std::function<
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr(
|
rclcpp::PublisherBase::SharedPtr(
|
||||||
rclcpp::node_interfaces::NodeBaseInterface * node_base,
|
rclcpp::node_interfaces::NodeBaseInterface * node_base,
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
rcl_publisher_options_t & publisher_options)>;
|
rcl_publisher_options_t & publisher_options)>;
|
||||||
|
@ -58,7 +58,7 @@ struct PublisherFactory
|
||||||
using AddPublisherToIntraProcessManagerFunction = std::function<
|
using AddPublisherToIntraProcessManagerFunction = std::function<
|
||||||
uint64_t(
|
uint64_t(
|
||||||
rclcpp::intra_process_manager::IntraProcessManager * ipm,
|
rclcpp::intra_process_manager::IntraProcessManager * ipm,
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr publisher)>;
|
rclcpp::PublisherBase::SharedPtr publisher)>;
|
||||||
|
|
||||||
AddPublisherToIntraProcessManagerFunction add_publisher_to_intra_process_manager;
|
AddPublisherToIntraProcessManagerFunction add_publisher_to_intra_process_manager;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ struct PublisherFactory
|
||||||
// PublisherT::publish() and which handles the intra process transmission of
|
// PublisherT::publish() and which handles the intra process transmission of
|
||||||
// the message being published.
|
// the message being published.
|
||||||
using SharedPublishCallbackFactoryFunction = std::function<
|
using SharedPublishCallbackFactoryFunction = std::function<
|
||||||
rclcpp::publisher::PublisherBase::StoreMessageCallbackT(
|
rclcpp::PublisherBase::StoreMessageCallbackT(
|
||||||
rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm)>;
|
rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm)>;
|
||||||
|
|
||||||
SharedPublishCallbackFactoryFunction create_shared_publish_callback;
|
SharedPublishCallbackFactoryFunction create_shared_publish_callback;
|
||||||
|
@ -96,13 +96,13 @@ create_publisher_factory(std::shared_ptr<Alloc> allocator)
|
||||||
factory.add_publisher_to_intra_process_manager =
|
factory.add_publisher_to_intra_process_manager =
|
||||||
[](
|
[](
|
||||||
rclcpp::intra_process_manager::IntraProcessManager * ipm,
|
rclcpp::intra_process_manager::IntraProcessManager * ipm,
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr publisher) -> uint64_t
|
rclcpp::PublisherBase::SharedPtr publisher) -> uint64_t
|
||||||
{
|
{
|
||||||
return ipm->add_publisher<MessageT, Alloc>(std::dynamic_pointer_cast<PublisherT>(publisher));
|
return ipm->add_publisher<MessageT, Alloc>(std::dynamic_pointer_cast<PublisherT>(publisher));
|
||||||
};
|
};
|
||||||
|
|
||||||
// function to create a shared publish callback std::function
|
// function to create a shared publish callback std::function
|
||||||
using StoreMessageCallbackT = rclcpp::publisher::PublisherBase::StoreMessageCallbackT;
|
using StoreMessageCallbackT = rclcpp::PublisherBase::StoreMessageCallbackT;
|
||||||
factory.create_shared_publish_callback =
|
factory.create_shared_publish_callback =
|
||||||
[](rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm) -> StoreMessageCallbackT
|
[](rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm) -> StoreMessageCallbackT
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ create_publisher_factory(std::shared_ptr<Alloc> allocator)
|
||||||
"' is incompatible from the publisher type '" + message_type_info.name() + "'");
|
"' is incompatible from the publisher type '" + message_type_info.name() + "'");
|
||||||
}
|
}
|
||||||
MessageT * typed_message_ptr = static_cast<MessageT *>(msg);
|
MessageT * typed_message_ptr = static_cast<MessageT *>(msg);
|
||||||
using MessageDeleter = typename publisher::Publisher<MessageT, Alloc>::MessageDeleter;
|
using MessageDeleter = typename Publisher<MessageT, Alloc>::MessageDeleter;
|
||||||
std::unique_ptr<MessageT, MessageDeleter> unique_msg(typed_message_ptr);
|
std::unique_ptr<MessageT, MessageDeleter> unique_msg(typed_message_ptr);
|
||||||
uint64_t message_seq =
|
uint64_t message_seq =
|
||||||
ipm->store_intra_process_message<MessageT, Alloc>(publisher_id, unique_msg);
|
ipm->store_intra_process_message<MessageT, Alloc>(publisher_id, unique_msg);
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace rate
|
|
||||||
{
|
|
||||||
|
|
||||||
class RateBase
|
class RateBase
|
||||||
{
|
{
|
||||||
|
@ -84,7 +82,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Sleep (will get interrupted by ctrl-c, may not sleep full time)
|
// Sleep (will get interrupted by ctrl-c, may not sleep full time)
|
||||||
rclcpp::utilities::sleep_for(time_to_sleep);
|
rclcpp::sleep_for(time_to_sleep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +114,6 @@ private:
|
||||||
using Rate = GenericRate<std::chrono::system_clock>;
|
using Rate = GenericRate<std::chrono::system_clock>;
|
||||||
using WallRate = GenericRate<std::chrono::steady_clock>;
|
using WallRate = GenericRate<std::chrono::steady_clock>;
|
||||||
|
|
||||||
} // namespace rate
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__RATE_HPP_
|
#endif // RCLCPP__RATE_HPP_
|
||||||
|
|
|
@ -18,46 +18,46 @@
|
||||||
* It consists of these main components:
|
* It consists of these main components:
|
||||||
*
|
*
|
||||||
* - Node
|
* - Node
|
||||||
* - rclcpp::node::Node
|
* - rclcpp::Node
|
||||||
* - rclcpp/node.hpp
|
* - rclcpp/node.hpp
|
||||||
* - Publisher
|
* - Publisher
|
||||||
* - rclcpp::node::Node::create_publisher()
|
* - rclcpp::Node::create_publisher()
|
||||||
* - rclcpp::publisher::Publisher
|
* - rclcpp::Publisher
|
||||||
* - rclcpp::publisher::Publisher::publish()
|
* - rclcpp::Publisher::publish()
|
||||||
* - rclcpp/publisher.hpp
|
* - rclcpp/publisher.hpp
|
||||||
* - Subscription
|
* - Subscription
|
||||||
* - rclcpp::node::Node::create_subscription()
|
* - rclcpp::Node::create_subscription()
|
||||||
* - rclcpp::subscription::Subscription
|
* - rclcpp::Subscription
|
||||||
* - rclcpp/subscription.hpp
|
* - rclcpp/subscription.hpp
|
||||||
* - Service Client
|
* - Service Client
|
||||||
* - rclcpp::node::Node::create_client()
|
* - rclcpp::Node::create_client()
|
||||||
* - rclcpp::client::Client
|
* - rclcpp::Client
|
||||||
* - rclcpp/client.hpp
|
* - rclcpp/client.hpp
|
||||||
* - Service Server
|
* - Service Server
|
||||||
* - rclcpp::node::Node::create_service()
|
* - rclcpp::Node::create_service()
|
||||||
* - rclcpp::service::Service
|
* - rclcpp::Service
|
||||||
* - rclcpp/service.hpp
|
* - rclcpp/service.hpp
|
||||||
* - Timer
|
* - Timer
|
||||||
* - rclcpp::node::Node::create_wall_timer()
|
* - rclcpp::Node::create_wall_timer()
|
||||||
* - rclcpp::timer::WallTimer
|
* - rclcpp::WallTimer
|
||||||
* - rclcpp::timer::TimerBase
|
* - rclcpp::TimerBase
|
||||||
* - rclcpp/timer.hpp
|
* - rclcpp/timer.hpp
|
||||||
* - Parameters:
|
* - Parameters:
|
||||||
* - rclcpp::node::Node::set_parameters()
|
* - rclcpp::Node::set_parameters()
|
||||||
* - rclcpp::node::Node::get_parameters()
|
* - rclcpp::Node::get_parameters()
|
||||||
* - rclcpp::node::Node::get_parameter()
|
* - rclcpp::Node::get_parameter()
|
||||||
* - rclcpp::node::Node::describe_parameters()
|
* - rclcpp::Node::describe_parameters()
|
||||||
* - rclcpp::node::Node::list_parameters()
|
* - rclcpp::Node::list_parameters()
|
||||||
* - rclcpp::node::Node::register_param_change_callback()
|
* - rclcpp::Node::register_param_change_callback()
|
||||||
* - rclcpp::parameter::ParameterVariant
|
* - rclcpp::parameter::ParameterVariant
|
||||||
* - rclcpp::parameter_client::AsyncParametersClient
|
* - rclcpp::AsyncParametersClient
|
||||||
* - rclcpp::parameter_client::SyncParametersClient
|
* - rclcpp::SyncParametersClient
|
||||||
* - rclcpp/parameter.hpp
|
* - rclcpp/parameter.hpp
|
||||||
* - rclcpp/parameter_client.hpp
|
* - rclcpp/parameter_client.hpp
|
||||||
* - rclcpp/parameter_service.hpp
|
* - rclcpp/parameter_service.hpp
|
||||||
* - Rate:
|
* - Rate:
|
||||||
* - rclcpp::rate::Rate
|
* - rclcpp::Rate
|
||||||
* - rclcpp::rate::WallRate
|
* - rclcpp::WallRate
|
||||||
* - rclcpp/rate.hpp
|
* - rclcpp/rate.hpp
|
||||||
*
|
*
|
||||||
* There are also some components which help control the execution of callbacks:
|
* There are also some components which help control the execution of callbacks:
|
||||||
|
@ -66,32 +66,32 @@
|
||||||
* - rclcpp::spin()
|
* - rclcpp::spin()
|
||||||
* - rclcpp::spin_some()
|
* - rclcpp::spin_some()
|
||||||
* - rclcpp::spin_until_future_complete()
|
* - rclcpp::spin_until_future_complete()
|
||||||
* - rclcpp::executors::single_threaded_executor::SingleThreadedExecutor
|
* - rclcpp::executors::SingleThreadedExecutor
|
||||||
* - rclcpp::executors::single_threaded_executor::SingleThreadedExecutor::add_node()
|
* - rclcpp::executors::SingleThreadedExecutor::add_node()
|
||||||
* - rclcpp::executors::single_threaded_executor::SingleThreadedExecutor::spin()
|
* - rclcpp::executors::SingleThreadedExecutor::spin()
|
||||||
* - rclcpp::executors::multi_threaded_executor::MultiThreadedExecutor
|
* - rclcpp::executors::MultiThreadedExecutor
|
||||||
* - rclcpp::executors::multi_threaded_executor::MultiThreadedExecutor::add_node()
|
* - rclcpp::executors::MultiThreadedExecutor::add_node()
|
||||||
* - rclcpp::executors::multi_threaded_executor::MultiThreadedExecutor::spin()
|
* - rclcpp::executors::MultiThreadedExecutor::spin()
|
||||||
* - rclcpp/executor.hpp
|
* - rclcpp/executor.hpp
|
||||||
* - rclcpp/executors.hpp
|
* - rclcpp/executors.hpp
|
||||||
* - rclcpp/executors/single_threaded_executor.hpp
|
* - rclcpp/executors/single_threaded_executor.hpp
|
||||||
* - rclcpp/executors/multi_threaded_executor.hpp
|
* - rclcpp/executors/multi_threaded_executor.hpp
|
||||||
* - CallbackGroups (mechanism for enforcing concurrency rules for callbacks):
|
* - CallbackGroups (mechanism for enforcing concurrency rules for callbacks):
|
||||||
* - rclcpp::node::Node::create_callback_group()
|
* - rclcpp::Node::create_callback_group()
|
||||||
* - rclcpp::callback_group::CallbackGroup
|
* - rclcpp::callback_group::CallbackGroup
|
||||||
* - rclcpp/callback_group.hpp
|
* - rclcpp/callback_group.hpp
|
||||||
*
|
*
|
||||||
* Additionally, there are some methods for introspecting the ROS graph:
|
* Additionally, there are some methods for introspecting the ROS graph:
|
||||||
*
|
*
|
||||||
* - Graph Events (a waitable event object that wakes up when the graph changes):
|
* - Graph Events (a waitable event object that wakes up when the graph changes):
|
||||||
* - rclcpp::node::Node::get_graph_event()
|
* - rclcpp::Node::get_graph_event()
|
||||||
* - rclcpp::node::Node::wait_for_graph_change()
|
* - rclcpp::Node::wait_for_graph_change()
|
||||||
* - rclcpp::event::Event
|
* - rclcpp::Event
|
||||||
* - List topic names and types:
|
* - List topic names and types:
|
||||||
* - rclcpp::node::Node::get_topic_names_and_types()
|
* - rclcpp::Node::get_topic_names_and_types()
|
||||||
* - Get the number of publishers or subscribers on a topic:
|
* - Get the number of publishers or subscribers on a topic:
|
||||||
* - rclcpp::node::Node::count_publishers()
|
* - rclcpp::Node::count_publishers()
|
||||||
* - rclcpp::node::Node::count_subscribers()
|
* - rclcpp::Node::count_subscribers()
|
||||||
*
|
*
|
||||||
* And components related to logging:
|
* And components related to logging:
|
||||||
*
|
*
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
* - Logger:
|
* - Logger:
|
||||||
* - rclcpp::Logger
|
* - rclcpp::Logger
|
||||||
* - rclcpp/logger.hpp
|
* - rclcpp/logger.hpp
|
||||||
* - rclcpp::node::Node::get_logger()
|
* - rclcpp::Node::get_logger()
|
||||||
*
|
*
|
||||||
* Finally, there are many internal API's and utilities:
|
* Finally, there are many internal API's and utilities:
|
||||||
*
|
*
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
* - rclcpp/strategies/allocator_memory_strategy.hpp
|
* - rclcpp/strategies/allocator_memory_strategy.hpp
|
||||||
* - rclcpp/strategies/message_pool_memory_strategy.hpp
|
* - rclcpp/strategies/message_pool_memory_strategy.hpp
|
||||||
* - Context object which is shared amongst multiple Nodes:
|
* - Context object which is shared amongst multiple Nodes:
|
||||||
* - rclcpp::context::Context
|
* - rclcpp::Context
|
||||||
* - rclcpp/context.hpp
|
* - rclcpp/context.hpp
|
||||||
* - rclcpp/contexts/default_context.hpp
|
* - rclcpp/contexts/default_context.hpp
|
||||||
* - Various utilities:
|
* - Various utilities:
|
||||||
|
@ -150,34 +150,4 @@
|
||||||
#include "rclcpp/utilities.hpp"
|
#include "rclcpp/utilities.hpp"
|
||||||
#include "rclcpp/visibility_control.hpp"
|
#include "rclcpp/visibility_control.hpp"
|
||||||
|
|
||||||
namespace rclcpp
|
|
||||||
{
|
|
||||||
|
|
||||||
// Namespace escalations.
|
|
||||||
// For example, this next line escalates type "rclcpp:node::Node" to "rclcpp::Node"
|
|
||||||
using rclcpp::node::Node;
|
|
||||||
using rclcpp::publisher::Publisher;
|
|
||||||
using rclcpp::publisher::PublisherBase;
|
|
||||||
using rclcpp::subscription::Subscription;
|
|
||||||
using rclcpp::subscription::SubscriptionBase;
|
|
||||||
using rclcpp::client::Client;
|
|
||||||
using rclcpp::client::ClientBase;
|
|
||||||
using rclcpp::service::Service;
|
|
||||||
using rclcpp::service::ServiceBase;
|
|
||||||
using rclcpp::parameter_client::AsyncParametersClient;
|
|
||||||
using rclcpp::parameter_client::SyncParametersClient;
|
|
||||||
using rclcpp::parameter_service::ParameterService;
|
|
||||||
using rclcpp::rate::GenericRate;
|
|
||||||
using rclcpp::rate::WallRate;
|
|
||||||
using rclcpp::timer::GenericTimer;
|
|
||||||
using rclcpp::timer::TimerBase;
|
|
||||||
using rclcpp::timer::WallTimer;
|
|
||||||
using ContextSharedPtr = rclcpp::context::Context::SharedPtr;
|
|
||||||
using rclcpp::utilities::ok;
|
|
||||||
using rclcpp::utilities::shutdown;
|
|
||||||
using rclcpp::utilities::init;
|
|
||||||
using rclcpp::utilities::sleep_for;
|
|
||||||
|
|
||||||
} // namespace rclcpp
|
|
||||||
|
|
||||||
#endif // RCLCPP__RCLCPP_HPP_
|
#endif // RCLCPP__RCLCPP_HPP_
|
||||||
|
|
|
@ -35,8 +35,6 @@
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace service
|
|
||||||
{
|
|
||||||
|
|
||||||
class ServiceBase
|
class ServiceBase
|
||||||
{
|
{
|
||||||
|
@ -91,8 +89,6 @@ protected:
|
||||||
bool owns_rcl_handle_ = true;
|
bool owns_rcl_handle_ = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
using any_service_callback::AnyServiceCallback;
|
|
||||||
|
|
||||||
template<typename ServiceT>
|
template<typename ServiceT>
|
||||||
class Service : public ServiceBase
|
class Service : public ServiceBase
|
||||||
{
|
{
|
||||||
|
@ -223,7 +219,6 @@ private:
|
||||||
AnyServiceCallback<ServiceT> any_callback_;
|
AnyServiceCallback<ServiceT> any_callback_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace service
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__SERVICE_HPP_
|
#endif // RCLCPP__SERVICE_HPP_
|
||||||
|
|
|
@ -45,9 +45,6 @@ namespace node_interfaces
|
||||||
class NodeTopicsInterface;
|
class NodeTopicsInterface;
|
||||||
} // namespace node_interfaces
|
} // namespace node_interfaces
|
||||||
|
|
||||||
namespace subscription
|
|
||||||
{
|
|
||||||
|
|
||||||
/// Virtual base class for subscriptions. This pattern allows us to iterate over different template
|
/// Virtual base class for subscriptions. This pattern allows us to iterate over different template
|
||||||
/// specializations of Subscription, among other things.
|
/// specializations of Subscription, among other things.
|
||||||
class SubscriptionBase
|
class SubscriptionBase
|
||||||
|
@ -121,8 +118,6 @@ private:
|
||||||
RCLCPP_DISABLE_COPY(SubscriptionBase)
|
RCLCPP_DISABLE_COPY(SubscriptionBase)
|
||||||
};
|
};
|
||||||
|
|
||||||
using any_subscription_callback::AnySubscriptionCallback;
|
|
||||||
|
|
||||||
/// Subscription implementation, templated on the type of message this subscription receives.
|
/// Subscription implementation, templated on the type of message this subscription receives.
|
||||||
template<typename MessageT, typename Alloc = std::allocator<void>>
|
template<typename MessageT, typename Alloc = std::allocator<void>>
|
||||||
class Subscription : public SubscriptionBase
|
class Subscription : public SubscriptionBase
|
||||||
|
@ -292,7 +287,6 @@ private:
|
||||||
uint64_t intra_process_subscription_id_;
|
uint64_t intra_process_subscription_id_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace subscription
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__SUBSCRIPTION_HPP_
|
#endif // RCLCPP__SUBSCRIPTION_HPP_
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct SubscriptionFactory
|
||||||
{
|
{
|
||||||
// Creates a Subscription<MessageT> object and returns it as a SubscriptionBase.
|
// Creates a Subscription<MessageT> object and returns it as a SubscriptionBase.
|
||||||
using SubscriptionFactoryFunction = std::function<
|
using SubscriptionFactoryFunction = std::function<
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr(
|
rclcpp::SubscriptionBase::SharedPtr(
|
||||||
rclcpp::node_interfaces::NodeBaseInterface * node_base,
|
rclcpp::node_interfaces::NodeBaseInterface * node_base,
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
rcl_subscription_options_t & subscription_options)>;
|
rcl_subscription_options_t & subscription_options)>;
|
||||||
|
@ -58,7 +58,7 @@ struct SubscriptionFactory
|
||||||
using SetupIntraProcessFunction = std::function<
|
using SetupIntraProcessFunction = std::function<
|
||||||
void(
|
void(
|
||||||
rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm,
|
rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm,
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription,
|
rclcpp::SubscriptionBase::SharedPtr subscription,
|
||||||
const rcl_subscription_options_t & subscription_options)>;
|
const rcl_subscription_options_t & subscription_options)>;
|
||||||
|
|
||||||
SetupIntraProcessFunction setup_intra_process;
|
SetupIntraProcessFunction setup_intra_process;
|
||||||
|
@ -75,12 +75,12 @@ create_subscription_factory(
|
||||||
{
|
{
|
||||||
SubscriptionFactory factory;
|
SubscriptionFactory factory;
|
||||||
|
|
||||||
using rclcpp::subscription::AnySubscriptionCallback;
|
using rclcpp::AnySubscriptionCallback;
|
||||||
AnySubscriptionCallback<MessageT, Alloc> any_subscription_callback(allocator);
|
AnySubscriptionCallback<MessageT, Alloc> any_subscription_callback(allocator);
|
||||||
any_subscription_callback.set(std::forward<CallbackT>(callback));
|
any_subscription_callback.set(std::forward<CallbackT>(callback));
|
||||||
|
|
||||||
auto message_alloc =
|
auto message_alloc =
|
||||||
std::make_shared<typename subscription::Subscription<MessageT, Alloc>::MessageAlloc>();
|
std::make_shared<typename Subscription<MessageT, Alloc>::MessageAlloc>();
|
||||||
|
|
||||||
// factory function that creates a MessageT specific SubscriptionT
|
// factory function that creates a MessageT specific SubscriptionT
|
||||||
factory.create_typed_subscription =
|
factory.create_typed_subscription =
|
||||||
|
@ -88,13 +88,13 @@ create_subscription_factory(
|
||||||
rclcpp::node_interfaces::NodeBaseInterface * node_base,
|
rclcpp::node_interfaces::NodeBaseInterface * node_base,
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
rcl_subscription_options_t & subscription_options
|
rcl_subscription_options_t & subscription_options
|
||||||
) -> rclcpp::subscription::SubscriptionBase::SharedPtr
|
) -> rclcpp::SubscriptionBase::SharedPtr
|
||||||
{
|
{
|
||||||
subscription_options.allocator =
|
subscription_options.allocator =
|
||||||
rclcpp::allocator::get_rcl_allocator<MessageT>(*message_alloc.get());
|
rclcpp::allocator::get_rcl_allocator<MessageT>(*message_alloc.get());
|
||||||
|
|
||||||
using rclcpp::subscription::Subscription;
|
using rclcpp::Subscription;
|
||||||
using rclcpp::subscription::SubscriptionBase;
|
using rclcpp::SubscriptionBase;
|
||||||
|
|
||||||
auto sub = Subscription<MessageT, Alloc>::make_shared(
|
auto sub = Subscription<MessageT, Alloc>::make_shared(
|
||||||
node_base->get_shared_rcl_node_handle(),
|
node_base->get_shared_rcl_node_handle(),
|
||||||
|
@ -110,7 +110,7 @@ create_subscription_factory(
|
||||||
factory.setup_intra_process =
|
factory.setup_intra_process =
|
||||||
[message_alloc](
|
[message_alloc](
|
||||||
rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm,
|
rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm,
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription,
|
rclcpp::SubscriptionBase::SharedPtr subscription,
|
||||||
const rcl_subscription_options_t & subscription_options)
|
const rcl_subscription_options_t & subscription_options)
|
||||||
{
|
{
|
||||||
rclcpp::intra_process_manager::IntraProcessManager::WeakPtr weak_ipm = ipm;
|
rclcpp::intra_process_manager::IntraProcessManager::WeakPtr weak_ipm = ipm;
|
||||||
|
@ -128,7 +128,7 @@ create_subscription_factory(
|
||||||
uint64_t publisher_id,
|
uint64_t publisher_id,
|
||||||
uint64_t message_sequence,
|
uint64_t message_sequence,
|
||||||
uint64_t subscription_id,
|
uint64_t subscription_id,
|
||||||
typename rclcpp::subscription::Subscription<MessageT, Alloc>::MessageUniquePtr & message)
|
typename rclcpp::Subscription<MessageT, Alloc>::MessageUniquePtr & message)
|
||||||
{
|
{
|
||||||
auto ipm = weak_ipm.lock();
|
auto ipm = weak_ipm.lock();
|
||||||
if (!ipm) {
|
if (!ipm) {
|
||||||
|
|
|
@ -36,13 +36,13 @@ class TimeSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
explicit TimeSource(rclcpp::node::Node::SharedPtr node);
|
explicit TimeSource(rclcpp::Node::SharedPtr node);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
TimeSource();
|
TimeSource();
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void attachNode(rclcpp::node::Node::SharedPtr node);
|
void attachNode(rclcpp::Node::SharedPtr node);
|
||||||
|
|
||||||
RCLCPP_PUBLIC
|
RCLCPP_PUBLIC
|
||||||
void attachNode(
|
void attachNode(
|
||||||
|
@ -77,18 +77,18 @@ private:
|
||||||
// The subscription for the clock callback
|
// The subscription for the clock callback
|
||||||
using MessageT = builtin_interfaces::msg::Time;
|
using MessageT = builtin_interfaces::msg::Time;
|
||||||
using Alloc = std::allocator<void>;
|
using Alloc = std::allocator<void>;
|
||||||
using SubscriptionT = rclcpp::subscription::Subscription<MessageT, Alloc>;
|
using SubscriptionT = rclcpp::Subscription<MessageT, Alloc>;
|
||||||
std::shared_ptr<SubscriptionT> clock_subscription_;
|
std::shared_ptr<SubscriptionT> clock_subscription_;
|
||||||
|
|
||||||
// The clock callback itself
|
// The clock callback itself
|
||||||
void clock_cb(const builtin_interfaces::msg::Time::SharedPtr msg);
|
void clock_cb(const builtin_interfaces::msg::Time::SharedPtr msg);
|
||||||
|
|
||||||
// Parameter Client pointer
|
// Parameter Client pointer
|
||||||
std::shared_ptr<rclcpp::parameter_client::AsyncParametersClient> parameter_client_;
|
std::shared_ptr<rclcpp::AsyncParametersClient> parameter_client_;
|
||||||
|
|
||||||
// Parameter Event subscription
|
// Parameter Event subscription
|
||||||
using ParamMessageT = rcl_interfaces::msg::ParameterEvent;
|
using ParamMessageT = rcl_interfaces::msg::ParameterEvent;
|
||||||
using ParamSubscriptionT = rclcpp::subscription::Subscription<ParamMessageT, Alloc>;
|
using ParamSubscriptionT = rclcpp::Subscription<ParamMessageT, Alloc>;
|
||||||
std::shared_ptr<ParamSubscriptionT> parameter_subscription_;
|
std::shared_ptr<ParamSubscriptionT> parameter_subscription_;
|
||||||
|
|
||||||
// Callback for parameter updates
|
// Callback for parameter updates
|
||||||
|
|
|
@ -37,8 +37,6 @@
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace timer
|
|
||||||
{
|
|
||||||
|
|
||||||
class TimerBase
|
class TimerBase
|
||||||
{
|
{
|
||||||
|
@ -182,7 +180,6 @@ protected:
|
||||||
template<typename CallbackType>
|
template<typename CallbackType>
|
||||||
using WallTimer = GenericTimer<CallbackType, std::chrono::steady_clock>;
|
using WallTimer = GenericTimer<CallbackType, std::chrono::steady_clock>;
|
||||||
|
|
||||||
} // namespace timer
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__TIMER_HPP_
|
#endif // RCLCPP__TIMER_HPP_
|
||||||
|
|
|
@ -44,8 +44,6 @@ std::string to_string(T value)
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace utilities
|
|
||||||
{
|
|
||||||
|
|
||||||
/// Initialize communications via the rmw implementation and set up a global signal handler.
|
/// Initialize communications via the rmw implementation and set up a global signal handler.
|
||||||
/**
|
/**
|
||||||
|
@ -111,7 +109,6 @@ RCLCPP_PUBLIC
|
||||||
bool
|
bool
|
||||||
sleep_for(const std::chrono::nanoseconds & nanoseconds);
|
sleep_for(const std::chrono::nanoseconds & nanoseconds);
|
||||||
|
|
||||||
} // namespace utilities
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
#endif // RCLCPP__UTILITIES_HPP_
|
#endif // RCLCPP__UTILITIES_HPP_
|
||||||
|
|
|
@ -23,28 +23,28 @@ CallbackGroup::CallbackGroup(CallbackGroupType group_type)
|
||||||
: type_(group_type), can_be_taken_from_(true)
|
: type_(group_type), can_be_taken_from_(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const std::vector<rclcpp::subscription::SubscriptionBase::WeakPtr> &
|
const std::vector<rclcpp::SubscriptionBase::WeakPtr> &
|
||||||
CallbackGroup::get_subscription_ptrs() const
|
CallbackGroup::get_subscription_ptrs() const
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
return subscription_ptrs_;
|
return subscription_ptrs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<rclcpp::timer::TimerBase::WeakPtr> &
|
const std::vector<rclcpp::TimerBase::WeakPtr> &
|
||||||
CallbackGroup::get_timer_ptrs() const
|
CallbackGroup::get_timer_ptrs() const
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
return timer_ptrs_;
|
return timer_ptrs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<rclcpp::service::ServiceBase::WeakPtr> &
|
const std::vector<rclcpp::ServiceBase::WeakPtr> &
|
||||||
CallbackGroup::get_service_ptrs() const
|
CallbackGroup::get_service_ptrs() const
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
return service_ptrs_;
|
return service_ptrs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<rclcpp::client::ClientBase::WeakPtr> &
|
const std::vector<rclcpp::ClientBase::WeakPtr> &
|
||||||
CallbackGroup::get_client_ptrs() const
|
CallbackGroup::get_client_ptrs() const
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
|
@ -65,28 +65,28 @@ CallbackGroup::type() const
|
||||||
|
|
||||||
void
|
void
|
||||||
CallbackGroup::add_subscription(
|
CallbackGroup::add_subscription(
|
||||||
const rclcpp::subscription::SubscriptionBase::SharedPtr subscription_ptr)
|
const rclcpp::SubscriptionBase::SharedPtr subscription_ptr)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
subscription_ptrs_.push_back(subscription_ptr);
|
subscription_ptrs_.push_back(subscription_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CallbackGroup::add_timer(const rclcpp::timer::TimerBase::SharedPtr timer_ptr)
|
CallbackGroup::add_timer(const rclcpp::TimerBase::SharedPtr timer_ptr)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
timer_ptrs_.push_back(timer_ptr);
|
timer_ptrs_.push_back(timer_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CallbackGroup::add_service(const rclcpp::service::ServiceBase::SharedPtr service_ptr)
|
CallbackGroup::add_service(const rclcpp::ServiceBase::SharedPtr service_ptr)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
service_ptrs_.push_back(service_ptr);
|
service_ptrs_.push_back(service_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CallbackGroup::add_client(const rclcpp::client::ClientBase::SharedPtr client_ptr)
|
CallbackGroup::add_client(const rclcpp::ClientBase::SharedPtr client_ptr)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
client_ptrs_.push_back(client_ptr);
|
client_ptrs_.push_back(client_ptr);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "rclcpp/node_interfaces/node_graph_interface.hpp"
|
#include "rclcpp/node_interfaces/node_graph_interface.hpp"
|
||||||
#include "rclcpp/utilities.hpp"
|
#include "rclcpp/utilities.hpp"
|
||||||
|
|
||||||
using rclcpp::client::ClientBase;
|
using rclcpp::ClientBase;
|
||||||
using rclcpp::exceptions::InvalidNodeError;
|
using rclcpp::exceptions::InvalidNodeError;
|
||||||
using rclcpp::exceptions::throw_from_rcl_error;
|
using rclcpp::exceptions::throw_from_rcl_error;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ ClientBase::wait_for_service_nanoseconds(std::chrono::nanoseconds timeout)
|
||||||
}
|
}
|
||||||
// continue forever if timeout is negative, otherwise continue until out of time_to_wait
|
// continue forever if timeout is negative, otherwise continue until out of time_to_wait
|
||||||
do {
|
do {
|
||||||
if (!rclcpp::utilities::ok()) {
|
if (!rclcpp::ok()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
node_ptr->wait_for_graph_change(event, time_to_wait);
|
node_ptr->wait_for_graph_change(event, time_to_wait);
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
|
|
||||||
#include "rclcpp/context.hpp"
|
#include "rclcpp/context.hpp"
|
||||||
|
|
||||||
using rclcpp::context::Context;
|
using rclcpp::Context;
|
||||||
|
|
||||||
Context::Context() {}
|
Context::Context() {}
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace event
|
|
||||||
{
|
|
||||||
|
|
||||||
Event::Event()
|
Event::Event()
|
||||||
: state_(false) {}
|
: state_(false) {}
|
||||||
|
@ -40,5 +38,4 @@ Event::check_and_clear()
|
||||||
return state_.exchange(false);
|
return state_.exchange(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace event
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
|
@ -50,7 +50,7 @@ Executor::Executor(const ExecutorArgs & args)
|
||||||
// and one for the executor's guard cond (interrupt_guard_condition_)
|
// and one for the executor's guard cond (interrupt_guard_condition_)
|
||||||
|
|
||||||
// Put the global ctrl-c guard condition in
|
// Put the global ctrl-c guard condition in
|
||||||
memory_strategy_->add_guard_condition(rclcpp::utilities::get_sigint_guard_condition(&wait_set_));
|
memory_strategy_->add_guard_condition(rclcpp::get_sigint_guard_condition(&wait_set_));
|
||||||
|
|
||||||
// Put the executor's guard condition in
|
// Put the executor's guard condition in
|
||||||
memory_strategy_->add_guard_condition(&interrupt_guard_condition_);
|
memory_strategy_->add_guard_condition(&interrupt_guard_condition_);
|
||||||
|
@ -97,8 +97,8 @@ Executor::~Executor()
|
||||||
}
|
}
|
||||||
// Remove and release the sigint guard condition
|
// Remove and release the sigint guard condition
|
||||||
memory_strategy_->remove_guard_condition(
|
memory_strategy_->remove_guard_condition(
|
||||||
rclcpp::utilities::get_sigint_guard_condition(&wait_set_));
|
rclcpp::get_sigint_guard_condition(&wait_set_));
|
||||||
rclcpp::utilities::release_sigint_guard_condition(&wait_set_);
|
rclcpp::release_sigint_guard_condition(&wait_set_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -129,7 +129,7 @@ Executor::add_node(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_pt
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Executor::add_node(std::shared_ptr<rclcpp::node::Node> node_ptr, bool notify)
|
Executor::add_node(std::shared_ptr<rclcpp::Node> node_ptr, bool notify)
|
||||||
{
|
{
|
||||||
this->add_node(node_ptr->get_node_base_interface(), notify);
|
this->add_node(node_ptr->get_node_base_interface(), notify);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ Executor::remove_node(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Executor::remove_node(std::shared_ptr<rclcpp::node::Node> node_ptr, bool notify)
|
Executor::remove_node(std::shared_ptr<rclcpp::Node> node_ptr, bool notify)
|
||||||
{
|
{
|
||||||
this->remove_node(node_ptr->get_node_base_interface(), notify);
|
this->remove_node(node_ptr->get_node_base_interface(), notify);
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ Executor::spin_node_some(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr n
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Executor::spin_node_some(std::shared_ptr<rclcpp::node::Node> node)
|
Executor::spin_node_some(std::shared_ptr<rclcpp::Node> node)
|
||||||
{
|
{
|
||||||
this->spin_node_some(node->get_node_base_interface());
|
this->spin_node_some(node->get_node_base_interface());
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ Executor::execute_any_executable(AnyExecutable::SharedPtr any_exec)
|
||||||
|
|
||||||
void
|
void
|
||||||
Executor::execute_subscription(
|
Executor::execute_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription)
|
rclcpp::SubscriptionBase::SharedPtr subscription)
|
||||||
{
|
{
|
||||||
std::shared_ptr<void> message = subscription->create_message();
|
std::shared_ptr<void> message = subscription->create_message();
|
||||||
rmw_message_info_t message_info;
|
rmw_message_info_t message_info;
|
||||||
|
@ -290,7 +290,7 @@ Executor::execute_subscription(
|
||||||
|
|
||||||
void
|
void
|
||||||
Executor::execute_intra_process_subscription(
|
Executor::execute_intra_process_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription)
|
rclcpp::SubscriptionBase::SharedPtr subscription)
|
||||||
{
|
{
|
||||||
rcl_interfaces::msg::IntraProcessMessage ipm;
|
rcl_interfaces::msg::IntraProcessMessage ipm;
|
||||||
rmw_message_info_t message_info;
|
rmw_message_info_t message_info;
|
||||||
|
@ -312,14 +312,14 @@ Executor::execute_intra_process_subscription(
|
||||||
|
|
||||||
void
|
void
|
||||||
Executor::execute_timer(
|
Executor::execute_timer(
|
||||||
rclcpp::timer::TimerBase::SharedPtr timer)
|
rclcpp::TimerBase::SharedPtr timer)
|
||||||
{
|
{
|
||||||
timer->execute_callback();
|
timer->execute_callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Executor::execute_service(
|
Executor::execute_service(
|
||||||
rclcpp::service::ServiceBase::SharedPtr service)
|
rclcpp::ServiceBase::SharedPtr service)
|
||||||
{
|
{
|
||||||
auto request_header = service->create_request_header();
|
auto request_header = service->create_request_header();
|
||||||
std::shared_ptr<void> request = service->create_request();
|
std::shared_ptr<void> request = service->create_request();
|
||||||
|
@ -339,7 +339,7 @@ Executor::execute_service(
|
||||||
|
|
||||||
void
|
void
|
||||||
Executor::execute_client(
|
Executor::execute_client(
|
||||||
rclcpp::client::ClientBase::SharedPtr client)
|
rclcpp::ClientBase::SharedPtr client)
|
||||||
{
|
{
|
||||||
auto request_header = client->create_request_header();
|
auto request_header = client->create_request_header();
|
||||||
std::shared_ptr<void> response = client->create_response();
|
std::shared_ptr<void> response = client->create_response();
|
||||||
|
@ -471,7 +471,7 @@ Executor::get_node_by_group(rclcpp::callback_group::CallbackGroup::SharedPtr gro
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr
|
rclcpp::callback_group::CallbackGroup::SharedPtr
|
||||||
Executor::get_group_by_timer(rclcpp::timer::TimerBase::SharedPtr timer)
|
Executor::get_group_by_timer(rclcpp::TimerBase::SharedPtr timer)
|
||||||
{
|
{
|
||||||
for (auto & weak_node : weak_nodes_) {
|
for (auto & weak_node : weak_nodes_) {
|
||||||
auto node = weak_node.lock();
|
auto node = weak_node.lock();
|
||||||
|
|
|
@ -22,7 +22,7 @@ rclcpp::spin_some(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rclcpp::spin_some(rclcpp::node::Node::SharedPtr node_ptr)
|
rclcpp::spin_some(rclcpp::Node::SharedPtr node_ptr)
|
||||||
{
|
{
|
||||||
rclcpp::spin_some(node_ptr->get_node_base_interface());
|
rclcpp::spin_some(node_ptr->get_node_base_interface());
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ rclcpp::spin(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rclcpp::spin(rclcpp::node::Node::SharedPtr node_ptr)
|
rclcpp::spin(rclcpp::Node::SharedPtr node_ptr)
|
||||||
{
|
{
|
||||||
rclcpp::spin(node_ptr->get_node_base_interface());
|
rclcpp::spin(node_ptr->get_node_base_interface());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "rclcpp/utilities.hpp"
|
#include "rclcpp/utilities.hpp"
|
||||||
#include "rclcpp/scope_exit.hpp"
|
#include "rclcpp/scope_exit.hpp"
|
||||||
|
|
||||||
using rclcpp::executors::multi_threaded_executor::MultiThreadedExecutor;
|
using rclcpp::executors::MultiThreadedExecutor;
|
||||||
|
|
||||||
MultiThreadedExecutor::MultiThreadedExecutor(const rclcpp::executor::ExecutorArgs & args)
|
MultiThreadedExecutor::MultiThreadedExecutor(const rclcpp::executor::ExecutorArgs & args)
|
||||||
: executor::Executor(args)
|
: executor::Executor(args)
|
||||||
|
@ -66,11 +66,11 @@ MultiThreadedExecutor::get_number_of_threads()
|
||||||
void
|
void
|
||||||
MultiThreadedExecutor::run(size_t)
|
MultiThreadedExecutor::run(size_t)
|
||||||
{
|
{
|
||||||
while (rclcpp::utilities::ok() && spinning.load()) {
|
while (rclcpp::ok() && spinning.load()) {
|
||||||
executor::AnyExecutable::SharedPtr any_exec;
|
executor::AnyExecutable::SharedPtr any_exec;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> wait_lock(wait_mutex_);
|
std::lock_guard<std::mutex> wait_lock(wait_mutex_);
|
||||||
if (!rclcpp::utilities::ok() || !spinning.load()) {
|
if (!rclcpp::ok() || !spinning.load()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
any_exec = get_next_executable();
|
any_exec = get_next_executable();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "rclcpp/executors/single_threaded_executor.hpp"
|
#include "rclcpp/executors/single_threaded_executor.hpp"
|
||||||
#include "rclcpp/scope_exit.hpp"
|
#include "rclcpp/scope_exit.hpp"
|
||||||
|
|
||||||
using rclcpp::executors::single_threaded_executor::SingleThreadedExecutor;
|
using rclcpp::executors::SingleThreadedExecutor;
|
||||||
|
|
||||||
SingleThreadedExecutor::SingleThreadedExecutor(const rclcpp::executor::ExecutorArgs & args)
|
SingleThreadedExecutor::SingleThreadedExecutor(const rclcpp::executor::ExecutorArgs & args)
|
||||||
: executor::Executor(args) {}
|
: executor::Executor(args) {}
|
||||||
|
@ -29,7 +29,7 @@ SingleThreadedExecutor::spin()
|
||||||
throw std::runtime_error("spin() called while already spinning");
|
throw std::runtime_error("spin() called while already spinning");
|
||||||
}
|
}
|
||||||
RCLCPP_SCOPE_EXIT(this->spinning.store(false); );
|
RCLCPP_SCOPE_EXIT(this->spinning.store(false); );
|
||||||
while (rclcpp::utilities::ok() && spinning.load()) {
|
while (rclcpp::ok() && spinning.load()) {
|
||||||
auto any_exec = get_next_executable();
|
auto any_exec = get_next_executable();
|
||||||
execute_any_executable(any_exec);
|
execute_any_executable(any_exec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ GraphListener::GraphListener()
|
||||||
throw_from_rcl_error(ret, "failed to create interrupt guard condition");
|
throw_from_rcl_error(ret, "failed to create interrupt guard condition");
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown_guard_condition_ = rclcpp::utilities::get_sigint_guard_condition(&wait_set_);
|
shutdown_guard_condition_ = rclcpp::get_sigint_guard_condition(&wait_set_);
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphListener::~GraphListener()
|
GraphListener::~GraphListener()
|
||||||
|
@ -75,7 +75,7 @@ GraphListener::start_if_not_started()
|
||||||
// This is important to ensure that the wait set is finalized before
|
// This is important to ensure that the wait set is finalized before
|
||||||
// destruction of static objects occurs.
|
// destruction of static objects occurs.
|
||||||
std::weak_ptr<GraphListener> weak_this = shared_from_this();
|
std::weak_ptr<GraphListener> weak_this = shared_from_this();
|
||||||
rclcpp::utilities::on_shutdown(
|
rclcpp::on_shutdown(
|
||||||
[weak_this]() {
|
[weak_this]() {
|
||||||
auto shared_this = weak_this.lock();
|
auto shared_this = weak_this.lock();
|
||||||
if (shared_this) {
|
if (shared_this) {
|
||||||
|
@ -335,7 +335,7 @@ GraphListener::shutdown()
|
||||||
throw_from_rcl_error(ret, "failed to finalize interrupt guard condition");
|
throw_from_rcl_error(ret, "failed to finalize interrupt guard condition");
|
||||||
}
|
}
|
||||||
if (shutdown_guard_condition_) {
|
if (shutdown_guard_condition_) {
|
||||||
rclcpp::utilities::release_sigint_guard_condition(&wait_set_);
|
rclcpp::release_sigint_guard_condition(&wait_set_);
|
||||||
shutdown_guard_condition_ = nullptr;
|
shutdown_guard_condition_ = nullptr;
|
||||||
}
|
}
|
||||||
if (is_started_) {
|
if (is_started_) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ IntraProcessManager::~IntraProcessManager()
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
IntraProcessManager::add_subscription(
|
IntraProcessManager::add_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription)
|
rclcpp::SubscriptionBase::SharedPtr subscription)
|
||||||
{
|
{
|
||||||
auto id = IntraProcessManager::get_next_unique_id();
|
auto id = IntraProcessManager::get_next_unique_id();
|
||||||
impl_->add_subscription(id, subscription);
|
impl_->add_subscription(id, subscription);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
using rclcpp::memory_strategy::MemoryStrategy;
|
using rclcpp::memory_strategy::MemoryStrategy;
|
||||||
|
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr
|
rclcpp::SubscriptionBase::SharedPtr
|
||||||
MemoryStrategy::get_subscription_by_handle(
|
MemoryStrategy::get_subscription_by_handle(
|
||||||
const rcl_subscription_t * subscriber_handle, const WeakNodeVector & weak_nodes)
|
const rcl_subscription_t * subscriber_handle, const WeakNodeVector & weak_nodes)
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ MemoryStrategy::get_subscription_by_handle(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::service::ServiceBase::SharedPtr
|
rclcpp::ServiceBase::SharedPtr
|
||||||
MemoryStrategy::get_service_by_handle(
|
MemoryStrategy::get_service_by_handle(
|
||||||
const rcl_service_t * service_handle,
|
const rcl_service_t * service_handle,
|
||||||
const WeakNodeVector & weak_nodes)
|
const WeakNodeVector & weak_nodes)
|
||||||
|
@ -72,7 +72,7 @@ MemoryStrategy::get_service_by_handle(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::client::ClientBase::SharedPtr
|
rclcpp::ClientBase::SharedPtr
|
||||||
MemoryStrategy::get_client_by_handle(
|
MemoryStrategy::get_client_by_handle(
|
||||||
const rcl_client_t * client_handle,
|
const rcl_client_t * client_handle,
|
||||||
const WeakNodeVector & weak_nodes)
|
const WeakNodeVector & weak_nodes)
|
||||||
|
@ -123,7 +123,7 @@ MemoryStrategy::get_node_by_group(
|
||||||
|
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr
|
rclcpp::callback_group::CallbackGroup::SharedPtr
|
||||||
MemoryStrategy::get_group_by_subscription(
|
MemoryStrategy::get_group_by_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription,
|
rclcpp::SubscriptionBase::SharedPtr subscription,
|
||||||
const WeakNodeVector & weak_nodes)
|
const WeakNodeVector & weak_nodes)
|
||||||
{
|
{
|
||||||
for (auto & weak_node : weak_nodes) {
|
for (auto & weak_node : weak_nodes) {
|
||||||
|
@ -149,7 +149,7 @@ MemoryStrategy::get_group_by_subscription(
|
||||||
|
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr
|
rclcpp::callback_group::CallbackGroup::SharedPtr
|
||||||
MemoryStrategy::get_group_by_service(
|
MemoryStrategy::get_group_by_service(
|
||||||
rclcpp::service::ServiceBase::SharedPtr service,
|
rclcpp::ServiceBase::SharedPtr service,
|
||||||
const WeakNodeVector & weak_nodes)
|
const WeakNodeVector & weak_nodes)
|
||||||
{
|
{
|
||||||
for (auto & weak_node : weak_nodes) {
|
for (auto & weak_node : weak_nodes) {
|
||||||
|
@ -175,7 +175,7 @@ MemoryStrategy::get_group_by_service(
|
||||||
|
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr
|
rclcpp::callback_group::CallbackGroup::SharedPtr
|
||||||
MemoryStrategy::get_group_by_client(
|
MemoryStrategy::get_group_by_client(
|
||||||
rclcpp::client::ClientBase::SharedPtr client,
|
rclcpp::ClientBase::SharedPtr client,
|
||||||
const WeakNodeVector & weak_nodes)
|
const WeakNodeVector & weak_nodes)
|
||||||
{
|
{
|
||||||
for (auto & weak_node : weak_nodes) {
|
for (auto & weak_node : weak_nodes) {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "rclcpp/node_interfaces/node_timers.hpp"
|
#include "rclcpp/node_interfaces/node_timers.hpp"
|
||||||
#include "rclcpp/node_interfaces/node_topics.hpp"
|
#include "rclcpp/node_interfaces/node_topics.hpp"
|
||||||
|
|
||||||
using rclcpp::node::Node;
|
using rclcpp::Node;
|
||||||
using rclcpp::exceptions::throw_from_rcl_error;
|
using rclcpp::exceptions::throw_from_rcl_error;
|
||||||
|
|
||||||
Node::Node(
|
Node::Node(
|
||||||
|
@ -49,7 +49,7 @@ Node::Node(
|
||||||
Node::Node(
|
Node::Node(
|
||||||
const std::string & node_name,
|
const std::string & node_name,
|
||||||
const std::string & namespace_,
|
const std::string & namespace_,
|
||||||
rclcpp::context::Context::SharedPtr context,
|
rclcpp::Context::SharedPtr context,
|
||||||
bool use_intra_process_comms)
|
bool use_intra_process_comms)
|
||||||
: node_base_(new rclcpp::node_interfaces::NodeBase(node_name, namespace_, context)),
|
: node_base_(new rclcpp::node_interfaces::NodeBase(node_name, namespace_, context)),
|
||||||
node_graph_(new rclcpp::node_interfaces::NodeGraph(node_base_.get())),
|
node_graph_(new rclcpp::node_interfaces::NodeGraph(node_base_.get())),
|
||||||
|
@ -190,7 +190,7 @@ Node::get_callback_groups() const
|
||||||
return node_base_->get_callback_groups();
|
return node_base_->get_callback_groups();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::event::Event::SharedPtr
|
rclcpp::Event::SharedPtr
|
||||||
Node::get_graph_event()
|
Node::get_graph_event()
|
||||||
{
|
{
|
||||||
return node_graph_->get_graph_event();
|
return node_graph_->get_graph_event();
|
||||||
|
@ -198,7 +198,7 @@ Node::get_graph_event()
|
||||||
|
|
||||||
void
|
void
|
||||||
Node::wait_for_graph_change(
|
Node::wait_for_graph_change(
|
||||||
rclcpp::event::Event::SharedPtr event,
|
rclcpp::Event::SharedPtr event,
|
||||||
std::chrono::nanoseconds timeout)
|
std::chrono::nanoseconds timeout)
|
||||||
{
|
{
|
||||||
node_graph_->wait_for_graph_change(event, timeout);
|
node_graph_->wait_for_graph_change(event, timeout);
|
||||||
|
|
|
@ -30,7 +30,7 @@ using rclcpp::node_interfaces::NodeBase;
|
||||||
NodeBase::NodeBase(
|
NodeBase::NodeBase(
|
||||||
const std::string & node_name,
|
const std::string & node_name,
|
||||||
const std::string & namespace_,
|
const std::string & namespace_,
|
||||||
rclcpp::context::Context::SharedPtr context)
|
rclcpp::Context::SharedPtr context)
|
||||||
: context_(context),
|
: context_(context),
|
||||||
node_handle_(nullptr),
|
node_handle_(nullptr),
|
||||||
default_callback_group_(nullptr),
|
default_callback_group_(nullptr),
|
||||||
|
@ -176,7 +176,7 @@ NodeBase::get_namespace() const
|
||||||
return rcl_node_get_namespace(node_handle_.get());
|
return rcl_node_get_namespace(node_handle_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::context::Context::SharedPtr
|
rclcpp::Context::SharedPtr
|
||||||
NodeBase::get_context()
|
NodeBase::get_context()
|
||||||
{
|
{
|
||||||
return context_;
|
return context_;
|
||||||
|
|
|
@ -233,7 +233,7 @@ NodeGraph::notify_graph_change()
|
||||||
std::remove_if(
|
std::remove_if(
|
||||||
graph_events_.begin(),
|
graph_events_.begin(),
|
||||||
graph_events_.end(),
|
graph_events_.end(),
|
||||||
[](const rclcpp::event::Event::WeakPtr & wptr) {
|
[](const rclcpp::Event::WeakPtr & wptr) {
|
||||||
return wptr.expired();
|
return wptr.expired();
|
||||||
}),
|
}),
|
||||||
graph_events_.end());
|
graph_events_.end());
|
||||||
|
@ -258,10 +258,10 @@ NodeGraph::notify_shutdown()
|
||||||
graph_cv_.notify_all();
|
graph_cv_.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::event::Event::SharedPtr
|
rclcpp::Event::SharedPtr
|
||||||
NodeGraph::get_graph_event()
|
NodeGraph::get_graph_event()
|
||||||
{
|
{
|
||||||
auto event = rclcpp::event::Event::make_shared();
|
auto event = rclcpp::Event::make_shared();
|
||||||
std::lock_guard<std::mutex> graph_changed_lock(graph_mutex_);
|
std::lock_guard<std::mutex> graph_changed_lock(graph_mutex_);
|
||||||
graph_events_.push_back(event);
|
graph_events_.push_back(event);
|
||||||
graph_users_count_++;
|
graph_users_count_++;
|
||||||
|
@ -275,7 +275,7 @@ NodeGraph::get_graph_event()
|
||||||
|
|
||||||
void
|
void
|
||||||
NodeGraph::wait_for_graph_change(
|
NodeGraph::wait_for_graph_change(
|
||||||
rclcpp::event::Event::SharedPtr event,
|
rclcpp::Event::SharedPtr event,
|
||||||
std::chrono::nanoseconds timeout)
|
std::chrono::nanoseconds timeout)
|
||||||
{
|
{
|
||||||
using rclcpp::exceptions::InvalidEventError;
|
using rclcpp::exceptions::InvalidEventError;
|
||||||
|
@ -297,7 +297,7 @@ NodeGraph::wait_for_graph_change(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto pred = [&event]() {
|
auto pred = [&event]() {
|
||||||
return event->check() || !rclcpp::utilities::ok();
|
return event->check() || !rclcpp::ok();
|
||||||
};
|
};
|
||||||
std::unique_lock<std::mutex> graph_lock(graph_mutex_);
|
std::unique_lock<std::mutex> graph_lock(graph_mutex_);
|
||||||
if (!pred()) {
|
if (!pred()) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ NodeParameters::NodeParameters(
|
||||||
: node_topics_(node_topics)
|
: node_topics_(node_topics)
|
||||||
{
|
{
|
||||||
using MessageT = rcl_interfaces::msg::ParameterEvent;
|
using MessageT = rcl_interfaces::msg::ParameterEvent;
|
||||||
using PublisherT = rclcpp::publisher::Publisher<MessageT>;
|
using PublisherT = rclcpp::Publisher<MessageT>;
|
||||||
using AllocatorT = std::allocator<void>;
|
using AllocatorT = std::allocator<void>;
|
||||||
// TODO(wjwwood): expose this allocator through the Parameter interface.
|
// TODO(wjwwood): expose this allocator through the Parameter interface.
|
||||||
auto allocator = std::make_shared<AllocatorT>();
|
auto allocator = std::make_shared<AllocatorT>();
|
||||||
|
|
|
@ -27,7 +27,7 @@ NodeServices::~NodeServices()
|
||||||
|
|
||||||
void
|
void
|
||||||
NodeServices::add_service(
|
NodeServices::add_service(
|
||||||
rclcpp::service::ServiceBase::SharedPtr service_base_ptr,
|
rclcpp::ServiceBase::SharedPtr service_base_ptr,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
||||||
{
|
{
|
||||||
if (group) {
|
if (group) {
|
||||||
|
@ -54,7 +54,7 @@ NodeServices::add_service(
|
||||||
|
|
||||||
void
|
void
|
||||||
NodeServices::add_client(
|
NodeServices::add_client(
|
||||||
rclcpp::client::ClientBase::SharedPtr client_base_ptr,
|
rclcpp::ClientBase::SharedPtr client_base_ptr,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
||||||
{
|
{
|
||||||
if (group) {
|
if (group) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ NodeTimers::~NodeTimers()
|
||||||
|
|
||||||
void
|
void
|
||||||
NodeTimers::add_timer(
|
NodeTimers::add_timer(
|
||||||
rclcpp::timer::TimerBase::SharedPtr timer,
|
rclcpp::TimerBase::SharedPtr timer,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group)
|
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group)
|
||||||
{
|
{
|
||||||
if (callback_group) {
|
if (callback_group) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ NodeTopics::NodeTopics(rclcpp::node_interfaces::NodeBaseInterface * node_base)
|
||||||
NodeTopics::~NodeTopics()
|
NodeTopics::~NodeTopics()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr
|
rclcpp::PublisherBase::SharedPtr
|
||||||
NodeTopics::create_publisher(
|
NodeTopics::create_publisher(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
const rclcpp::PublisherFactory & publisher_factory,
|
const rclcpp::PublisherFactory & publisher_factory,
|
||||||
|
@ -63,7 +63,7 @@ NodeTopics::create_publisher(
|
||||||
|
|
||||||
void
|
void
|
||||||
NodeTopics::add_publisher(
|
NodeTopics::add_publisher(
|
||||||
rclcpp::publisher::PublisherBase::SharedPtr publisher)
|
rclcpp::PublisherBase::SharedPtr publisher)
|
||||||
{
|
{
|
||||||
// The publisher is not added to a callback group or anthing like that for now.
|
// The publisher is not added to a callback group or anthing like that for now.
|
||||||
// It may be stored within the NodeTopics class or the NodeBase class in the future.
|
// It may be stored within the NodeTopics class or the NodeBase class in the future.
|
||||||
|
@ -79,7 +79,7 @@ NodeTopics::add_publisher(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr
|
rclcpp::SubscriptionBase::SharedPtr
|
||||||
NodeTopics::create_subscription(
|
NodeTopics::create_subscription(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
const rclcpp::SubscriptionFactory & subscription_factory,
|
const rclcpp::SubscriptionFactory & subscription_factory,
|
||||||
|
@ -104,7 +104,7 @@ NodeTopics::create_subscription(
|
||||||
|
|
||||||
void
|
void
|
||||||
NodeTopics::add_subscription(
|
NodeTopics::add_subscription(
|
||||||
rclcpp::subscription::SubscriptionBase::SharedPtr subscription,
|
rclcpp::SubscriptionBase::SharedPtr subscription,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group)
|
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group)
|
||||||
{
|
{
|
||||||
// Assign to a group.
|
// Assign to a group.
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
#include "./parameter_service_names.hpp"
|
#include "./parameter_service_names.hpp"
|
||||||
|
|
||||||
using rclcpp::parameter_client::AsyncParametersClient;
|
using rclcpp::AsyncParametersClient;
|
||||||
using rclcpp::parameter_client::SyncParametersClient;
|
using rclcpp::SyncParametersClient;
|
||||||
|
|
||||||
AsyncParametersClient::AsyncParametersClient(
|
AsyncParametersClient::AsyncParametersClient(
|
||||||
const rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface,
|
const rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface,
|
||||||
|
@ -42,8 +42,8 @@ AsyncParametersClient::AsyncParametersClient(
|
||||||
rcl_client_options_t options = rcl_client_get_default_options();
|
rcl_client_options_t options = rcl_client_get_default_options();
|
||||||
options.qos = qos_profile;
|
options.qos = qos_profile;
|
||||||
|
|
||||||
using rclcpp::client::Client;
|
using rclcpp::Client;
|
||||||
using rclcpp::client::ClientBase;
|
using rclcpp::ClientBase;
|
||||||
|
|
||||||
get_parameters_client_ = Client<rcl_interfaces::srv::GetParameters>::make_shared(
|
get_parameters_client_ = Client<rcl_interfaces::srv::GetParameters>::make_shared(
|
||||||
node_base_interface.get(),
|
node_base_interface.get(),
|
||||||
|
@ -89,7 +89,7 @@ AsyncParametersClient::AsyncParametersClient(
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncParametersClient::AsyncParametersClient(
|
AsyncParametersClient::AsyncParametersClient(
|
||||||
const rclcpp::node::Node::SharedPtr node,
|
const rclcpp::Node::SharedPtr node,
|
||||||
const std::string & remote_node_name,
|
const std::string & remote_node_name,
|
||||||
const rmw_qos_profile_t & qos_profile)
|
const rmw_qos_profile_t & qos_profile)
|
||||||
: AsyncParametersClient(
|
: AsyncParametersClient(
|
||||||
|
@ -102,7 +102,7 @@ AsyncParametersClient::AsyncParametersClient(
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AsyncParametersClient::AsyncParametersClient(
|
AsyncParametersClient::AsyncParametersClient(
|
||||||
rclcpp::node::Node * node,
|
rclcpp::Node * node,
|
||||||
const std::string & remote_node_name,
|
const std::string & remote_node_name,
|
||||||
const rmw_qos_profile_t & qos_profile)
|
const rmw_qos_profile_t & qos_profile)
|
||||||
: AsyncParametersClient(
|
: AsyncParametersClient(
|
||||||
|
@ -131,7 +131,7 @@ AsyncParametersClient::get_parameters(
|
||||||
get_parameters_client_->async_send_request(
|
get_parameters_client_->async_send_request(
|
||||||
request,
|
request,
|
||||||
[request, promise_result, future_result, callback](
|
[request, promise_result, future_result, callback](
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::GetParameters>::SharedFuture cb_f)
|
rclcpp::Client<rcl_interfaces::srv::GetParameters>::SharedFuture cb_f)
|
||||||
{
|
{
|
||||||
std::vector<rclcpp::parameter::ParameterVariant> parameter_variants;
|
std::vector<rclcpp::parameter::ParameterVariant> parameter_variants;
|
||||||
auto & pvalues = cb_f.get()->values;
|
auto & pvalues = cb_f.get()->values;
|
||||||
|
@ -172,7 +172,7 @@ AsyncParametersClient::get_parameter_types(
|
||||||
get_parameter_types_client_->async_send_request(
|
get_parameter_types_client_->async_send_request(
|
||||||
request,
|
request,
|
||||||
[promise_result, future_result, callback](
|
[promise_result, future_result, callback](
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::GetParameterTypes>::SharedFuture cb_f)
|
rclcpp::Client<rcl_interfaces::srv::GetParameterTypes>::SharedFuture cb_f)
|
||||||
{
|
{
|
||||||
std::vector<rclcpp::parameter::ParameterType> types;
|
std::vector<rclcpp::parameter::ParameterType> types;
|
||||||
auto & pts = cb_f.get()->types;
|
auto & pts = cb_f.get()->types;
|
||||||
|
@ -211,7 +211,7 @@ AsyncParametersClient::set_parameters(
|
||||||
set_parameters_client_->async_send_request(
|
set_parameters_client_->async_send_request(
|
||||||
request,
|
request,
|
||||||
[promise_result, future_result, callback](
|
[promise_result, future_result, callback](
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::SetParameters>::SharedFuture cb_f)
|
rclcpp::Client<rcl_interfaces::srv::SetParameters>::SharedFuture cb_f)
|
||||||
{
|
{
|
||||||
promise_result->set_value(cb_f.get()->results);
|
promise_result->set_value(cb_f.get()->results);
|
||||||
if (callback != nullptr) {
|
if (callback != nullptr) {
|
||||||
|
@ -245,7 +245,7 @@ AsyncParametersClient::set_parameters_atomically(
|
||||||
set_parameters_atomically_client_->async_send_request(
|
set_parameters_atomically_client_->async_send_request(
|
||||||
request,
|
request,
|
||||||
[promise_result, future_result, callback](
|
[promise_result, future_result, callback](
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::SetParametersAtomically>::SharedFuture cb_f)
|
rclcpp::Client<rcl_interfaces::srv::SetParametersAtomically>::SharedFuture cb_f)
|
||||||
{
|
{
|
||||||
promise_result->set_value(cb_f.get()->result);
|
promise_result->set_value(cb_f.get()->result);
|
||||||
if (callback != nullptr) {
|
if (callback != nullptr) {
|
||||||
|
@ -276,7 +276,7 @@ AsyncParametersClient::list_parameters(
|
||||||
list_parameters_client_->async_send_request(
|
list_parameters_client_->async_send_request(
|
||||||
request,
|
request,
|
||||||
[promise_result, future_result, callback](
|
[promise_result, future_result, callback](
|
||||||
rclcpp::client::Client<rcl_interfaces::srv::ListParameters>::SharedFuture cb_f)
|
rclcpp::Client<rcl_interfaces::srv::ListParameters>::SharedFuture cb_f)
|
||||||
{
|
{
|
||||||
promise_result->set_value(cb_f.get()->result);
|
promise_result->set_value(cb_f.get()->result);
|
||||||
if (callback != nullptr) {
|
if (callback != nullptr) {
|
||||||
|
@ -302,7 +302,7 @@ AsyncParametersClient::service_is_ready() const
|
||||||
bool
|
bool
|
||||||
AsyncParametersClient::wait_for_service_nanoseconds(std::chrono::nanoseconds timeout)
|
AsyncParametersClient::wait_for_service_nanoseconds(std::chrono::nanoseconds timeout)
|
||||||
{
|
{
|
||||||
const std::vector<std::shared_ptr<rclcpp::client::ClientBase>> clients = {
|
const std::vector<std::shared_ptr<rclcpp::ClientBase>> clients = {
|
||||||
get_parameters_client_,
|
get_parameters_client_,
|
||||||
get_parameter_types_client_,
|
get_parameter_types_client_,
|
||||||
set_parameters_client_,
|
set_parameters_client_,
|
||||||
|
@ -326,7 +326,7 @@ AsyncParametersClient::wait_for_service_nanoseconds(std::chrono::nanoseconds tim
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncParametersClient::SyncParametersClient(
|
SyncParametersClient::SyncParametersClient(
|
||||||
rclcpp::node::Node::SharedPtr node,
|
rclcpp::Node::SharedPtr node,
|
||||||
const std::string & remote_node_name,
|
const std::string & remote_node_name,
|
||||||
const rmw_qos_profile_t & qos_profile)
|
const rmw_qos_profile_t & qos_profile)
|
||||||
: SyncParametersClient(
|
: SyncParametersClient(
|
||||||
|
@ -338,7 +338,7 @@ SyncParametersClient::SyncParametersClient(
|
||||||
|
|
||||||
SyncParametersClient::SyncParametersClient(
|
SyncParametersClient::SyncParametersClient(
|
||||||
rclcpp::executor::Executor::SharedPtr executor,
|
rclcpp::executor::Executor::SharedPtr executor,
|
||||||
rclcpp::node::Node::SharedPtr node,
|
rclcpp::Node::SharedPtr node,
|
||||||
const std::string & remote_node_name,
|
const std::string & remote_node_name,
|
||||||
const rmw_qos_profile_t & qos_profile)
|
const rmw_qos_profile_t & qos_profile)
|
||||||
: executor_(executor), node_(node)
|
: executor_(executor), node_(node)
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
|
|
||||||
#include "./parameter_service_names.hpp"
|
#include "./parameter_service_names.hpp"
|
||||||
|
|
||||||
using rclcpp::parameter_service::ParameterService;
|
using rclcpp::ParameterService;
|
||||||
|
|
||||||
ParameterService::ParameterService(
|
ParameterService::ParameterService(
|
||||||
const rclcpp::node::Node::SharedPtr node,
|
const rclcpp::Node::SharedPtr node,
|
||||||
const rmw_qos_profile_t & qos_profile)
|
const rmw_qos_profile_t & qos_profile)
|
||||||
: node_(node)
|
: node_(node)
|
||||||
{
|
{
|
||||||
std::weak_ptr<rclcpp::node::Node> captured_node = node_;
|
std::weak_ptr<rclcpp::Node> captured_node = node_;
|
||||||
get_parameters_service_ = node_->create_service<rcl_interfaces::srv::GetParameters>(
|
get_parameters_service_ = node_->create_service<rcl_interfaces::srv::GetParameters>(
|
||||||
std::string(node_->get_name()) + "/" + parameter_service_names::get_parameters,
|
std::string(node_->get_name()) + "/" + parameter_service_names::get_parameters,
|
||||||
[captured_node](
|
[captured_node](
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "rclcpp/node.hpp"
|
#include "rclcpp/node.hpp"
|
||||||
#include "rclcpp/expand_topic_or_service_name.hpp"
|
#include "rclcpp/expand_topic_or_service_name.hpp"
|
||||||
|
|
||||||
using rclcpp::publisher::PublisherBase;
|
using rclcpp::PublisherBase;
|
||||||
|
|
||||||
PublisherBase::PublisherBase(
|
PublisherBase::PublisherBase(
|
||||||
rclcpp::node_interfaces::NodeBaseInterface * node_base,
|
rclcpp::node_interfaces::NodeBaseInterface * node_base,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "rmw/error_handling.h"
|
#include "rmw/error_handling.h"
|
||||||
#include "rmw/rmw.h"
|
#include "rmw/rmw.h"
|
||||||
|
|
||||||
using rclcpp::service::ServiceBase;
|
using rclcpp::ServiceBase;
|
||||||
|
|
||||||
ServiceBase::ServiceBase(
|
ServiceBase::ServiceBase(
|
||||||
std::shared_ptr<rcl_node_t> node_handle,
|
std::shared_ptr<rcl_node_t> node_handle,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "rmw/rmw.h"
|
#include "rmw/rmw.h"
|
||||||
|
|
||||||
|
|
||||||
using rclcpp::subscription::SubscriptionBase;
|
using rclcpp::SubscriptionBase;
|
||||||
|
|
||||||
SubscriptionBase::SubscriptionBase(
|
SubscriptionBase::SubscriptionBase(
|
||||||
std::shared_ptr<rcl_node_t> node_handle,
|
std::shared_ptr<rcl_node_t> node_handle,
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
|
|
||||||
TimeSource::TimeSource(std::shared_ptr<rclcpp::node::Node> node)
|
TimeSource::TimeSource(std::shared_ptr<rclcpp::Node> node)
|
||||||
: ros_time_active_(false)
|
: ros_time_active_(false)
|
||||||
{
|
{
|
||||||
this->attachNode(node);
|
this->attachNode(node);
|
||||||
|
@ -44,7 +44,7 @@ TimeSource::TimeSource()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeSource::attachNode(rclcpp::node::Node::SharedPtr node)
|
void TimeSource::attachNode(rclcpp::Node::SharedPtr node)
|
||||||
{
|
{
|
||||||
attachNode(
|
attachNode(
|
||||||
node->get_node_base_interface(),
|
node->get_node_base_interface(),
|
||||||
|
@ -85,7 +85,7 @@ void TimeSource::attachNode(
|
||||||
msg_mem_strat,
|
msg_mem_strat,
|
||||||
allocator);
|
allocator);
|
||||||
|
|
||||||
parameter_client_ = std::make_shared<rclcpp::parameter_client::AsyncParametersClient>(
|
parameter_client_ = std::make_shared<rclcpp::AsyncParametersClient>(
|
||||||
node_base_,
|
node_base_,
|
||||||
node_topics_,
|
node_topics_,
|
||||||
node_graph_,
|
node_graph_,
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using rclcpp::timer::TimerBase;
|
using rclcpp::TimerBase;
|
||||||
|
|
||||||
TimerBase::TimerBase(std::chrono::nanoseconds period)
|
TimerBase::TimerBase(std::chrono::nanoseconds period)
|
||||||
{
|
{
|
||||||
|
|
|
@ -157,7 +157,7 @@ signal_handler(int signal_value)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rclcpp::utilities::init(int argc, char * argv[])
|
rclcpp::init(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
g_is_interrupted.store(false);
|
g_is_interrupted.store(false);
|
||||||
if (rcl_init(argc, argv, rcl_get_default_allocator()) != RCL_RET_OK) {
|
if (rcl_init(argc, argv, rcl_get_default_allocator()) != RCL_RET_OK) {
|
||||||
|
@ -174,14 +174,14 @@ rclcpp::utilities::init(int argc, char * argv[])
|
||||||
action.sa_flags = SA_SIGINFO;
|
action.sa_flags = SA_SIGINFO;
|
||||||
::old_action = set_sigaction(SIGINT, action);
|
::old_action = set_sigaction(SIGINT, action);
|
||||||
// Register an on_shutdown hook to restore the old action.
|
// Register an on_shutdown hook to restore the old action.
|
||||||
rclcpp::utilities::on_shutdown(
|
rclcpp::on_shutdown(
|
||||||
[]() {
|
[]() {
|
||||||
set_sigaction(SIGINT, ::old_action);
|
set_sigaction(SIGINT, ::old_action);
|
||||||
});
|
});
|
||||||
#else
|
#else
|
||||||
::old_signal_handler = set_signal_handler(SIGINT, ::signal_handler);
|
::old_signal_handler = set_signal_handler(SIGINT, ::signal_handler);
|
||||||
// Register an on_shutdown hook to restore the old signal handler.
|
// Register an on_shutdown hook to restore the old signal handler.
|
||||||
rclcpp::utilities::on_shutdown(
|
rclcpp::on_shutdown(
|
||||||
[]() {
|
[]() {
|
||||||
set_signal_handler(SIGINT, ::old_signal_handler);
|
set_signal_handler(SIGINT, ::old_signal_handler);
|
||||||
});
|
});
|
||||||
|
@ -189,7 +189,7 @@ rclcpp::utilities::init(int argc, char * argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
rclcpp::utilities::ok()
|
rclcpp::ok()
|
||||||
{
|
{
|
||||||
return ::g_signal_status == 0;
|
return ::g_signal_status == 0;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ static std::mutex on_shutdown_mutex_;
|
||||||
static std::vector<std::function<void(void)>> on_shutdown_callbacks_;
|
static std::vector<std::function<void(void)>> on_shutdown_callbacks_;
|
||||||
|
|
||||||
void
|
void
|
||||||
rclcpp::utilities::shutdown()
|
rclcpp::shutdown()
|
||||||
{
|
{
|
||||||
trigger_interrupt_guard_condition(SIGINT);
|
trigger_interrupt_guard_condition(SIGINT);
|
||||||
|
|
||||||
|
@ -211,14 +211,14 @@ rclcpp::utilities::shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rclcpp::utilities::on_shutdown(std::function<void(void)> callback)
|
rclcpp::on_shutdown(std::function<void(void)> callback)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(on_shutdown_mutex_);
|
std::lock_guard<std::mutex> lock(on_shutdown_mutex_);
|
||||||
on_shutdown_callbacks_.push_back(callback);
|
on_shutdown_callbacks_.push_back(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
rcl_guard_condition_t *
|
rcl_guard_condition_t *
|
||||||
rclcpp::utilities::get_sigint_guard_condition(rcl_wait_set_t * wait_set)
|
rclcpp::get_sigint_guard_condition(rcl_wait_set_t * wait_set)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(g_sigint_guard_cond_handles_mutex);
|
std::lock_guard<std::mutex> lock(g_sigint_guard_cond_handles_mutex);
|
||||||
auto kv = g_sigint_guard_cond_handles.find(wait_set);
|
auto kv = g_sigint_guard_cond_handles.find(wait_set);
|
||||||
|
@ -240,7 +240,7 @@ rclcpp::utilities::get_sigint_guard_condition(rcl_wait_set_t * wait_set)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rclcpp::utilities::release_sigint_guard_condition(rcl_wait_set_t * wait_set)
|
rclcpp::release_sigint_guard_condition(rcl_wait_set_t * wait_set)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(g_sigint_guard_cond_handles_mutex);
|
std::lock_guard<std::mutex> lock(g_sigint_guard_cond_handles_mutex);
|
||||||
auto kv = g_sigint_guard_cond_handles.find(wait_set);
|
auto kv = g_sigint_guard_cond_handles.find(wait_set);
|
||||||
|
@ -262,7 +262,7 @@ rclcpp::utilities::release_sigint_guard_condition(rcl_wait_set_t * wait_set)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
rclcpp::utilities::sleep_for(const std::chrono::nanoseconds & nanoseconds)
|
rclcpp::sleep_for(const std::chrono::nanoseconds & nanoseconds)
|
||||||
{
|
{
|
||||||
std::chrono::nanoseconds time_left = nanoseconds;
|
std::chrono::nanoseconds time_left = nanoseconds;
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
||||||
|
|
||||||
void SetUp()
|
void SetUp()
|
||||||
{
|
{
|
||||||
node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown()
|
void TearDown()
|
||||||
|
@ -40,7 +40,7 @@ protected:
|
||||||
node.reset();
|
node.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::node::Node::SharedPtr node;
|
rclcpp::Node::SharedPtr node;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
||||||
|
|
||||||
void SetUp()
|
void SetUp()
|
||||||
{
|
{
|
||||||
node = std::make_shared<rclcpp::node::Node>("my_node");
|
node = std::make_shared<rclcpp::Node>("my_node");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown()
|
void TearDown()
|
||||||
|
@ -46,7 +46,7 @@ protected:
|
||||||
node.reset();
|
node.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::node::Node::SharedPtr node;
|
rclcpp::Node::SharedPtr node;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Make sure that executors detach from nodes when destructing
|
// Make sure that executors detach from nodes when destructing
|
||||||
|
|
|
@ -43,7 +43,7 @@ callback(
|
||||||
{}
|
{}
|
||||||
|
|
||||||
TEST_F(TestExternallyDefinedServices, default_behavior) {
|
TEST_F(TestExternallyDefinedServices, default_behavior) {
|
||||||
auto node_handle = rclcpp::node::Node::make_shared("base_node");
|
auto node_handle = rclcpp::Node::make_shared("base_node");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto srv = node_handle->create_service<rclcpp::srv::Mock>("test",
|
auto srv = node_handle->create_service<rclcpp::srv::Mock>("test",
|
||||||
|
@ -57,17 +57,17 @@ TEST_F(TestExternallyDefinedServices, default_behavior) {
|
||||||
|
|
||||||
|
|
||||||
TEST_F(TestExternallyDefinedServices, extern_defined_uninitialized) {
|
TEST_F(TestExternallyDefinedServices, extern_defined_uninitialized) {
|
||||||
auto node_handle = rclcpp::node::Node::make_shared("base_node");
|
auto node_handle = rclcpp::Node::make_shared("base_node");
|
||||||
|
|
||||||
// mock for externally defined service
|
// mock for externally defined service
|
||||||
rcl_service_t service_handle = rcl_get_zero_initialized_service();
|
rcl_service_t service_handle = rcl_get_zero_initialized_service();
|
||||||
|
|
||||||
rclcpp::any_service_callback::AnyServiceCallback<rclcpp::srv::Mock> cb;
|
rclcpp::AnyServiceCallback<rclcpp::srv::Mock> cb;
|
||||||
|
|
||||||
// don't initialize the service
|
// don't initialize the service
|
||||||
// expect fail
|
// expect fail
|
||||||
try {
|
try {
|
||||||
rclcpp::service::Service<rclcpp::srv::Mock>(
|
rclcpp::Service<rclcpp::srv::Mock>(
|
||||||
node_handle->get_node_base_interface()->get_shared_rcl_node_handle(),
|
node_handle->get_node_base_interface()->get_shared_rcl_node_handle(),
|
||||||
&service_handle, cb);
|
&service_handle, cb);
|
||||||
} catch (const std::runtime_error &) {
|
} catch (const std::runtime_error &) {
|
||||||
|
@ -79,7 +79,7 @@ TEST_F(TestExternallyDefinedServices, extern_defined_uninitialized) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestExternallyDefinedServices, extern_defined_initialized) {
|
TEST_F(TestExternallyDefinedServices, extern_defined_initialized) {
|
||||||
auto node_handle = rclcpp::node::Node::make_shared("base_node");
|
auto node_handle = rclcpp::Node::make_shared("base_node");
|
||||||
|
|
||||||
// mock for externally defined service
|
// mock for externally defined service
|
||||||
rcl_service_t service_handle = rcl_get_zero_initialized_service();
|
rcl_service_t service_handle = rcl_get_zero_initialized_service();
|
||||||
|
@ -95,10 +95,10 @@ TEST_F(TestExternallyDefinedServices, extern_defined_initialized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::any_service_callback::AnyServiceCallback<rclcpp::srv::Mock> cb;
|
rclcpp::AnyServiceCallback<rclcpp::srv::Mock> cb;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rclcpp::service::Service<rclcpp::srv::Mock>(
|
rclcpp::Service<rclcpp::srv::Mock>(
|
||||||
node_handle->get_node_base_interface()->get_shared_rcl_node_handle(),
|
node_handle->get_node_base_interface()->get_shared_rcl_node_handle(),
|
||||||
&service_handle, cb);
|
&service_handle, cb);
|
||||||
} catch (const std::runtime_error &) {
|
} catch (const std::runtime_error &) {
|
||||||
|
@ -110,7 +110,7 @@ TEST_F(TestExternallyDefinedServices, extern_defined_initialized) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestExternallyDefinedServices, extern_defined_destructor) {
|
TEST_F(TestExternallyDefinedServices, extern_defined_destructor) {
|
||||||
auto node_handle = rclcpp::node::Node::make_shared("base_node");
|
auto node_handle = rclcpp::Node::make_shared("base_node");
|
||||||
|
|
||||||
// mock for externally defined service
|
// mock for externally defined service
|
||||||
rcl_service_t service_handle = rcl_get_zero_initialized_service();
|
rcl_service_t service_handle = rcl_get_zero_initialized_service();
|
||||||
|
@ -125,11 +125,11 @@ TEST_F(TestExternallyDefinedServices, extern_defined_destructor) {
|
||||||
FAIL();
|
FAIL();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rclcpp::any_service_callback::AnyServiceCallback<rclcpp::srv::Mock> cb;
|
rclcpp::AnyServiceCallback<rclcpp::srv::Mock> cb;
|
||||||
|
|
||||||
{
|
{
|
||||||
// Call constructor
|
// Call constructor
|
||||||
rclcpp::service::Service<rclcpp::srv::Mock> srv_cpp(
|
rclcpp::Service<rclcpp::srv::Mock> srv_cpp(
|
||||||
node_handle->get_node_base_interface()->get_shared_rcl_node_handle(),
|
node_handle->get_node_base_interface()->get_shared_rcl_node_handle(),
|
||||||
&service_handle, cb);
|
&service_handle, cb);
|
||||||
// Call destructor
|
// Call destructor
|
||||||
|
|
|
@ -34,8 +34,8 @@ TEST_F(TestFindWeakNodes, allocator_strategy_with_weak_nodes) {
|
||||||
// A vector of weak pointers to nodes
|
// A vector of weak pointers to nodes
|
||||||
auto memory_strategy = std::make_shared<
|
auto memory_strategy = std::make_shared<
|
||||||
rclcpp::memory_strategies::allocator_memory_strategy::AllocatorMemoryStrategy<>>();
|
rclcpp::memory_strategies::allocator_memory_strategy::AllocatorMemoryStrategy<>>();
|
||||||
auto existing_node = rclcpp::node::Node::make_shared("existing_node");
|
auto existing_node = rclcpp::Node::make_shared("existing_node");
|
||||||
auto dead_node = rclcpp::node::Node::make_shared("dead_node");
|
auto dead_node = rclcpp::Node::make_shared("dead_node");
|
||||||
rclcpp::memory_strategy::MemoryStrategy::WeakNodeVector weak_nodes;
|
rclcpp::memory_strategy::MemoryStrategy::WeakNodeVector weak_nodes;
|
||||||
weak_nodes.push_back(existing_node->get_node_base_interface());
|
weak_nodes.push_back(existing_node->get_node_base_interface());
|
||||||
weak_nodes.push_back(dead_node->get_node_base_interface());
|
weak_nodes.push_back(dead_node->get_node_base_interface());
|
||||||
|
@ -59,8 +59,8 @@ TEST_F(TestFindWeakNodes, allocator_strategy_no_weak_nodes) {
|
||||||
// A vector of weak pointers to nodes, all valid
|
// A vector of weak pointers to nodes, all valid
|
||||||
auto memory_strategy = std::make_shared<
|
auto memory_strategy = std::make_shared<
|
||||||
rclcpp::memory_strategies::allocator_memory_strategy::AllocatorMemoryStrategy<>>();
|
rclcpp::memory_strategies::allocator_memory_strategy::AllocatorMemoryStrategy<>>();
|
||||||
auto existing_node1 = rclcpp::node::Node::make_shared("existing_node1");
|
auto existing_node1 = rclcpp::Node::make_shared("existing_node1");
|
||||||
auto existing_node2 = rclcpp::node::Node::make_shared("existing_node2");
|
auto existing_node2 = rclcpp::Node::make_shared("existing_node2");
|
||||||
rclcpp::memory_strategy::MemoryStrategy::WeakNodeVector weak_nodes;
|
rclcpp::memory_strategy::MemoryStrategy::WeakNodeVector weak_nodes;
|
||||||
weak_nodes.push_back(existing_node1->get_node_base_interface());
|
weak_nodes.push_back(existing_node1->get_node_base_interface());
|
||||||
weak_nodes.push_back(existing_node2->get_node_base_interface());
|
weak_nodes.push_back(existing_node2->get_node_base_interface());
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
// Mock up publisher and subscription base to avoid needing an rmw impl.
|
// Mock up publisher and subscription base to avoid needing an rmw impl.
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace publisher
|
|
||||||
{
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -80,13 +78,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mock
|
} // namespace mock
|
||||||
} // namespace publisher
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
namespace subscription
|
|
||||||
{
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -112,7 +107,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mock
|
} // namespace mock
|
||||||
} // namespace subscription
|
|
||||||
} // namespace rclcpp
|
} // namespace rclcpp
|
||||||
|
|
||||||
// Prevent rclcpp/publisher.hpp and rclcpp/subscription.hpp from being imported.
|
// Prevent rclcpp/publisher.hpp and rclcpp/subscription.hpp from being imported.
|
||||||
|
@ -146,18 +140,18 @@ TEST(TestIntraProcessManager, nominal) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 2;
|
p1->mock_queue_size = 2;
|
||||||
|
|
||||||
auto p2 = std::make_shared<
|
auto p2 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p2->mock_topic_name = "nominal2";
|
p2->mock_topic_name = "nominal2";
|
||||||
p2->mock_queue_size = 10;
|
p2->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -237,12 +231,12 @@ TEST(TestIntraProcessManager, remove_publisher_before_trying_to_take) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 10;
|
p1->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -279,20 +273,20 @@ TEST(TestIntraProcessManager, removed_subscription_affects_take) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 10;
|
p1->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s2 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s2 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s2->mock_topic_name = "nominal1";
|
s2->mock_topic_name = "nominal1";
|
||||||
s2->mock_queue_size = 10;
|
s2->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s3 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s3 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s3->mock_topic_name = "nominal1";
|
s3->mock_topic_name = "nominal1";
|
||||||
s3->mock_queue_size = 10;
|
s3->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -350,20 +344,20 @@ TEST(TestIntraProcessManager, multiple_subscriptions_one_publisher) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 10;
|
p1->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s2 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s2 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s2->mock_topic_name = "nominal1";
|
s2->mock_topic_name = "nominal1";
|
||||||
s2->mock_queue_size = 10;
|
s2->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s3 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s3 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s3->mock_topic_name = "nominal1";
|
s3->mock_topic_name = "nominal1";
|
||||||
s3->mock_queue_size = 10;
|
s3->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -422,24 +416,24 @@ TEST(TestIntraProcessManager, multiple_publishers_one_subscription) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 10;
|
p1->mock_queue_size = 10;
|
||||||
|
|
||||||
auto p2 = std::make_shared<
|
auto p2 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p2->mock_topic_name = "nominal1";
|
p2->mock_topic_name = "nominal1";
|
||||||
p2->mock_queue_size = 10;
|
p2->mock_queue_size = 10;
|
||||||
|
|
||||||
auto p3 = std::make_shared<
|
auto p3 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p3->mock_topic_name = "nominal1";
|
p3->mock_topic_name = "nominal1";
|
||||||
p3->mock_queue_size = 10;
|
p3->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -522,32 +516,32 @@ TEST(TestIntraProcessManager, multiple_publishers_multiple_subscription) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 10;
|
p1->mock_queue_size = 10;
|
||||||
|
|
||||||
auto p2 = std::make_shared<
|
auto p2 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p2->mock_topic_name = "nominal1";
|
p2->mock_topic_name = "nominal1";
|
||||||
p2->mock_queue_size = 10;
|
p2->mock_queue_size = 10;
|
||||||
|
|
||||||
auto p3 = std::make_shared<
|
auto p3 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p3->mock_topic_name = "nominal1";
|
p3->mock_topic_name = "nominal1";
|
||||||
p3->mock_queue_size = 10;
|
p3->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s2 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s2 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s2->mock_topic_name = "nominal1";
|
s2->mock_topic_name = "nominal1";
|
||||||
s2->mock_queue_size = 10;
|
s2->mock_queue_size = 10;
|
||||||
|
|
||||||
auto s3 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s3 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s3->mock_topic_name = "nominal1";
|
s3->mock_topic_name = "nominal1";
|
||||||
s3->mock_queue_size = 10;
|
s3->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -689,12 +683,12 @@ TEST(TestIntraProcessManager, ring_buffer_displacement) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 2;
|
p1->mock_queue_size = 2;
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -760,7 +754,7 @@ TEST(TestIntraProcessManager, subscription_creation_race_condition) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 2;
|
p1->mock_queue_size = 2;
|
||||||
|
@ -778,7 +772,7 @@ TEST(TestIntraProcessManager, subscription_creation_race_condition) {
|
||||||
auto p1_m1_id = ipm.store_intra_process_message(p1_id, unique_msg);
|
auto p1_m1_id = ipm.store_intra_process_message(p1_id, unique_msg);
|
||||||
ASSERT_EQ(nullptr, unique_msg);
|
ASSERT_EQ(nullptr, unique_msg);
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -799,7 +793,7 @@ TEST(TestIntraProcessManager, subscription_creation_race_condition) {
|
||||||
TEST(TestIntraProcessManager, publisher_out_of_scope_take) {
|
TEST(TestIntraProcessManager, publisher_out_of_scope_take) {
|
||||||
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
rclcpp::intra_process_manager::IntraProcessManager ipm;
|
||||||
|
|
||||||
auto s1 = std::make_shared<rclcpp::subscription::mock::SubscriptionBase>();
|
auto s1 = std::make_shared<rclcpp::mock::SubscriptionBase>();
|
||||||
s1->mock_topic_name = "nominal1";
|
s1->mock_topic_name = "nominal1";
|
||||||
s1->mock_queue_size = 10;
|
s1->mock_queue_size = 10;
|
||||||
|
|
||||||
|
@ -809,7 +803,7 @@ TEST(TestIntraProcessManager, publisher_out_of_scope_take) {
|
||||||
uint64_t p1_m1_id;
|
uint64_t p1_m1_id;
|
||||||
{
|
{
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 2;
|
p1->mock_queue_size = 2;
|
||||||
|
@ -848,7 +842,7 @@ TEST(TestIntraProcessManager, publisher_out_of_scope_store) {
|
||||||
uint64_t p1_id;
|
uint64_t p1_id;
|
||||||
{
|
{
|
||||||
auto p1 = std::make_shared<
|
auto p1 = std::make_shared<
|
||||||
rclcpp::publisher::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
rclcpp::mock::Publisher<rcl_interfaces::msg::IntraProcessMessage>
|
||||||
>();
|
>();
|
||||||
p1->mock_topic_name = "nominal1";
|
p1->mock_topic_name = "nominal1";
|
||||||
p1->mock_queue_size = 2;
|
p1->mock_queue_size = 2;
|
||||||
|
|
|
@ -35,40 +35,40 @@ protected:
|
||||||
*/
|
*/
|
||||||
TEST_F(TestNode, construction_and_destruction) {
|
TEST_F(TestNode, construction_and_destruction) {
|
||||||
{
|
{
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ASSERT_THROW({
|
ASSERT_THROW({
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("invalid_node?", "/ns");
|
auto node = std::make_shared<rclcpp::Node>("invalid_node?", "/ns");
|
||||||
}, rclcpp::exceptions::InvalidNodeNameError);
|
}, rclcpp::exceptions::InvalidNodeNameError);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ASSERT_THROW({
|
ASSERT_THROW({
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "/invalid_ns?");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "/invalid_ns?");
|
||||||
}, rclcpp::exceptions::InvalidNamespaceError);
|
}, rclcpp::exceptions::InvalidNamespaceError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestNode, get_name_and_namespace) {
|
TEST_F(TestNode, get_name_and_namespace) {
|
||||||
{
|
{
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
EXPECT_STREQ("my_node", node->get_name());
|
EXPECT_STREQ("my_node", node->get_name());
|
||||||
EXPECT_STREQ("/ns", node->get_namespace());
|
EXPECT_STREQ("/ns", node->get_namespace());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "ns");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "ns");
|
||||||
EXPECT_STREQ("my_node", node->get_name());
|
EXPECT_STREQ("my_node", node->get_name());
|
||||||
EXPECT_STREQ("/ns", node->get_namespace());
|
EXPECT_STREQ("/ns", node->get_namespace());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "/my/ns");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "/my/ns");
|
||||||
EXPECT_STREQ("my_node", node->get_name());
|
EXPECT_STREQ("my_node", node->get_name());
|
||||||
EXPECT_STREQ("/my/ns", node->get_namespace());
|
EXPECT_STREQ("/my/ns", node->get_namespace());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "my/ns");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "my/ns");
|
||||||
EXPECT_STREQ("my_node", node->get_name());
|
EXPECT_STREQ("my_node", node->get_name());
|
||||||
EXPECT_STREQ("/my/ns", node->get_namespace());
|
EXPECT_STREQ("/my/ns", node->get_namespace());
|
||||||
}
|
}
|
||||||
|
@ -77,24 +77,24 @@ TEST_F(TestNode, get_name_and_namespace) {
|
||||||
TEST_F(TestNode, get_logger) {
|
TEST_F(TestNode, get_logger) {
|
||||||
// Currently the namespace is not taken into account with the node logger name
|
// Currently the namespace is not taken into account with the node logger name
|
||||||
{
|
{
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node");
|
auto node = std::make_shared<rclcpp::Node>("my_node");
|
||||||
EXPECT_STREQ("my_node", node->get_logger().get_name());
|
EXPECT_STREQ("my_node", node->get_logger().get_name());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
EXPECT_STREQ("my_node", node->get_logger().get_name());
|
EXPECT_STREQ("my_node", node->get_logger().get_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestNode, get_clock) {
|
TEST_F(TestNode, get_clock) {
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
auto ros_clock = node->get_clock();
|
auto ros_clock = node->get_clock();
|
||||||
EXPECT_TRUE(ros_clock != nullptr);
|
EXPECT_TRUE(ros_clock != nullptr);
|
||||||
EXPECT_EQ(ros_clock->get_clock_type(), RCL_ROS_TIME);
|
EXPECT_EQ(ros_clock->get_clock_type(), RCL_ROS_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestNode, now) {
|
TEST_F(TestNode, now) {
|
||||||
auto node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
auto node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
auto clock = node->get_clock();
|
auto clock = node->get_clock();
|
||||||
auto now_builtin = node->now().nanoseconds();
|
auto now_builtin = node->now().nanoseconds();
|
||||||
auto now_external = clock->now().nanoseconds();
|
auto now_external = clock->now().nanoseconds();
|
||||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
||||||
|
|
||||||
void SetUp()
|
void SetUp()
|
||||||
{
|
{
|
||||||
node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown()
|
void TearDown()
|
||||||
|
@ -40,7 +40,7 @@ protected:
|
||||||
node.reset();
|
node.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::node::Node::SharedPtr node;
|
rclcpp::Node::SharedPtr node;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -28,7 +28,7 @@ TEST(TestRate, rate_basics) {
|
||||||
double overrun_ratio = 1.5;
|
double overrun_ratio = 1.5;
|
||||||
|
|
||||||
auto start = std::chrono::system_clock::now();
|
auto start = std::chrono::system_clock::now();
|
||||||
rclcpp::rate::Rate r(period);
|
rclcpp::Rate r(period);
|
||||||
ASSERT_FALSE(r.is_steady());
|
ASSERT_FALSE(r.is_steady());
|
||||||
ASSERT_TRUE(r.sleep());
|
ASSERT_TRUE(r.sleep());
|
||||||
auto one = std::chrono::system_clock::now();
|
auto one = std::chrono::system_clock::now();
|
||||||
|
@ -36,14 +36,14 @@ TEST(TestRate, rate_basics) {
|
||||||
ASSERT_TRUE(period < delta);
|
ASSERT_TRUE(period < delta);
|
||||||
ASSERT_TRUE(period * overrun_ratio > delta);
|
ASSERT_TRUE(period * overrun_ratio > delta);
|
||||||
|
|
||||||
rclcpp::utilities::sleep_for(offset);
|
rclcpp::sleep_for(offset);
|
||||||
ASSERT_TRUE(r.sleep());
|
ASSERT_TRUE(r.sleep());
|
||||||
auto two = std::chrono::system_clock::now();
|
auto two = std::chrono::system_clock::now();
|
||||||
delta = two - start;
|
delta = two - start;
|
||||||
ASSERT_TRUE(2 * period < delta);
|
ASSERT_TRUE(2 * period < delta);
|
||||||
ASSERT_TRUE(2 * period * overrun_ratio > delta);
|
ASSERT_TRUE(2 * period * overrun_ratio > delta);
|
||||||
|
|
||||||
rclcpp::utilities::sleep_for(offset);
|
rclcpp::sleep_for(offset);
|
||||||
auto two_offset = std::chrono::system_clock::now();
|
auto two_offset = std::chrono::system_clock::now();
|
||||||
r.reset();
|
r.reset();
|
||||||
ASSERT_TRUE(r.sleep());
|
ASSERT_TRUE(r.sleep());
|
||||||
|
@ -52,7 +52,7 @@ TEST(TestRate, rate_basics) {
|
||||||
ASSERT_TRUE(period < delta);
|
ASSERT_TRUE(period < delta);
|
||||||
ASSERT_TRUE(period * overrun_ratio > delta);
|
ASSERT_TRUE(period * overrun_ratio > delta);
|
||||||
|
|
||||||
rclcpp::utilities::sleep_for(offset + period);
|
rclcpp::sleep_for(offset + period);
|
||||||
auto four = std::chrono::system_clock::now();
|
auto four = std::chrono::system_clock::now();
|
||||||
ASSERT_FALSE(r.sleep());
|
ASSERT_FALSE(r.sleep());
|
||||||
auto five = std::chrono::system_clock::now();
|
auto five = std::chrono::system_clock::now();
|
||||||
|
@ -67,7 +67,7 @@ TEST(TestRate, wall_rate_basics) {
|
||||||
double overrun_ratio = 1.5;
|
double overrun_ratio = 1.5;
|
||||||
|
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
rclcpp::rate::WallRate r(period);
|
rclcpp::WallRate r(period);
|
||||||
ASSERT_TRUE(r.is_steady());
|
ASSERT_TRUE(r.is_steady());
|
||||||
ASSERT_TRUE(r.sleep());
|
ASSERT_TRUE(r.sleep());
|
||||||
auto one = std::chrono::steady_clock::now();
|
auto one = std::chrono::steady_clock::now();
|
||||||
|
@ -75,14 +75,14 @@ TEST(TestRate, wall_rate_basics) {
|
||||||
ASSERT_TRUE(period < delta);
|
ASSERT_TRUE(period < delta);
|
||||||
ASSERT_TRUE(period * overrun_ratio > delta);
|
ASSERT_TRUE(period * overrun_ratio > delta);
|
||||||
|
|
||||||
rclcpp::utilities::sleep_for(offset);
|
rclcpp::sleep_for(offset);
|
||||||
ASSERT_TRUE(r.sleep());
|
ASSERT_TRUE(r.sleep());
|
||||||
auto two = std::chrono::steady_clock::now();
|
auto two = std::chrono::steady_clock::now();
|
||||||
delta = two - start;
|
delta = two - start;
|
||||||
ASSERT_TRUE(2 * period < delta + epsilon);
|
ASSERT_TRUE(2 * period < delta + epsilon);
|
||||||
ASSERT_TRUE(2 * period * overrun_ratio > delta);
|
ASSERT_TRUE(2 * period * overrun_ratio > delta);
|
||||||
|
|
||||||
rclcpp::utilities::sleep_for(offset);
|
rclcpp::sleep_for(offset);
|
||||||
auto two_offset = std::chrono::steady_clock::now();
|
auto two_offset = std::chrono::steady_clock::now();
|
||||||
r.reset();
|
r.reset();
|
||||||
ASSERT_TRUE(r.sleep());
|
ASSERT_TRUE(r.sleep());
|
||||||
|
@ -91,7 +91,7 @@ TEST(TestRate, wall_rate_basics) {
|
||||||
ASSERT_TRUE(period < delta);
|
ASSERT_TRUE(period < delta);
|
||||||
ASSERT_TRUE(period * overrun_ratio > delta);
|
ASSERT_TRUE(period * overrun_ratio > delta);
|
||||||
|
|
||||||
rclcpp::utilities::sleep_for(offset + period);
|
rclcpp::sleep_for(offset + period);
|
||||||
auto four = std::chrono::steady_clock::now();
|
auto four = std::chrono::steady_clock::now();
|
||||||
ASSERT_FALSE(r.sleep());
|
ASSERT_FALSE(r.sleep());
|
||||||
auto five = std::chrono::steady_clock::now();
|
auto five = std::chrono::steady_clock::now();
|
||||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
||||||
|
|
||||||
void SetUp()
|
void SetUp()
|
||||||
{
|
{
|
||||||
node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown()
|
void TearDown()
|
||||||
|
@ -40,7 +40,7 @@ protected:
|
||||||
node.reset();
|
node.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::node::Node::SharedPtr node;
|
rclcpp::Node::SharedPtr node;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
||||||
|
|
||||||
void SetUp()
|
void SetUp()
|
||||||
{
|
{
|
||||||
node = std::make_shared<rclcpp::node::Node>("my_node", "/ns");
|
node = std::make_shared<rclcpp::Node>("my_node", "/ns");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown()
|
void TearDown()
|
||||||
|
@ -40,7 +40,7 @@ protected:
|
||||||
node.reset();
|
node.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::node::Node::SharedPtr node;
|
rclcpp::Node::SharedPtr node;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -39,7 +39,7 @@ protected:
|
||||||
|
|
||||||
void SetUp()
|
void SetUp()
|
||||||
{
|
{
|
||||||
node = std::make_shared<rclcpp::node::Node>("my_node");
|
node = std::make_shared<rclcpp::Node>("my_node");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown()
|
void TearDown()
|
||||||
|
@ -47,7 +47,7 @@ protected:
|
||||||
node.reset();
|
node.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::node::Node::SharedPtr node;
|
rclcpp::Node::SharedPtr node;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ TEST_F(TestTimeSource, callbacks) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void trigger_clock_changes(
|
void trigger_clock_changes(
|
||||||
rclcpp::node::Node::SharedPtr node)
|
rclcpp::Node::SharedPtr node)
|
||||||
{
|
{
|
||||||
auto clock_pub = node->create_publisher<builtin_interfaces::msg::Time>("clock",
|
auto clock_pub = node->create_publisher<builtin_interfaces::msg::Time>("clock",
|
||||||
rmw_qos_profile_default);
|
rmw_qos_profile_default);
|
||||||
|
@ -334,8 +334,8 @@ TEST_F(TestTimeSource, parameter_activation) {
|
||||||
ts.attachClock(ros_clock);
|
ts.attachClock(ros_clock);
|
||||||
EXPECT_FALSE(ros_clock->ros_time_is_active());
|
EXPECT_FALSE(ros_clock->ros_time_is_active());
|
||||||
|
|
||||||
auto parameter_service = std::make_shared<rclcpp::parameter_service::ParameterService>(node);
|
auto parameter_service = std::make_shared<rclcpp::ParameterService>(node);
|
||||||
auto parameters_client = std::make_shared<rclcpp::parameter_client::SyncParametersClient>(node);
|
auto parameters_client = std::make_shared<rclcpp::SyncParametersClient>(node);
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
EXPECT_TRUE(parameters_client->wait_for_service(2s));
|
EXPECT_TRUE(parameters_client->wait_for_service(2s));
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
const std::string & namespace_ = "",
|
const std::string & namespace_ = "",
|
||||||
bool use_intra_process_comms = false);
|
bool use_intra_process_comms = false);
|
||||||
|
|
||||||
/// Create a node based on the node name and a rclcpp::context::Context.
|
/// Create a node based on the node name and a rclcpp::Context.
|
||||||
/**
|
/**
|
||||||
* \param[in] node_name Name of the node.
|
* \param[in] node_name Name of the node.
|
||||||
* \param[in] node_name Namespace of the node.
|
* \param[in] node_name Namespace of the node.
|
||||||
|
@ -95,7 +95,7 @@ public:
|
||||||
LifecycleNode(
|
LifecycleNode(
|
||||||
const std::string & node_name,
|
const std::string & node_name,
|
||||||
const std::string & namespace_,
|
const std::string & namespace_,
|
||||||
rclcpp::context::Context::SharedPtr context,
|
rclcpp::Context::SharedPtr context,
|
||||||
bool use_intra_process_comms = false);
|
bool use_intra_process_comms = false);
|
||||||
|
|
||||||
RCLCPP_LIFECYCLE_PUBLIC
|
RCLCPP_LIFECYCLE_PUBLIC
|
||||||
|
@ -172,7 +172,7 @@ public:
|
||||||
typename MessageT,
|
typename MessageT,
|
||||||
typename CallbackT,
|
typename CallbackT,
|
||||||
typename Alloc = std::allocator<void>,
|
typename Alloc = std::allocator<void>,
|
||||||
typename SubscriptionT = rclcpp::subscription::Subscription<MessageT, Alloc>>
|
typename SubscriptionT = rclcpp::Subscription<MessageT, Alloc>>
|
||||||
std::shared_ptr<SubscriptionT>
|
std::shared_ptr<SubscriptionT>
|
||||||
create_subscription(
|
create_subscription(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
|
@ -202,7 +202,7 @@ public:
|
||||||
typename MessageT,
|
typename MessageT,
|
||||||
typename CallbackT,
|
typename CallbackT,
|
||||||
typename Alloc = std::allocator<void>,
|
typename Alloc = std::allocator<void>,
|
||||||
typename SubscriptionT = rclcpp::subscription::Subscription<MessageT, Alloc>>
|
typename SubscriptionT = rclcpp::Subscription<MessageT, Alloc>>
|
||||||
std::shared_ptr<SubscriptionT>
|
std::shared_ptr<SubscriptionT>
|
||||||
create_subscription(
|
create_subscription(
|
||||||
const std::string & topic_name,
|
const std::string & topic_name,
|
||||||
|
@ -221,7 +221,7 @@ public:
|
||||||
* \param[in] group Callback group to execute this timer's callback in.
|
* \param[in] group Callback group to execute this timer's callback in.
|
||||||
*/
|
*/
|
||||||
template<typename DurationT = std::milli, typename CallbackT>
|
template<typename DurationT = std::milli, typename CallbackT>
|
||||||
typename rclcpp::timer::WallTimer<CallbackT>::SharedPtr
|
typename rclcpp::WallTimer<CallbackT>::SharedPtr
|
||||||
create_wall_timer(
|
create_wall_timer(
|
||||||
std::chrono::duration<int64_t, DurationT> period,
|
std::chrono::duration<int64_t, DurationT> period,
|
||||||
CallbackT callback,
|
CallbackT callback,
|
||||||
|
@ -229,7 +229,7 @@ public:
|
||||||
|
|
||||||
/* Create and return a Client. */
|
/* Create and return a Client. */
|
||||||
template<typename ServiceT>
|
template<typename ServiceT>
|
||||||
typename rclcpp::client::Client<ServiceT>::SharedPtr
|
typename rclcpp::Client<ServiceT>::SharedPtr
|
||||||
create_client(
|
create_client(
|
||||||
const std::string & service_name,
|
const std::string & service_name,
|
||||||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_services_default,
|
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_services_default,
|
||||||
|
@ -237,7 +237,7 @@ public:
|
||||||
|
|
||||||
/* Create and return a Service. */
|
/* Create and return a Service. */
|
||||||
template<typename ServiceT, typename CallbackT>
|
template<typename ServiceT, typename CallbackT>
|
||||||
typename rclcpp::service::Service<ServiceT>::SharedPtr
|
typename rclcpp::Service<ServiceT>::SharedPtr
|
||||||
create_service(
|
create_service(
|
||||||
const std::string & service_name,
|
const std::string & service_name,
|
||||||
CallbackT && callback,
|
CallbackT && callback,
|
||||||
|
@ -313,7 +313,7 @@ public:
|
||||||
* out of scope.
|
* out of scope.
|
||||||
*/
|
*/
|
||||||
RCLCPP_LIFECYCLE_PUBLIC
|
RCLCPP_LIFECYCLE_PUBLIC
|
||||||
rclcpp::event::Event::SharedPtr
|
rclcpp::Event::SharedPtr
|
||||||
get_graph_event();
|
get_graph_event();
|
||||||
|
|
||||||
/// Wait for a graph event to occur by waiting on an Event to become set.
|
/// Wait for a graph event to occur by waiting on an Event to become set.
|
||||||
|
@ -326,7 +326,7 @@ public:
|
||||||
RCLCPP_LIFECYCLE_PUBLIC
|
RCLCPP_LIFECYCLE_PUBLIC
|
||||||
void
|
void
|
||||||
wait_for_graph_change(
|
wait_for_graph_change(
|
||||||
rclcpp::event::Event::SharedPtr event,
|
rclcpp::Event::SharedPtr event,
|
||||||
std::chrono::nanoseconds timeout);
|
std::chrono::nanoseconds timeout);
|
||||||
|
|
||||||
RCLCPP_LIFECYCLE_PUBLIC
|
RCLCPP_LIFECYCLE_PUBLIC
|
||||||
|
@ -480,7 +480,7 @@ protected:
|
||||||
|
|
||||||
RCLCPP_LIFECYCLE_PUBLIC
|
RCLCPP_LIFECYCLE_PUBLIC
|
||||||
void
|
void
|
||||||
add_timer_handle(std::shared_ptr<rclcpp::timer::TimerBase> timer);
|
add_timer_handle(std::shared_ptr<rclcpp::TimerBase> timer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RCLCPP_DISABLE_COPY(LifecycleNode)
|
RCLCPP_DISABLE_COPY(LifecycleNode)
|
||||||
|
|
|
@ -90,7 +90,7 @@ LifecycleNode::create_subscription(
|
||||||
|
|
||||||
return rclcpp::create_subscription<
|
return rclcpp::create_subscription<
|
||||||
MessageT, CallbackT, Alloc,
|
MessageT, CallbackT, Alloc,
|
||||||
rclcpp::subscription::Subscription<MessageT, Alloc>>(
|
rclcpp::Subscription<MessageT, Alloc>>(
|
||||||
this->node_topics_.get(),
|
this->node_topics_.get(),
|
||||||
topic_name,
|
topic_name,
|
||||||
std::forward<CallbackT>(callback),
|
std::forward<CallbackT>(callback),
|
||||||
|
@ -131,13 +131,13 @@ LifecycleNode::create_subscription(
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename DurationT, typename CallbackT>
|
template<typename DurationT, typename CallbackT>
|
||||||
typename rclcpp::timer::WallTimer<CallbackT>::SharedPtr
|
typename rclcpp::WallTimer<CallbackT>::SharedPtr
|
||||||
LifecycleNode::create_wall_timer(
|
LifecycleNode::create_wall_timer(
|
||||||
std::chrono::duration<int64_t, DurationT> period,
|
std::chrono::duration<int64_t, DurationT> period,
|
||||||
CallbackT callback,
|
CallbackT callback,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
||||||
{
|
{
|
||||||
auto timer = rclcpp::timer::WallTimer<CallbackT>::make_shared(
|
auto timer = rclcpp::WallTimer<CallbackT>::make_shared(
|
||||||
std::chrono::duration_cast<std::chrono::nanoseconds>(period),
|
std::chrono::duration_cast<std::chrono::nanoseconds>(period),
|
||||||
std::move(callback));
|
std::move(callback));
|
||||||
node_timers_->add_timer(timer, group);
|
node_timers_->add_timer(timer, group);
|
||||||
|
@ -145,7 +145,7 @@ LifecycleNode::create_wall_timer(
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceT>
|
template<typename ServiceT>
|
||||||
typename rclcpp::client::Client<ServiceT>::SharedPtr
|
typename rclcpp::Client<ServiceT>::SharedPtr
|
||||||
LifecycleNode::create_client(
|
LifecycleNode::create_client(
|
||||||
const std::string & service_name,
|
const std::string & service_name,
|
||||||
const rmw_qos_profile_t & qos_profile,
|
const rmw_qos_profile_t & qos_profile,
|
||||||
|
@ -154,8 +154,8 @@ LifecycleNode::create_client(
|
||||||
rcl_client_options_t options = rcl_client_get_default_options();
|
rcl_client_options_t options = rcl_client_get_default_options();
|
||||||
options.qos = qos_profile;
|
options.qos = qos_profile;
|
||||||
|
|
||||||
using rclcpp::client::Client;
|
using rclcpp::Client;
|
||||||
using rclcpp::client::ClientBase;
|
using rclcpp::ClientBase;
|
||||||
|
|
||||||
auto cli = Client<ServiceT>::make_shared(
|
auto cli = Client<ServiceT>::make_shared(
|
||||||
node_base_.get(),
|
node_base_.get(),
|
||||||
|
@ -169,23 +169,23 @@ LifecycleNode::create_client(
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceT, typename CallbackT>
|
template<typename ServiceT, typename CallbackT>
|
||||||
typename rclcpp::service::Service<ServiceT>::SharedPtr
|
typename rclcpp::Service<ServiceT>::SharedPtr
|
||||||
LifecycleNode::create_service(
|
LifecycleNode::create_service(
|
||||||
const std::string & service_name,
|
const std::string & service_name,
|
||||||
CallbackT && callback,
|
CallbackT && callback,
|
||||||
const rmw_qos_profile_t & qos_profile,
|
const rmw_qos_profile_t & qos_profile,
|
||||||
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
rclcpp::callback_group::CallbackGroup::SharedPtr group)
|
||||||
{
|
{
|
||||||
rclcpp::service::AnyServiceCallback<ServiceT> any_service_callback;
|
rclcpp::AnyServiceCallback<ServiceT> any_service_callback;
|
||||||
any_service_callback.set(std::forward<CallbackT>(callback));
|
any_service_callback.set(std::forward<CallbackT>(callback));
|
||||||
|
|
||||||
rcl_service_options_t service_options = rcl_service_get_default_options();
|
rcl_service_options_t service_options = rcl_service_get_default_options();
|
||||||
service_options.qos = qos_profile;
|
service_options.qos = qos_profile;
|
||||||
|
|
||||||
auto serv = rclcpp::service::Service<ServiceT>::make_shared(
|
auto serv = rclcpp::Service<ServiceT>::make_shared(
|
||||||
node_base_->get_shared_rcl_node_handle(),
|
node_base_->get_shared_rcl_node_handle(),
|
||||||
service_name, any_service_callback, service_options);
|
service_name, any_service_callback, service_options);
|
||||||
auto serv_base_ptr = std::dynamic_pointer_cast<rclcpp::service::ServiceBase>(serv);
|
auto serv_base_ptr = std::dynamic_pointer_cast<rclcpp::ServiceBase>(serv);
|
||||||
node_services_->add_service(serv_base_ptr, group);
|
node_services_->add_service(serv_base_ptr, group);
|
||||||
return serv;
|
return serv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
*/
|
*/
|
||||||
template<typename MessageT, typename Alloc = std::allocator<void>>
|
template<typename MessageT, typename Alloc = std::allocator<void>>
|
||||||
class LifecyclePublisher : public LifecyclePublisherInterface,
|
class LifecyclePublisher : public LifecyclePublisherInterface,
|
||||||
public rclcpp::publisher::Publisher<MessageT, Alloc>
|
public rclcpp::Publisher<MessageT, Alloc>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using MessageAllocTraits = rclcpp::allocator::AllocRebind<MessageT, Alloc>;
|
using MessageAllocTraits = rclcpp::allocator::AllocRebind<MessageT, Alloc>;
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
const std::string & topic,
|
const std::string & topic,
|
||||||
const rcl_publisher_options_t & publisher_options,
|
const rcl_publisher_options_t & publisher_options,
|
||||||
std::shared_ptr<MessageAlloc> allocator)
|
std::shared_ptr<MessageAlloc> allocator)
|
||||||
: rclcpp::publisher::Publisher<MessageT, Alloc>(
|
: rclcpp::Publisher<MessageT, Alloc>(
|
||||||
node_base, topic, publisher_options, allocator),
|
node_base, topic, publisher_options, allocator),
|
||||||
enabled_(false)
|
enabled_(false)
|
||||||
{}
|
{}
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
if (!enabled_) {
|
if (!enabled_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rclcpp::publisher::Publisher<MessageT, Alloc>::publish(msg);
|
rclcpp::Publisher<MessageT, Alloc>::publish(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// LifecyclePublisher publish function
|
/// LifecyclePublisher publish function
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
if (!enabled_) {
|
if (!enabled_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rclcpp::publisher::Publisher<MessageT, Alloc>::publish(msg);
|
rclcpp::Publisher<MessageT, Alloc>::publish(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// LifecyclePublisher publish function
|
/// LifecyclePublisher publish function
|
||||||
|
@ -107,7 +107,7 @@ public:
|
||||||
if (!enabled_) {
|
if (!enabled_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rclcpp::publisher::Publisher<MessageT, Alloc>::publish(msg);
|
rclcpp::Publisher<MessageT, Alloc>::publish(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// LifecyclePublisher publish function
|
/// LifecyclePublisher publish function
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
if (!enabled_) {
|
if (!enabled_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rclcpp::publisher::Publisher<MessageT, Alloc>::publish(msg);
|
rclcpp::Publisher<MessageT, Alloc>::publish(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
|
@ -146,7 +146,7 @@ public:
|
||||||
if (!enabled_) {
|
if (!enabled_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rclcpp::publisher::Publisher<MessageT, Alloc>::publish(msg);
|
rclcpp::Publisher<MessageT, Alloc>::publish(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
|
|
|
@ -55,7 +55,7 @@ LifecycleNode::LifecycleNode(
|
||||||
LifecycleNode::LifecycleNode(
|
LifecycleNode::LifecycleNode(
|
||||||
const std::string & node_name,
|
const std::string & node_name,
|
||||||
const std::string & namespace_,
|
const std::string & namespace_,
|
||||||
rclcpp::context::Context::SharedPtr context,
|
rclcpp::Context::SharedPtr context,
|
||||||
bool use_intra_process_comms)
|
bool use_intra_process_comms)
|
||||||
: node_base_(new rclcpp::node_interfaces::NodeBase(node_name, namespace_, context)),
|
: node_base_(new rclcpp::node_interfaces::NodeBase(node_name, namespace_, context)),
|
||||||
node_graph_(new rclcpp::node_interfaces::NodeGraph(node_base_.get())),
|
node_graph_(new rclcpp::node_interfaces::NodeGraph(node_base_.get())),
|
||||||
|
@ -209,7 +209,7 @@ LifecycleNode::get_callback_groups() const
|
||||||
return node_base_->get_callback_groups();
|
return node_base_->get_callback_groups();
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::event::Event::SharedPtr
|
rclcpp::Event::SharedPtr
|
||||||
LifecycleNode::get_graph_event()
|
LifecycleNode::get_graph_event()
|
||||||
{
|
{
|
||||||
return node_graph_->get_graph_event();
|
return node_graph_->get_graph_event();
|
||||||
|
@ -217,7 +217,7 @@ LifecycleNode::get_graph_event()
|
||||||
|
|
||||||
void
|
void
|
||||||
LifecycleNode::wait_for_graph_change(
|
LifecycleNode::wait_for_graph_change(
|
||||||
rclcpp::event::Event::SharedPtr event,
|
rclcpp::Event::SharedPtr event,
|
||||||
std::chrono::nanoseconds timeout)
|
std::chrono::nanoseconds timeout)
|
||||||
{
|
{
|
||||||
node_graph_->wait_for_graph_change(event, timeout);
|
node_graph_->wait_for_graph_change(event, timeout);
|
||||||
|
@ -449,7 +449,7 @@ LifecycleNode::add_publisher_handle(
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LifecycleNode::add_timer_handle(std::shared_ptr<rclcpp::timer::TimerBase> timer)
|
LifecycleNode::add_timer_handle(std::shared_ptr<rclcpp::TimerBase> timer)
|
||||||
{
|
{
|
||||||
impl_->add_timer_handle(timer);
|
impl_->add_timer_handle(timer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,61 +104,61 @@ public:
|
||||||
{ // change_state
|
{ // change_state
|
||||||
auto cb = std::bind(&LifecycleNodeInterfaceImpl::on_change_state, this,
|
auto cb = std::bind(&LifecycleNodeInterfaceImpl::on_change_state, this,
|
||||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||||
rclcpp::any_service_callback::AnyServiceCallback<ChangeStateSrv> any_cb;
|
rclcpp::AnyServiceCallback<ChangeStateSrv> any_cb;
|
||||||
any_cb.set(std::move(cb));
|
any_cb.set(std::move(cb));
|
||||||
|
|
||||||
srv_change_state_ = std::make_shared<rclcpp::service::Service<ChangeStateSrv>>(
|
srv_change_state_ = std::make_shared<rclcpp::Service<ChangeStateSrv>>(
|
||||||
node_base_interface_->get_shared_rcl_node_handle(),
|
node_base_interface_->get_shared_rcl_node_handle(),
|
||||||
&state_machine_.com_interface.srv_change_state,
|
&state_machine_.com_interface.srv_change_state,
|
||||||
any_cb);
|
any_cb);
|
||||||
node_services_interface_->add_service(
|
node_services_interface_->add_service(
|
||||||
std::dynamic_pointer_cast<rclcpp::service::ServiceBase>(srv_change_state_),
|
std::dynamic_pointer_cast<rclcpp::ServiceBase>(srv_change_state_),
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // get_state
|
{ // get_state
|
||||||
auto cb = std::bind(&LifecycleNodeInterfaceImpl::on_get_state, this,
|
auto cb = std::bind(&LifecycleNodeInterfaceImpl::on_get_state, this,
|
||||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||||
rclcpp::any_service_callback::AnyServiceCallback<GetStateSrv> any_cb;
|
rclcpp::AnyServiceCallback<GetStateSrv> any_cb;
|
||||||
any_cb.set(std::move(cb));
|
any_cb.set(std::move(cb));
|
||||||
|
|
||||||
srv_get_state_ = std::make_shared<rclcpp::service::Service<GetStateSrv>>(
|
srv_get_state_ = std::make_shared<rclcpp::Service<GetStateSrv>>(
|
||||||
node_base_interface_->get_shared_rcl_node_handle(),
|
node_base_interface_->get_shared_rcl_node_handle(),
|
||||||
&state_machine_.com_interface.srv_get_state,
|
&state_machine_.com_interface.srv_get_state,
|
||||||
any_cb);
|
any_cb);
|
||||||
node_services_interface_->add_service(
|
node_services_interface_->add_service(
|
||||||
std::dynamic_pointer_cast<rclcpp::service::ServiceBase>(srv_get_state_),
|
std::dynamic_pointer_cast<rclcpp::ServiceBase>(srv_get_state_),
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // get_available_states
|
{ // get_available_states
|
||||||
auto cb = std::bind(&LifecycleNodeInterfaceImpl::on_get_available_states, this,
|
auto cb = std::bind(&LifecycleNodeInterfaceImpl::on_get_available_states, this,
|
||||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||||
rclcpp::any_service_callback::AnyServiceCallback<GetAvailableStatesSrv> any_cb;
|
rclcpp::AnyServiceCallback<GetAvailableStatesSrv> any_cb;
|
||||||
any_cb.set(std::move(cb));
|
any_cb.set(std::move(cb));
|
||||||
|
|
||||||
srv_get_available_states_ = std::make_shared<rclcpp::service::Service<GetAvailableStatesSrv>>(
|
srv_get_available_states_ = std::make_shared<rclcpp::Service<GetAvailableStatesSrv>>(
|
||||||
node_base_interface_->get_shared_rcl_node_handle(),
|
node_base_interface_->get_shared_rcl_node_handle(),
|
||||||
&state_machine_.com_interface.srv_get_available_states,
|
&state_machine_.com_interface.srv_get_available_states,
|
||||||
any_cb);
|
any_cb);
|
||||||
node_services_interface_->add_service(
|
node_services_interface_->add_service(
|
||||||
std::dynamic_pointer_cast<rclcpp::service::ServiceBase>(srv_get_available_states_),
|
std::dynamic_pointer_cast<rclcpp::ServiceBase>(srv_get_available_states_),
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // get_available_transitions
|
{ // get_available_transitions
|
||||||
auto cb = std::bind(&LifecycleNodeInterfaceImpl::on_get_available_transitions, this,
|
auto cb = std::bind(&LifecycleNodeInterfaceImpl::on_get_available_transitions, this,
|
||||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||||
rclcpp::any_service_callback::AnyServiceCallback<GetAvailableTransitionsSrv> any_cb;
|
rclcpp::AnyServiceCallback<GetAvailableTransitionsSrv> any_cb;
|
||||||
any_cb.set(std::move(cb));
|
any_cb.set(std::move(cb));
|
||||||
|
|
||||||
srv_get_available_transitions_ =
|
srv_get_available_transitions_ =
|
||||||
std::make_shared<rclcpp::service::Service<GetAvailableTransitionsSrv>>(
|
std::make_shared<rclcpp::Service<GetAvailableTransitionsSrv>>(
|
||||||
node_base_interface_->get_shared_rcl_node_handle(),
|
node_base_interface_->get_shared_rcl_node_handle(),
|
||||||
&state_machine_.com_interface.srv_get_available_transitions,
|
&state_machine_.com_interface.srv_get_available_transitions,
|
||||||
any_cb);
|
any_cb);
|
||||||
node_services_interface_->add_service(
|
node_services_interface_->add_service(
|
||||||
std::dynamic_pointer_cast<rclcpp::service::ServiceBase>(srv_get_available_transitions_),
|
std::dynamic_pointer_cast<rclcpp::ServiceBase>(srv_get_available_transitions_),
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,7 +391,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_timer_handle(std::shared_ptr<rclcpp::timer::TimerBase> timer)
|
add_timer_handle(std::shared_ptr<rclcpp::TimerBase> timer)
|
||||||
{
|
{
|
||||||
weak_timers_.push_back(timer);
|
weak_timers_.push_back(timer);
|
||||||
}
|
}
|
||||||
|
@ -404,12 +404,12 @@ public:
|
||||||
|
|
||||||
using NodeBasePtr = std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>;
|
using NodeBasePtr = std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>;
|
||||||
using NodeServicesPtr = std::shared_ptr<rclcpp::node_interfaces::NodeServicesInterface>;
|
using NodeServicesPtr = std::shared_ptr<rclcpp::node_interfaces::NodeServicesInterface>;
|
||||||
using ChangeStateSrvPtr = std::shared_ptr<rclcpp::service::Service<ChangeStateSrv>>;
|
using ChangeStateSrvPtr = std::shared_ptr<rclcpp::Service<ChangeStateSrv>>;
|
||||||
using GetStateSrvPtr = std::shared_ptr<rclcpp::service::Service<GetStateSrv>>;
|
using GetStateSrvPtr = std::shared_ptr<rclcpp::Service<GetStateSrv>>;
|
||||||
using GetAvailableStatesSrvPtr =
|
using GetAvailableStatesSrvPtr =
|
||||||
std::shared_ptr<rclcpp::service::Service<GetAvailableStatesSrv>>;
|
std::shared_ptr<rclcpp::Service<GetAvailableStatesSrv>>;
|
||||||
using GetAvailableTransitionsSrvPtr =
|
using GetAvailableTransitionsSrvPtr =
|
||||||
std::shared_ptr<rclcpp::service::Service<GetAvailableTransitionsSrv>>;
|
std::shared_ptr<rclcpp::Service<GetAvailableTransitionsSrv>>;
|
||||||
|
|
||||||
NodeBasePtr node_base_interface_;
|
NodeBasePtr node_base_interface_;
|
||||||
NodeServicesPtr node_services_interface_;
|
NodeServicesPtr node_services_interface_;
|
||||||
|
@ -420,7 +420,7 @@ public:
|
||||||
|
|
||||||
// to controllable things
|
// to controllable things
|
||||||
std::vector<std::weak_ptr<rclcpp_lifecycle::LifecyclePublisherInterface>> weak_pubs_;
|
std::vector<std::weak_ptr<rclcpp_lifecycle::LifecyclePublisherInterface>> weak_pubs_;
|
||||||
std::vector<std::weak_ptr<rclcpp::timer::TimerBase>> weak_timers_;
|
std::vector<std::weak_ptr<rclcpp::TimerBase>> weak_timers_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rclcpp_lifecycle
|
} // namespace rclcpp_lifecycle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue