Skip to content

Commit

Permalink
Merge pull request #12 from etienn8/feat/persistent_service_client_re…
Browse files Browse the repository at this point in the history
…factor

Feat/persistent service client refactor
  • Loading branch information
etienn8 authored Jun 20, 2024
2 parents 66fec4f + 928e136 commit d5fef74
Show file tree
Hide file tree
Showing 15 changed files with 107 additions and 104 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ jobs:
repository: etienn8/rosparam_utils
path: 'catkin_ws/src/rosparam_utils'

- name: Checkout ros_boosted_utilities
uses: actions/checkout@v4
with:
repository: etienn8/ros_boosted_utilities
path: 'catkin_ws/src/ros_boosted_utilities'

- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ Here's a procedure on how to get started with the configurations and the launchi
- [ros_queue_msgs](https://github.com/etienn8/ros_queuing_system/tree/main/ros_queue_msgs) (ROS messages and services used as interface for the ros_queuing system, included already in the ros_queuing_system repo).
- [ros_queue_msgs](https://github.com/etienn8/ros_queuing_system/tree/main/ros_queue_msgs) (Implementation examples and dummy stochastic services to test the system, included already in the ros_queuing_system repo).
- [rosparam_utils](https://github.com/etienn8/rosparam_utils) (Tools to fetch rosparams more easily. Not directly dependent but some dependent packages need it).
- [ros_boosted_utilities](https://github.com/etienn8/ros_boosted_utilities) (Contains persistent ROS service clients to make the interfaces between the system faster.)
##### Optional
- [Catkin tools](https://catkin-tools.readthedocs.io/en/latest/#)(Tools to help build all the packages in parallel and to test the system)
- Follow their [installation](https://catkin-tools.readthedocs.io/en/latest/installing.html) and [initialization](https://catkin-tools.readthedocs.io/en/latest/quick_start.html) guide before building this package.


#### Building

To build from source, clone the [rosparam_utils](https://github.com/etienn8/rosparam_utils) repo, clone the latest version from this repository into your catkin workspace and compile all the packages using
To build from source, clone the [rosparam_utils](https://github.com/etienn8/rosparam_utils), clone the [ros_boosted_utilities](https://github.com/etienn8/ros_boosted_utilities) repo, clone the latest version from this repository into your catkin workspace and compile all the packages using

cd catkin_workspace/src
git clone https://github.com/etienn8/rosparam_utils.git
git clone https://github.com/etienn8/ros_boosted_utilities.git
git clone https://github.com/etienn8/ros_queuing_system.git
cd ../
rosdep install --from-paths . --ignore-src
Expand Down
3 changes: 2 additions & 1 deletion queue_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ find_package(catkin REQUIRED COMPONENTS
actionlib
std_srvs
std_msgs
ros_boosted_utilities
)

## System dependencies are found with CMake's conventions
Expand Down Expand Up @@ -109,7 +110,7 @@ find_package(catkin REQUIRED COMPONENTS
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
INCLUDE_DIRS include ${ros_boosted_utilities_INCLUDE_DIRS}
LIBRARIES queue_controller_utils_lib
CATKIN_DEPENDS queue_server ros_queue_msgs roscpp message_runtime std_srvs std_msgs actionlib_msgs actionlib
# DEPENDS system_lib
Expand Down
1 change: 1 addition & 0 deletions queue_controller/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ This is research code, expect that it changes often and any fitness for a partic
- [message_runtime](http://wiki.ros.org/message_runtime) (ROS message dependencies package),
- [actionlib_msgs](http://wiki.ros.org/actionlib_msgs) (Message definitions of the actionlib package used for the output of the controller),
- [actionlib](http://wiki.ros.org/actionlib) (Interfaces that gives a result and feedback for an action. Used by the output of the controller),
- [ros_boosted_utilities](https://github.com/etienn8/ros_boosted_utilities) (Contains persistent ROS service clients to make the interfaces between the system faster.)
- [std_srvs](http://wiki.ros.org/std_srvs) (ROS standard service definitions),
- [std_msgs](http://wiki.ros.org/std_msgs) (ROS standard service definitions),
- std::map (Standard library for C++ dictionnaries),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@

#include "ros/ros.h"

#include "ros_queue_msgs/FloatRequest.h"

#include "ros_boosted_utilities/persistent_service_client.hpp"

using std::string;

/**
* @brief Structure that contains all the necessary parameters about a queue that the controller
* needs to evaluate its changes and compute the best action.
*/
template <typename TMetricControlPredictionSrv>
struct ControllerQueueStruct
{
/**
Expand Down Expand Up @@ -58,28 +63,28 @@ struct ControllerQueueStruct
* of the system and a given potential action. Should not be defined if arrival_based_on_queue_size_service_
* is used. If both are defined, expected_arrival_service_ will be used.
*/
ros::ServiceClient expected_arrival_service_;
PersistentServiceClient<TMetricControlPredictionSrv> expected_arrival_service_;

/**
* @brief ROS Service used to compute the expected departures of a queue based on a the current state
* of the system and a given potential action. Should not be defined if departure_based_on_queue_size_service_
* is used. If both are defined, expected_arrival_service_ will be used.
*/
ros::ServiceClient expected_departure_service_;
PersistentServiceClient<TMetricControlPredictionSrv> expected_departure_service_;

/**
* @brief ROS Service used to get a a metric thas is independant from the action. Should not be defined
* if expected_arrival_service_ is used. If both are defined, expected_arrival_service_ will be used.
* @details Since it uses a different service definition compared to expected_arrival_service_ because
* the latter uses a potential action as an input, arrival_independant_from_action_service_ need to be created.
*/
ros::ServiceClient arrival_independent_from_action_service_;
PersistentServiceClient<ros_queue_msgs::FloatRequest> arrival_independent_from_action_service_;

/**
* @brief ROS Service used to get a current queue size if it's used as the departure metric. Should not be defined
* if expected_departure_service_ is used. If both are defined, expected_departure_service_ will be used.
* @details Since it uses a different service definition compared to expected_departure_service_ because
* the latter uses a potential action as an input, departure_independant_from_action_service_ need to be created.
*/
ros::ServiceClient departure_independent_from_action_service_;
PersistentServiceClient<ros_queue_msgs::FloatRequest> departure_independent_from_action_service_;
};
Loading

0 comments on commit d5fef74

Please sign in to comment.