-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hardcoded typesupport for Fibonacci action (ros2/rcl_interfaces#47)
* msg and srv in actions folder * Add uniquely named messages and services * Add hand made action typesupport * respose -> result request * respose -> response * Use goal info in more places * Fix feedback symbol * Generate from .action file * Hardcoded typesupport works with generated msg and srv * C typesupport returns rcl_action_type_support_t * Function to get typsupport struct from C++ typesupport * rosidl_typesupport_cpp namespace * Fix include guard * Fix linter test failures * Fix dll linkage on Windows * Fix windows linking issue by having separate visibility macro
- Loading branch information
Showing
10 changed files
with
381 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#goal definition | ||
int32 order | ||
--- | ||
#result definition | ||
int32[] sequence | ||
--- | ||
#feedback | ||
int32[] sequence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2018 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. | ||
|
||
// TODO(sloretz) generated code should not contain a copyright notice | ||
|
||
#ifndef TEST_MSGS__ACTION__FIBONACCI_H_ | ||
#define TEST_MSGS__ACTION__FIBONACCI_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
#include <action_msgs/msg/goal_info.h> | ||
#include <action_msgs/msg/goal_status_array.h> | ||
#include <action_msgs/srv/cancel_goal.h> | ||
#include <test_msgs/action/fibonacci__feedback.h> | ||
#include <test_msgs/action/fibonacci__goal.h> | ||
#include <test_msgs/action/fibonacci__result.h> | ||
#include "test_msgs/action/fibonacci__type_support.h" | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // TEST_MSGS__ACTION__FIBONACCI_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2018 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 TEST_MSGS__ACTION__FIBONACCI_HPP_ | ||
#define TEST_MSGS__ACTION__FIBONACCI_HPP_ | ||
|
||
#include <action_msgs/msg/goal_info.hpp> | ||
#include <action_msgs/msg/goal_status_array.hpp> | ||
#include <action_msgs/srv/cancel_goal.hpp> | ||
#include <test_msgs/action/fibonacci__goal.hpp> | ||
#include <test_msgs/action/fibonacci__result.hpp> | ||
#include <test_msgs/action/fibonacci__feedback.hpp> | ||
#include <test_msgs/action/fibonacci__struct.hpp> | ||
#include "rosidl_generator_c/action_type_support_struct.h" | ||
|
||
#endif // TEST_MSGS__ACTION__FIBONACCI_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2018 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. | ||
|
||
// TODO(sloretz) generated code should not contain a copyright notice | ||
|
||
#ifndef TEST_MSGS__ACTION__FIBONACCI__STRUCT_HPP_ | ||
#define TEST_MSGS__ACTION__FIBONACCI__STRUCT_HPP_ | ||
|
||
#include <action_msgs/msg/goal_info.hpp> | ||
#include <action_msgs/msg/goal_status_array.hpp> | ||
#include <action_msgs/srv/cancel_goal.hpp> | ||
#include <test_msgs/action/fibonacci__goal.hpp> | ||
#include <test_msgs/action/fibonacci__result.hpp> | ||
#include <test_msgs/action/fibonacci__feedback.hpp> | ||
|
||
namespace test_msgs | ||
{ | ||
namespace action | ||
{ | ||
struct Fibonacci | ||
{ | ||
// Typedefs handy for rcl and rclcpp | ||
using CancelGoalService = action_msgs::srv::CancelGoal; | ||
using GoalStatusMessage = action_msgs::msg::GoalStatusArray; | ||
using GoalRequestService = test_msgs::action::Fibonacci_Goal; | ||
using GoalResultService = test_msgs::action::Fibonacci_Result; | ||
|
||
// Typedefs handy for user | ||
using Goal = GoalRequestService::Request; | ||
using Result = GoalResultService::Response; | ||
using Feedback = test_msgs::action::Fibonacci_Feedback; | ||
}; | ||
|
||
typedef struct Fibonacci Fibonacci; | ||
} // namespace action | ||
} // namespace test_msgs | ||
|
||
#endif // TEST_MSGS__ACTION__FIBONACCI__STRUCT_HPP_ |
42 changes: 42 additions & 0 deletions
42
test_msgs/include/test_msgs/action/fibonacci__type_support.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2018 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. | ||
|
||
// TODO(sloretz) generated code should not contain a copyright notice | ||
|
||
#ifndef TEST_MSGS__ACTION__FIBONACCI__TYPE_SUPPORT_H_ | ||
#define TEST_MSGS__ACTION__FIBONACCI__TYPE_SUPPORT_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
#include "rosidl_generator_c/action_type_support_struct.h" | ||
#include "rosidl_typesupport_interface/macros.h" | ||
|
||
#include "test_msgs/action/rosidl_generator_c__visibility_control.h" | ||
|
||
/* *INDENT-OFF* */ | ||
// Forward declare the get type support functions for this type. | ||
ROSIDL_GENERATOR_C_PUBLIC_test_msgs_ACTION | ||
const rosidl_action_type_support_t * | ||
ROSIDL_TYPESUPPORT_INTERFACE__ACTION_SYMBOL_NAME( | ||
rosidl_typesupport_c, test_msgs, action, Fibonacci)(); | ||
/* *INDENT-ON* */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // TEST_MSGS__ACTION__FIBONACCI__TYPE_SUPPORT_H_ |
55 changes: 55 additions & 0 deletions
55
test_msgs/include/test_msgs/action/rosidl_generator_c__visibility_control.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2018 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. | ||
|
||
// TODO(sloretz) generated code should not contain a copyright notice | ||
|
||
#ifndef TEST_MSGS__ACTION__ROSIDL_GENERATOR_C__VISIBILITY_CONTROL_H_ | ||
#define TEST_MSGS__ACTION__ROSIDL_GENERATOR_C__VISIBILITY_CONTROL_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
// This logic was borrowed (then namespaced) from the examples on the gcc wiki: | ||
// https://gcc.gnu.org/wiki/Visibility | ||
|
||
#if defined _WIN32 || defined __CYGWIN__ | ||
#ifdef __GNUC__ | ||
#define ROSIDL_GENERATOR_C_EXPORT_test_msgs_ACTION __attribute__ ((dllexport)) | ||
#define ROSIDL_GENERATOR_C_IMPORT_test_msgs_ACTION __attribute__ ((dllimport)) | ||
#else | ||
#define ROSIDL_GENERATOR_C_EXPORT_test_msgs_ACTION __declspec(dllexport) | ||
#define ROSIDL_GENERATOR_C_IMPORT_test_msgs_ACTION __declspec(dllimport) | ||
#endif | ||
#ifdef ROSIDL_GENERATOR_C_BUILDING_DLL_test_msgs_ACTION | ||
#define ROSIDL_GENERATOR_C_PUBLIC_test_msgs_ACTION ROSIDL_GENERATOR_C_EXPORT_test_msgs_ACTION | ||
#else | ||
#define ROSIDL_GENERATOR_C_PUBLIC_test_msgs_ACTION ROSIDL_GENERATOR_C_IMPORT_test_msgs_ACTION | ||
#endif | ||
#else | ||
#define ROSIDL_GENERATOR_C_EXPORT_test_msgs_ACTION __attribute__ ((visibility("default"))) | ||
#define ROSIDL_GENERATOR_C_IMPORT_test_msgs_ACTION | ||
#if __GNUC__ >= 4 | ||
#define ROSIDL_GENERATOR_C_PUBLIC_test_msgs_ACTION __attribute__ ((visibility("default"))) | ||
#else | ||
#define ROSIDL_GENERATOR_C_PUBLIC_test_msgs_ACTION | ||
#endif | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // TEST_MSGS__ACTION__ROSIDL_GENERATOR_C__VISIBILITY_CONTROL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2018 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. | ||
|
||
#include <action_msgs/msg/goal_info.h> | ||
#include <action_msgs/msg/goal_status_array.h> | ||
#include <action_msgs/srv/cancel_goal.h> | ||
#include <rosidl_generator_c/action_type_support_struct.h> | ||
#include <test_msgs/action/fibonacci__goal.h> | ||
#include <test_msgs/action/fibonacci__result.h> | ||
#include <test_msgs/action/fibonacci__feedback.h> | ||
|
||
#include "test_msgs/action/fibonacci__type_support.h" | ||
#include "test_msgs/msg/rosidl_generator_c__visibility_control.h" | ||
|
||
|
||
static rosidl_action_type_support_t _test_msgs__action__Fibonacci__typesupport_c; | ||
|
||
const rosidl_action_type_support_t * | ||
ROSIDL_TYPESUPPORT_INTERFACE__ACTION_SYMBOL_NAME( | ||
rosidl_typesupport_c, test_msgs, action, Fibonacci)() | ||
{ | ||
// Thread-safe by always writing the same values to the static struct | ||
_test_msgs__action__Fibonacci__typesupport_c.goal_service_type_support = | ||
ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME( | ||
rosidl_typesupport_c, test_msgs, action, Fibonacci_Goal)(); | ||
_test_msgs__action__Fibonacci__typesupport_c.result_service_type_support = | ||
ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME( | ||
rosidl_typesupport_c, test_msgs, action, Fibonacci_Result)(); | ||
_test_msgs__action__Fibonacci__typesupport_c.cancel_service_type_support = | ||
ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME( | ||
rosidl_typesupport_c, action_msgs, srv, CancelGoal)(); | ||
_test_msgs__action__Fibonacci__typesupport_c.feedback_message_type_support = | ||
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME( | ||
rosidl_typesupport_c, test_msgs, action, Fibonacci_Feedback)(); | ||
_test_msgs__action__Fibonacci__typesupport_c.status_message_type_support = | ||
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME( | ||
rosidl_typesupport_c, action_msgs, msg, GoalStatusArray)(); | ||
|
||
return &_test_msgs__action__Fibonacci__typesupport_c; | ||
} |
Oops, something went wrong.