initial commit of rcl interface
This commit is contained in:
parent
ee7b6b8001
commit
251a5df6bd
5 changed files with 238 additions and 1 deletions
2
LICENSE
2
LICENSE
|
@ -186,7 +186,7 @@ Apache License
|
|||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
Copyright 2014 Open Source Robotics Foundation, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
16
rcl/CMakeLists.txt
Normal file
16
rcl/CMakeLists.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
cmake_minimum_required(VERSION 2.8.3)
|
||||
|
||||
project(rcl)
|
||||
|
||||
find_package(ament_cmake REQUIRED)
|
||||
|
||||
ament_export_dependencies(ros_middleware_interface)
|
||||
|
||||
ament_export_include_directories(include)
|
||||
|
||||
ament_package()
|
||||
|
||||
install(
|
||||
DIRECTORY include/
|
||||
DESTINATION include
|
||||
)
|
145
rcl/include/rcl/rcl.h
Normal file
145
rcl/include/rcl/rcl.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
/* Copyright 2014 Open Source Robotics Foundation, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RCL_RCL_RCL_H_
|
||||
#define RCL_RCL_RCL_H_
|
||||
|
||||
#include <stdbool.h> // For bool
|
||||
#include <stddef.h> // For size_t
|
||||
|
||||
// For rosidl_message_type_support_t
|
||||
#include <rosidl_generator_c/message_type_support.h>
|
||||
|
||||
#include "types.h" // For rcl_*_t types
|
||||
|
||||
/// Global initialization for rcl; should be called once per process.
|
||||
rcl_ret_t
|
||||
rcl_init(int argc, char **argv);
|
||||
|
||||
/// Creates a rcl_node_t; used to implement a ROS Node.
|
||||
rcl_node_t *
|
||||
rcl_create_node(const char * name);
|
||||
|
||||
/// Destroys a rcl_node_t.
|
||||
rcl_ret_t
|
||||
rcl_destroy_node(rcl_node_t * node);
|
||||
|
||||
/// Creates a rcl_publisher_t; used to implement a ROS Publisher.
|
||||
rcl_publisher_t *
|
||||
rcl_create_publisher(const rcl_node_t * node,
|
||||
const rosidl_message_type_support_t * type_support,
|
||||
const char * topic_name,
|
||||
size_t queue_size);
|
||||
|
||||
/// Destroys a rcl_publisher_t.
|
||||
rcl_ret_t
|
||||
rcl_destroy_publisher(rcl_publisher_t * publisher);
|
||||
|
||||
/// Publishes a ROS message to a ROS Topic using a rcl_publisher_t.
|
||||
rcl_ret_t
|
||||
rcl_publish(const rcl_publisher_t * publisher, const void * ros_message);
|
||||
|
||||
/// Creates a rcl_subscription_t; used to implement a ROS Subscription.
|
||||
rcl_subscription_t *
|
||||
rcl_create_subscription(const rcl_node_t * node,
|
||||
const rosidl_message_type_support_t * type_support,
|
||||
const char * topic_name,
|
||||
size_t queue_size);
|
||||
|
||||
/// Destroys a rcl_subscription_t.
|
||||
rcl_ret_t
|
||||
rcl_destroy_subscription(rcl_subscription_t * subscription);
|
||||
|
||||
/// Takes a ROS message from a given rcl_subscription_t if one is available.
|
||||
rcl_ret_t
|
||||
rcl_take(const rcl_subscription_t * subscriber, void * ros_message);
|
||||
|
||||
/// Creates a rcl_guard_condition_t; is used by the implementation to
|
||||
/// asynchronously interrupt rmw_wait.
|
||||
rcl_guard_condition_t *
|
||||
rcl_create_guard_condition();
|
||||
|
||||
/// Destroys a rcl_guard_condition_t.
|
||||
rcl_ret_t
|
||||
rcl_destroy_guard_condition(rcl_guard_condition_t * guard_condition);
|
||||
|
||||
/// Triggers the condition, which will interrupt rmw_wait asynchronously.
|
||||
rcl_ret_t
|
||||
rcl_trigger_guard_condition(const rcl_guard_condition_t * guard_condition);
|
||||
|
||||
/// Creates a rcl_callback_group_t, which provides hints about how to execute
|
||||
/// groups of callbacks to an executor.
|
||||
rcl_callback_group_t *
|
||||
rcl_create_callback_group(rcl_node_t * node);
|
||||
|
||||
/// Destroys a rcl_callback_group_t.
|
||||
rcl_ret_t
|
||||
rcl_destroy_callback_group(rcl_callback_group_t * callback_group);
|
||||
|
||||
/// Creates a rcl_subscription_info_t, which associates rcl_subscription_t's
|
||||
/// to a callback group.
|
||||
rcl_subscription_info_t *
|
||||
rcl_create_subscription_info(rcl_subscription_t * const subscription,
|
||||
rcl_callback_group_t * const callback_group);
|
||||
|
||||
/// Destroys a rcl_subscription_info_t.
|
||||
rcl_ret_t
|
||||
rcl_destroy_subscription_info(rcl_subscription_info_t * subscription_info);
|
||||
|
||||
/// Creates a rcl_timer_info_t, which associates a ROS Timer's guard condition
|
||||
/// with a callback group.
|
||||
rcl_timer_info_t *
|
||||
rcl_create_timer_info(rcl_guard_condition_t * const guard_condition,
|
||||
rcl_callback_group_t * const callback_group);
|
||||
|
||||
/// Destroys a rcl_timer_info_t.
|
||||
rcl_ret_t
|
||||
rcl_destroy_timer_info(rcl_timer_info_t * timer_info);
|
||||
|
||||
/// Creates a rcl_executor_helper_t, which is a collection of callable items.
|
||||
rcl_executor_helper_t *
|
||||
rcl_create_executor_helper();
|
||||
|
||||
/// Destroys a rcl_executor_helper_t.
|
||||
rcl_ret_t
|
||||
rcl_destroy_executor_helper(rcl_executor_helper_t * executor_helper);
|
||||
|
||||
/// Add a rcl_subscription_info_t to the collection of callable items.
|
||||
rcl_ret_t
|
||||
rcl_add_subscription_info(rcl_executor_helper_t * executor_helper,
|
||||
rcl_subscription_info_t * subscription_info);
|
||||
|
||||
/// Removes a rcl_subscription_t from the collection of callable items.
|
||||
rcl_ret_t
|
||||
rcl_remove_subscription_info(rcl_executor_helper_t * executor_helper,
|
||||
rcl_subscription_info_t * subscription_info);
|
||||
|
||||
/// Add a rcl_timer_info_t to the collection of callable items.
|
||||
rcl_ret_t
|
||||
rcl_add_timer_info(rcl_executor_helper_t * executor_helper,
|
||||
rcl_timer_info_t * timer_info);
|
||||
|
||||
/// Removes a rcl_subscription_t from the collection of callable items.
|
||||
rcl_ret_t
|
||||
rcl_remove_timer_info(rcl_executor_helper_t * executor_helper,
|
||||
rcl_timer_info_t * timer_info);
|
||||
|
||||
/// Finds the next ready to be called item if one exists; optionally blocking.
|
||||
rcl_ret_t
|
||||
rcl_get_next_any_executable(rcl_executor_helper_t * executor_helper,
|
||||
rcl_any_executable_t * any_executable,
|
||||
bool non_blocking);
|
||||
|
||||
#endif /* RCL_RCL_RCL_H_ */
|
59
rcl/include/rcl/types.h
Normal file
59
rcl/include/rcl/types.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* Copyright 2014 Open Source Robotics Foundation, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RCL_RCL_TYPES_H_
|
||||
#define RCL_RCL_TYPES_H_
|
||||
|
||||
#include <rmw/types.h>
|
||||
|
||||
typedef rmw_ret_t rcl_ret_t;
|
||||
#define RCL_RET_OK RMW_RET_OK
|
||||
|
||||
typedef rmw_node_t rcl_node_t;
|
||||
typedef rmw_publisher_t rcl_publisher_t;
|
||||
typedef rmw_subscription_t rcl_subscription_t;
|
||||
typedef rmw_guard_condition_t rcl_guard_condition_t;
|
||||
typedef rmw_subscriptions_t rcl_subscriptions_t;
|
||||
typedef rmw_guard_conditions_t rcl_guard_conditions_t;
|
||||
|
||||
typedef struct rcl_callback_group_t
|
||||
{
|
||||
rcl_node_t * * node;
|
||||
} rcl_callback_group_t;
|
||||
|
||||
typedef struct rcl_subscription_info_t
|
||||
{
|
||||
rcl_subscription_t * * subscription;
|
||||
rcl_callback_group_t * * callback_group;
|
||||
} rcl_subscription_info_t;
|
||||
|
||||
typedef struct rcl_timer_info_t
|
||||
{
|
||||
rcl_guard_condition_t * * guard_condition;
|
||||
rcl_callback_group_t * * callback_group;
|
||||
} rcl_timer_info_t;
|
||||
|
||||
typedef struct rcl_executor_helper_t
|
||||
{
|
||||
// TODO: fill with something
|
||||
} rcl_executor_helper_t;
|
||||
|
||||
typedef struct rcl_any_executable_t
|
||||
{
|
||||
rcl_subscription_info_t * * subscription_info;
|
||||
rcl_timer_info_t * * timer_info;
|
||||
} rcl_any_executable_t;
|
||||
|
||||
#endif /* RCL_RCL_TYPES_H_ */
|
17
rcl/package.xml
Normal file
17
rcl/package.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<package format="2">
|
||||
<name>rcl</name>
|
||||
<version>0.0.0</version>
|
||||
<description>The ROS client library common implementation.
|
||||
This package contains an API which builds on the ROS middleware API and is optionally built upon by the other ROS client libraries.
|
||||
</description>
|
||||
<maintainer email="william@osrfoundation.org">William Woodall</maintainer>
|
||||
<license>Apache License 2.0</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
|
||||
<build_depend>ros_middleware_interface</build_depend>
|
||||
|
||||
<build_export_depend>ros_middleware_interface</build_export_depend>
|
||||
|
||||
</package>
|
Loading…
Add table
Add a link
Reference in a new issue