9 #include <rclcpp/rclcpp.hpp> 10 #include <rosgraph_msgs/msg/clock.hpp> 11 #include <websocketpp/common/connection_hdl.hpp> 16 #include <foxglove_bridge/param_utils.hpp> 36 FoxgloveBridge(
const rclcpp::NodeOptions& options = rclcpp::NodeOptions());
43 const std::map<std::string, std::vector<std::string>>& topicNamesAndTypes);
48 const std::map<std::string, std::vector<std::string>>& topicNamesAndTypes);
52 template <
class T1,
class T2>
53 std::size_t
operator()(
const std::pair<T1, T2>& pair)
const {
54 return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
58 std::unique_ptr<foxglove::ServerInterface<ConnectionHandle>>
_server;
63 std::unordered_map<foxglove::ChannelId, foxglove::ChannelWithoutId>
_advertisedTopics;
65 std::unordered_map<foxglove::ChannelId, SubscriptionsByClient>
_subscriptions;
67 std::unordered_map<foxglove::ServiceId, GenericClient::SharedPtr>
_serviceClients;
95 void setParameters(
const std::vector<foxglove::Parameter>& parameters,
98 void getParameters(
const std::vector<std::string>& parameters,
109 std::shared_ptr<rclcpp::SerializedMessage> msg);
std::unique_ptr< std::thread > _rosgraphPollThread
rclcpp::GenericPublisher::SharedPtr Publication
std::unordered_map< foxglove::ServiceId, foxglove::ServiceWithoutId > _advertisedServices
void updateAdvertisedServices()
foxglove::MessageDefinitionCache _messageDefinitionCache
std::vector< std::regex > _serviceWhitelistPatterns
std::vector< std::string > _capabilities
void getParameters(const std::vector< std::string > ¶meters, const std::optional< std::string > &requestId, ConnectionHandle hdl)
void rosgraphPollThread()
void unsubscribe(foxglove::ChannelId channelId, ConnectionHandle clientHandle)
virtual ~FoxgloveBridge()
std::size_t operator()(const std::pair< T1, T2 > &pair) const
void subscribe(foxglove::ChannelId channelId, ConnectionHandle clientHandle)
bool hasCapability(const std::string &capability)
std::pair< std::string, std::string > TopicAndDatatype
void subscribeParameters(const std::vector< std::string > ¶meters, foxglove::ParameterSubscriptionOperation op, ConnectionHandle)
void updateAdvertisedTopics()
rclcpp::CallbackGroup::SharedPtr _clientPublishCallbackGroup
rclcpp::CallbackGroup::SharedPtr _subscriptionCallbackGroup
void setParameters(const std::vector< foxglove::Parameter > ¶meters, const std::optional< std::string > &requestId, ConnectionHandle hdl)
std::unordered_map< foxglove::ChannelId, SubscriptionsByClient > _subscriptions
PublicationsByClient _clientAdvertisedTopics
void subscribeConnectionGraph(bool subscribe)
void logHandler(foxglove::WebSocketLogLevel level, char const *msg)
void clientMessage(const foxglove::ClientMessage &clientMsg, ConnectionHandle clientHandle)
void updateConnectionGraph(const std::map< std::string, std::vector< std::string >> &topicNamesAndTypes)
std::map< ConnectionHandle, ClientPublications, std::owner_less<> > PublicationsByClient
std::map< ConnectionHandle, ros::Subscriber, std::owner_less<> > SubscriptionsByClient
void parameterUpdates(XmlRpc::XmlRpcValue ¶ms, XmlRpc::XmlRpcValue &result)
std::mutex _servicesMutex
rclcpp::CallbackGroup::SharedPtr _servicesCallbackGroup
constexpr int64_t DEFAULT_MAX_QOS_DEPTH
std::mutex _subscriptionsMutex
ParameterSubscriptionOperation
void serviceRequest(const foxglove::ServiceRequest &request, ConnectionHandle clientHandle)
rclcpp::GenericSubscription::SharedPtr Subscription
websocketpp::connection_hdl ConnectionHandle
std::shared_ptr< rclcpp::Subscription< rosgraph_msgs::msg::Clock > > _clockSubscription
std::vector< std::regex > _topicWhitelistPatterns
std::unordered_map< foxglove::ChannelId, foxglove::ChannelWithoutId > _advertisedTopics
std::unordered_map< foxglove::ClientChannelId, ros::Publisher > ClientPublications
std::unique_ptr< foxglove::ServerInterface< ConnectionHandle > > _server
void rosMessageHandler(const foxglove::ChannelId channelId, ConnectionHandle clientHandle, const ros::MessageEvent< ros_babel_fish::BabelFishMessage const > &msgEvent)
void clientUnadvertise(foxglove::ClientChannelId channelId, ConnectionHandle clientHandle)
std::shared_ptr< ParameterInterface > _paramInterface
void clientAdvertise(const foxglove::ClientAdvertisement &channel, ConnectionHandle clientHandle)
std::unordered_map< foxglove::ServiceId, GenericClient::SharedPtr > _serviceClients
constexpr int64_t DEFAULT_MIN_QOS_DEPTH
std::atomic< bool > _subscribeGraphUpdates
std::mutex _clientAdvertisementsMutex