├── .gitignore
├── ros_babel_fish_test_msgs
├── msg
│ ├── TestSubArray.msg
│ ├── TestArray.msg
│ └── TestMessage.msg
├── action
│ └── SimpleTest.action
├── package.xml
├── CHANGELOG.rst
└── CMakeLists.txt
├── ros_babel_fish
├── test
│ ├── test_message.test
│ ├── test_message_lookup.test
│ ├── test_service_lookup.test
│ ├── test_message_decoding.test
│ ├── test_message_encoding.test
│ ├── test_message_extractor.test
│ ├── test_action_client.test
│ ├── test_service_client.test
│ ├── all_tests.test
│ ├── service_client_test_services.cpp
│ ├── service_client.cpp
│ ├── action_client_test_server.cpp
│ ├── action_client.cpp
│ ├── common.h
│ ├── message_extractor.cpp
│ └── service_lookup.cpp
├── include
│ └── ros_babel_fish
│ │ ├── message_types.h
│ │ ├── exceptions
│ │ ├── babel_fish_exception.h
│ │ ├── invalid_location_exception.h
│ │ ├── invalid_template_exception.h
│ │ └── invalid_message_path_exception.h
│ │ ├── generation
│ │ ├── message_creation.h
│ │ ├── message_template.h
│ │ ├── providers
│ │ │ ├── integrated_description_provider.h
│ │ │ └── message_only_description_provider.h
│ │ └── description_provider.h
│ │ ├── message_description.h
│ │ ├── actionlib
│ │ ├── babel_fish_action.h
│ │ ├── babel_fish_action_result.h
│ │ ├── babel_fish_action_feedback.h
│ │ └── babel_fish_action_goal.h
│ │ ├── messages
│ │ ├── compound_message.h
│ │ ├── internal
│ │ │ └── value_compatibility.h
│ │ └── value_message.h
│ │ ├── macros.h
│ │ ├── message_extractor.h
│ │ ├── babel_fish.h
│ │ └── babel_fish_message.h
├── examples
│ ├── service_client.cpp
│ ├── service_server.cpp
│ ├── message_info.cpp
│ ├── action_client.cpp
│ ├── service_info.cpp
│ ├── any_publisher.cpp
│ ├── rosbag_frame_ids.cpp
│ ├── troll_node.cpp
│ └── any_subscriber.cpp
├── package.xml
├── src
│ ├── babel_fish_message.cpp
│ ├── generation
│ │ ├── message_creation.cpp
│ │ └── providers
│ │ │ └── integrated_description_provider.cpp
│ ├── messages
│ │ └── value_message.cpp
│ ├── babel_fish.cpp
│ └── message.cpp
├── CHANGELOG.rst
└── CMakeLists.txt
├── .codecov.yml
├── LICENSE
├── .travis.yml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vscode/
3 | cmake-build-debug/
4 | cmake-build-release/
5 |
--------------------------------------------------------------------------------
/ros_babel_fish_test_msgs/msg/TestSubArray.msg:
--------------------------------------------------------------------------------
1 | int32[] ints
2 | string[] strings
3 | time[42] times
--------------------------------------------------------------------------------
/ros_babel_fish/test/test_message.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/ros_babel_fish_test_msgs/action/SimpleTest.action:
--------------------------------------------------------------------------------
1 | # goal
2 | int32 goal
3 | ---
4 | # result
5 | int32 result
6 | ---
7 | # feedback
8 | int32 feedback
--------------------------------------------------------------------------------
/ros_babel_fish/test/test_message_lookup.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/ros_babel_fish/test/test_service_lookup.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/ros_babel_fish/test/test_message_decoding.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/ros_babel_fish/test/test_message_encoding.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/ros_babel_fish/test/test_message_extractor.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.codecov.yml:
--------------------------------------------------------------------------------
1 | codecov:
2 | require_ci_to_pass: yes
3 |
4 | coverage:
5 | precision: 2
6 | round: down
7 |
8 | ignore:
9 | - "devel"
10 | - "ros_babel_fish/test"
11 |
--------------------------------------------------------------------------------
/ros_babel_fish/test/test_action_client.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ros_babel_fish/test/test_service_client.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ros_babel_fish_test_msgs/msg/TestArray.msg:
--------------------------------------------------------------------------------
1 | bool[] bools
2 | uint8[] uint8s
3 | uint16[32] uint16s
4 | uint32[] uint32s
5 | uint64[] uint64s
6 | int8[] int8s
7 | int16[] int16s
8 | int32[] int32s
9 | int64[32] int64s#Comment
10 | float32[] float32s
11 | float64[16] float64s
12 | time[] times
13 | duration[12] durations
14 | string[] strings
15 | TestSubArray[10] subarrays_fixed
16 | TestSubArray[] subarrays
17 |
18 |
--------------------------------------------------------------------------------
/ros_babel_fish_test_msgs/msg/TestMessage.msg:
--------------------------------------------------------------------------------
1 | Header header
2 | bool b
3 | uint8 ui8
4 | uint16 ui16
5 | uint32 ui32
6 | uint64 ui64
7 | int8 i8
8 | int16 i16
9 | int32 i32
10 |
11 | int64 i64
12 | float32 f32 # Comment
13 | float64 f64#Also a comment but closer
14 | string str## Two comment signs # and a third
15 | time t
16 | duration d
17 | geometry_msgs/Point[] point_arr # more comment
18 |
19 | bool FLAG1 =1
20 | bool FLAG2= 0
21 | bool FLAG3=True
22 | bool FLAG4 = False
23 |
--------------------------------------------------------------------------------
/ros_babel_fish/include/ros_babel_fish/message_types.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #ifndef ROS_BABEL_FISH_MESSAGE_TYPES_H
5 | #define ROS_BABEL_FISH_MESSAGE_TYPES_H
6 |
7 | #include "ros_babel_fish/messages/array_message.h"
8 | #include "ros_babel_fish/messages/compound_message.h"
9 | #include "ros_babel_fish/messages/value_message.h"
10 |
11 | #endif //ROS_BABEL_FISH_MESSAGE_TYPES_H
12 |
--------------------------------------------------------------------------------
/ros_babel_fish_test_msgs/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ros_babel_fish_test_msgs
4 | 0.9.3
5 | Test messages for the ros_babel_fish project tests.
6 |
7 | Stefan Fabian
8 |
9 | MIT
10 |
11 | catkin
12 |
13 | message_generation
14 | message_runtime
15 | actionlib_msgs
16 | std_msgs
17 | geometry_msgs
18 |
19 |
--------------------------------------------------------------------------------
/ros_babel_fish/test/all_tests.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ros_babel_fish/include/ros_babel_fish/exceptions/babel_fish_exception.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #ifndef ROS_BABEL_FISH_BABEL_FISH_EXCEPTION_H
5 | #define ROS_BABEL_FISH_BABEL_FISH_EXCEPTION_H
6 |
7 | #include
8 |
9 | namespace ros_babel_fish
10 | {
11 |
12 | class BabelFishException : public ros::Exception
13 | {
14 | public:
15 | explicit BabelFishException( const std::string &msg ) : ros::Exception( msg ) { }
16 | };
17 | } // ros_babel_fish
18 |
19 | #endif //ROS_BABEL_FISH_BABEL_FISH_EXCEPTION_H
20 |
--------------------------------------------------------------------------------
/ros_babel_fish/include/ros_babel_fish/exceptions/invalid_location_exception.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #ifndef ROS_BABEL_FISH_INVALID_LOCATION_EXCEPTION_H
5 | #define ROS_BABEL_FISH_INVALID_LOCATION_EXCEPTION_H
6 |
7 | #include "babel_fish_exception.h"
8 |
9 | namespace ros_babel_fish
10 | {
11 |
12 | class InvalidLocationException : public BabelFishException
13 | {
14 | public:
15 | explicit InvalidLocationException( const std::string &msg ) : BabelFishException( msg ) { }
16 | };
17 | } // ros_babel_fish
18 |
19 | #endif // ROS_BABEL_FISH_INVALID_LOCATION_EXCEPTION_H
20 |
--------------------------------------------------------------------------------
/ros_babel_fish/include/ros_babel_fish/exceptions/invalid_template_exception.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #ifndef ROS_BABEL_FISH_INVALID_TEMPLATE_EXCEPTION_H
5 | #define ROS_BABEL_FISH_INVALID_TEMPLATE_EXCEPTION_H
6 |
7 | #include "babel_fish_exception.h"
8 |
9 | namespace ros_babel_fish
10 | {
11 |
12 | class InvalidTemplateException : public BabelFishException
13 | {
14 | public:
15 | explicit InvalidTemplateException( const std::string &msg ) : BabelFishException( msg ) { }
16 | };
17 | } // ros_babel_fish
18 |
19 | #endif // ROS_BABEL_FISH_INVALID_TEMPLATE_EXCEPTION_H
20 |
--------------------------------------------------------------------------------
/ros_babel_fish/include/ros_babel_fish/exceptions/invalid_message_path_exception.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #ifndef ROS_BABEL_FISH_INVALID_MESSAGE_PATH_EXCEPTION_H
5 | #define ROS_BABEL_FISH_INVALID_MESSAGE_PATH_EXCEPTION_H
6 |
7 | #include "babel_fish_exception.h"
8 |
9 | namespace ros_babel_fish
10 | {
11 |
12 | class InvalidMessagePathException : public BabelFishException
13 | {
14 | public:
15 | explicit InvalidMessagePathException( const std::string &msg ) : BabelFishException( msg ) { }
16 | };
17 | } // ros_babel_fish
18 |
19 | #endif // ROS_BABEL_FISH_INVALID_MESSAGE_PATH_EXCEPTION_H
20 |
--------------------------------------------------------------------------------
/ros_babel_fish/include/ros_babel_fish/generation/message_creation.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #ifndef ROS_BABEL_FISH_MESSAGE_CREATION_H
5 | #define ROS_BABEL_FISH_MESSAGE_CREATION_H
6 |
7 | #include "ros_babel_fish/message.h"
8 | #include "message_template.h"
9 |
10 | namespace ros_babel_fish
11 | {
12 |
13 | Message::Ptr createValueMessageFromData( MessageType type, const uint8_t *stream, size_t &bytes_read );
14 |
15 | Message::Ptr createMessageFromTemplate( const MessageTemplate::ConstPtr &msg_template, const uint8_t *stream, size_t length,
16 | size_t &bytes_read );
17 |
18 | Message::Ptr createEmptyMessageFromTemplate( const MessageTemplate::ConstPtr &msg_template );
19 | } // ros_babel_fish
20 |
21 | #endif //ROS_BABEL_FISH_MESSAGE_CREATION_H
22 |
--------------------------------------------------------------------------------
/ros_babel_fish/examples/service_client.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | using namespace ros_babel_fish;
9 |
10 | int main( int argc, char **argv )
11 | {
12 | ros::init( argc, argv, "ros_babel_fish_any_service_client" );
13 | ros::NodeHandle nh;
14 |
15 | BabelFish fish;
16 | Message::Ptr req = fish.createServiceRequest( "roscpp_tutorials/TwoInts" );
17 | req->as()["a"] = 314;
18 | (*req)["b"] = 1337;
19 | TranslatedMessage::Ptr res;
20 | std::cout << "Call result: " << fish.callService( "/ros_babel_fish/service", req, res ) << std::endl;
21 | std::cout << "Response:" << std::endl;
22 | std::cout << " sum: " << res->translated_message->as()["sum"].value() << std::endl;
23 | }
24 |
--------------------------------------------------------------------------------
/ros_babel_fish/examples/service_server.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | using namespace ros_babel_fish;
9 |
10 | int main( int argc, char **argv )
11 | {
12 | ros::init( argc, argv, "ros_babel_fish_any_service_server" );
13 | ros::NodeHandle nh;
14 |
15 | BabelFish fish;
16 |
17 | ros::ServiceServer server = fish.advertiseService(
18 | nh, "roscpp_tutorials/TwoInts", "/ros_babel_fish/service",
19 | []( Message &req, Message &res ) -> bool
20 | {
21 | auto &msg = req.as();
22 | std::cout << "Received request: " << std::endl;
23 | std::cout << "a: " << msg["a"].value() << std::endl;
24 | std::cout << "b: " << msg["b"].value() << std::endl;
25 | res["sum"] = 42;
26 | return true;
27 | } );
28 | ros::spin();
29 | }
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Stefan Fabian
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/ros_babel_fish/include/ros_babel_fish/message_description.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #ifndef ROS_BABEL_FISH_MESSAGE_DESCRIPTION_H
5 | #define ROS_BABEL_FISH_MESSAGE_DESCRIPTION_H
6 |
7 | #include "ros_babel_fish/generation/message_template.h"
8 |
9 | namespace ros_babel_fish
10 | {
11 |
12 | struct MessageDescription
13 | {
14 | typedef std::shared_ptr Ptr;
15 | typedef std::shared_ptr ConstPtr;
16 |
17 | std::string datatype;
18 | std::string md5;
19 | std::string message_definition;
20 | std::string specification;
21 |
22 | MessageTemplate::ConstPtr message_template;
23 | };
24 |
25 | struct ServiceDescription
26 | {
27 | typedef std::shared_ptr Ptr;
28 | typedef std::shared_ptr ConstPtr;
29 |
30 | std::string datatype;
31 | std::string md5;
32 | std::string specification;
33 |
34 | MessageDescription::ConstPtr request;
35 | MessageDescription::ConstPtr response;
36 | };
37 | } // ros_babel_fish
38 |
39 | #endif //ROS_BABEL_FISH_MESSAGE_DESCRIPTION_H
40 |
--------------------------------------------------------------------------------
/ros_babel_fish/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ros_babel_fish
4 | 0.9.3
5 |
6 | A runtime message handler for ROS.
7 | Allows subscription, publishing, calling of services and actions with messages known only at runtime.
8 |
9 |
10 | Stefan Fabian
11 |
12 | MIT
13 |
14 | Stefan Fabian -->
15 |
16 | catkin
17 |
18 | libssl-dev
19 | libssl-dev
20 | actionlib
21 | openssl
22 | roscpp
23 | roslib
24 | geometry_msgs
25 | ros_babel_fish_test_msgs
26 | rosapi
27 | roscpp_tutorials
28 | rosgraph_msgs
29 | rostest
30 | std_msgs
31 | std_srvs
32 | visualization_msgs
33 |
34 |
--------------------------------------------------------------------------------
/ros_babel_fish_test_msgs/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package ros_babel_fish_test_msgs
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.9.3 (2022-04-20)
6 | ------------------
7 |
8 | 0.9.2 (2021-12-22)
9 | ------------------
10 | * Accept True and False as boolean constants (`#4 `_)
11 | * Contributors: Martin Valgur
12 |
13 | 0.9.1 (2020-10-29)
14 | ------------------
15 | * Added missing build depend for openssl headers to fix build for noetic.
16 | * Contributors: Stefan Fabian
17 |
18 | 0.9.0 (2020-10-28)
19 | ------------------
20 | * Added install target for service_info. Cleaned up package.xml
21 | * Contributors: Stefan Fabian
22 |
23 | 0.8.0 (2020-03-20)
24 | ------------------
25 | * Added specialization for action client to allow creating an ActionClient with a BabelFishAction.
26 | * Renamed targets to include ${PROJECT_NAME} prefix to fix `#3 `_.
27 | * Cleanup for initial release.
28 | Added convenience methods.
29 | Added a lot of tests.
30 | * Cleanup for initial release.
31 | Added convenience methods.
32 | Added a lot of tests.
33 | * Contributors: Stefan Fabian
34 |
--------------------------------------------------------------------------------
/ros_babel_fish_test_msgs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5.1)
2 | project(ros_babel_fish_test_msgs VERSION 0.9.1)
3 |
4 | find_package(catkin REQUIRED COMPONENTS actionlib_msgs message_generation std_msgs geometry_msgs)
5 |
6 | ################################################
7 | ## Declare ROS messages, services and actions ##
8 | ################################################
9 |
10 | ## Generate messages in the 'msg' folder
11 | add_message_files(
12 | FILES
13 | TestArray.msg
14 | TestMessage.msg
15 | TestSubArray.msg
16 | )
17 |
18 | ## Generate services in the 'srv' folder
19 | # add_service_files(
20 | # FILES
21 | # Service1.srv
22 | # Service2.srv
23 | # )
24 |
25 | ## Generate actions in the 'action' folder
26 | add_action_files(
27 | DIRECTORY action
28 | FILES
29 | SimpleTest.action
30 | )
31 |
32 | ## Generate added messages and services with any dependencies listed here
33 | generate_messages(
34 | DEPENDENCIES
35 | actionlib_msgs
36 | std_msgs
37 | geometry_msgs
38 | )
39 |
40 | ###################################
41 | ## catkin specific configuration ##
42 | ###################################
43 | catkin_package(
44 | CATKIN_DEPENDS message_runtime actionlib_msgs std_msgs geometry_msgs
45 | )
46 |
--------------------------------------------------------------------------------
/ros_babel_fish/test/service_client_test_services.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Stefan Fabian on 04.09.19.
3 | //
4 |
5 | #include
6 |
7 | #include
8 | #include
9 |
10 | using namespace ros_babel_fish;
11 |
12 | bool twoIntServiceCallback( roscpp_tutorials::TwoInts::Request &req, roscpp_tutorials::TwoInts::Response &resp )
13 | {
14 | resp.sum = req.a + req.b + 42;
15 | return true;
16 | }
17 |
18 | int main( int argc, char **argv )
19 | {
20 | ros::init( argc, argv, "service_client_test_services" );
21 | ros::NodeHandle nh;
22 | ros::ServiceServer server1 = nh.advertiseService( "/test_service_client/two_ints",
23 | twoIntServiceCallback );
24 |
25 | BabelFish fish;
26 |
27 | ros::ServiceServer server2 = fish.advertiseService(
28 | nh, "rosapi/Subscribers", "/test_service_server/subscribers",
29 | []( Message &req, Message &resp ) -> bool
30 | {
31 | resp["subscribers"].as>().push_back( req["topic"].value());
32 | resp["subscribers"].as>().push_back( "The answer to everything is:" );
33 |
34 | return true;
35 | } );
36 |
37 | ros::spin();
38 | return 0;
39 | }
--------------------------------------------------------------------------------
/ros_babel_fish/include/ros_babel_fish/generation/message_template.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Stefan Fabian. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | #ifndef ROS_BABEL_FISH_MESSAGE_TEMPLATE_H
5 | #define ROS_BABEL_FISH_MESSAGE_TEMPLATE_H
6 |
7 | #include "ros_babel_fish/message.h"
8 |
9 | #include