Skip to content

Commit

Permalink
Bump to C++14.
Browse files Browse the repository at this point in the history
Fixed topic containing the transport.
Improved load balancing to image transport for throttled cameras.
Will now update new subscriptions as quickly as possible (as long as no scheduled camera is currently updated).
Subscription moved to background thread to reduce load on UI thread.
  • Loading branch information
StefanFabian committed Jun 2, 2021
1 parent 6e12825 commit c8215f7
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 93 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10)
project(qml_ros_plugin)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)

add_definitions(-Wall -Wextra)

Expand Down
13 changes: 5 additions & 8 deletions include/qml_ros_plugin/image_transport_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ImageTransportManager

struct SubscriptionManager;
class Subscription;
class LoadBalancer;
public:

static ImageTransportManager &getInstance();
Expand Down Expand Up @@ -64,12 +65,8 @@ class ImageTransportManager
int throttle_interval = 0 );

private:
int getLoadBalancedTimeout( int desired_throttle_interval );

std::map<std::string, std::shared_ptr<SubscriptionManager>> subscriptions_;
std::vector<long> timeouts_;
std::mutex load_balancer_mutex_;
bool load_balancing_enabled_ = true;
std::unique_ptr<LoadBalancer> load_balancer_;

friend class ImageTransportSubscriptionHandle;
};
Expand All @@ -80,11 +77,11 @@ class ImageTransportSubscriptionHandle

~ImageTransportSubscriptionHandle();

//! The interval the subscription waits between receiving images.
//! The interval in ms the subscription waits between receiving images.
int throttleInterval() const { return throttle_interval; }

//! Set the interval the subscription may wait between images.
//! The images may still arrive at a higher rate if other subscriptions_ request it.
//! Set the interval in ms the subscription may wait between images.
//! The images may still arrive at a higher rate if other subscriptions request it.
void updateThrottleInterval( int interval );

std::string getTopic();
Expand Down

0 comments on commit c8215f7

Please sign in to comment.