Skip to content

Commit

Permalink
refactor(component_interface_utils): prefix package and namespace wit…
Browse files Browse the repository at this point in the history
…h autoware

Signed-off-by: Esteve Fernandez <[email protected]>
  • Loading branch information
esteve committed Oct 30, 2024
1 parent 94b9ad0 commit 9939bae
Show file tree
Hide file tree
Showing 81 changed files with 217 additions and 206 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.14)
project(component_interface_utils)
project(autoware_component_interface_utils)

find_package(autoware_cmake REQUIRED)
autoware_package()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# component_interface_utils
# autoware_component_interface_utils

## Features

Expand Down Expand Up @@ -40,13 +40,13 @@ Create the wrapper using the above definition as follows.

```cpp
// header file
component_interface_utils::Service<SampleService>::SharedPtr srv_;
component_interface_utils::Client<SampleService>::SharedPtr cli_;
component_interface_utils::Publisher<SampleMessage>::SharedPtr pub_;
component_interface_utils::Subscription<SampleMessage>::SharedPtr sub_;
autoware::component_interface_utils::Service<SampleService>::SharedPtr srv_;
autoware::component_interface_utils::Client<SampleService>::SharedPtr cli_;
autoware::component_interface_utils::Publisher<SampleMessage>::SharedPtr pub_;
autoware::component_interface_utils::Subscription<SampleMessage>::SharedPtr sub_;

// source file
const auto node = component_interface_utils::NodeAdaptor(this);
const auto node = autoware::component_interface_utils::NodeAdaptor(this);
node.init_srv(srv_, callback);
node.init_cli(cli_);
node.init_pub(pub_);
Expand Down Expand Up @@ -94,7 +94,7 @@ void service_callback(Request req, Response res)
There are utilities for relaying services and messages of the same type.

```cpp
const auto node = component_interface_utils::NodeAdaptor(this);
const auto node = autoware::component_interface_utils::NodeAdaptor(this);
service_callback_group_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive);
node.relay_message(pub_, sub_);
node.relay_service(cli_, srv_, service_callback_group_); // group is for avoiding deadlocks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__RCLCPP_HPP_
#define COMPONENT_INTERFACE_UTILS__RCLCPP_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP_HPP_

#include <component_interface_utils/rclcpp/create_interface.hpp>
#include <component_interface_utils/rclcpp/interface.hpp>
#include <component_interface_utils/rclcpp/service_client.hpp>
#include <component_interface_utils/rclcpp/service_server.hpp>
#include <component_interface_utils/rclcpp/topic_publisher.hpp>
#include <component_interface_utils/rclcpp/topic_subscription.hpp>
#include <autoware/component_interface_utils/rclcpp/create_interface.hpp>
#include <autoware/component_interface_utils/rclcpp/interface.hpp>
#include <autoware/component_interface_utils/rclcpp/service_client.hpp>
#include <autoware/component_interface_utils/rclcpp/service_server.hpp>
#include <autoware/component_interface_utils/rclcpp/topic_publisher.hpp>
#include <autoware/component_interface_utils/rclcpp/topic_subscription.hpp>

#include <memory>
#include <optional>
#include <utility>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

class NodeAdaptor
Expand Down Expand Up @@ -123,6 +123,6 @@ class NodeAdaptor
NodeInterface::SharedPtr interface_;
};

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__RCLCPP_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__RCLCPP__CREATE_INTERFACE_HPP_
#define COMPONENT_INTERFACE_UTILS__RCLCPP__CREATE_INTERFACE_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__CREATE_INTERFACE_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__CREATE_INTERFACE_HPP_

#include <component_interface_utils/rclcpp/interface.hpp>
#include <component_interface_utils/rclcpp/service_client.hpp>
#include <component_interface_utils/rclcpp/service_server.hpp>
#include <component_interface_utils/rclcpp/topic_publisher.hpp>
#include <component_interface_utils/rclcpp/topic_subscription.hpp>
#include <component_interface_utils/specs.hpp>
#include <autoware/component_interface_utils/rclcpp/interface.hpp>
#include <autoware/component_interface_utils/rclcpp/service_client.hpp>
#include <autoware/component_interface_utils/rclcpp/service_server.hpp>
#include <autoware/component_interface_utils/rclcpp/topic_publisher.hpp>
#include <autoware/component_interface_utils/rclcpp/topic_subscription.hpp>
#include <autoware/component_interface_utils/specs.hpp>
#include <rclcpp/rclcpp.hpp>

#include <utility>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

/// Create a client wrapper for logging. This is a private implementation.
Expand Down Expand Up @@ -72,6 +72,6 @@ typename Subscription<SpecT>::SharedPtr create_subscription_impl(
return Subscription<SpecT>::make_shared(subscription);
}

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__RCLCPP__CREATE_INTERFACE_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__CREATE_INTERFACE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__RCLCPP__EXCEPTIONS_HPP_
#define COMPONENT_INTERFACE_UTILS__RCLCPP__EXCEPTIONS_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__EXCEPTIONS_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__EXCEPTIONS_HPP_

#include <autoware_adapi_v1_msgs/msg/response_status.hpp>

#include <exception>
#include <string>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

class ServiceException : public std::exception
Expand Down Expand Up @@ -104,6 +104,6 @@ class NoEffectWarning : public ServiceException
}
};

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__RCLCPP__EXCEPTIONS_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__EXCEPTIONS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__RCLCPP__INTERFACE_HPP_
#define COMPONENT_INTERFACE_UTILS__RCLCPP__INTERFACE_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__INTERFACE_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__INTERFACE_HPP_

#include <rclcpp/rclcpp.hpp>

Expand All @@ -23,7 +23,7 @@
#include <string>
#include <unordered_map>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

struct NodeInterface
Expand Down Expand Up @@ -68,6 +68,6 @@ struct NodeInterface
std::string node_name;
};

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__RCLCPP__INTERFACE_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__INTERFACE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_CLIENT_HPP_
#define COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_CLIENT_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_CLIENT_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_CLIENT_HPP_

#include <component_interface_utils/rclcpp/exceptions.hpp>
#include <component_interface_utils/rclcpp/interface.hpp>
#include <autoware/component_interface_utils/rclcpp/exceptions.hpp>
#include <autoware/component_interface_utils/rclcpp/interface.hpp>
#include <rclcpp/node.hpp>

#include <tier4_system_msgs/msg/service_log.hpp>
Expand All @@ -25,7 +25,7 @@
#include <string>
#include <utility>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

/// The wrapper class of rclcpp::Client for logging.
Expand Down Expand Up @@ -104,6 +104,6 @@ class Client
NodeInterface::SharedPtr interface_;
};

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_CLIENT_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_CLIENT_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_SERVER_HPP_
#define COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_SERVER_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_SERVER_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_SERVER_HPP_

#include <component_interface_utils/rclcpp/exceptions.hpp>
#include <component_interface_utils/rclcpp/interface.hpp>
#include <autoware/component_interface_utils/rclcpp/exceptions.hpp>
#include <autoware/component_interface_utils/rclcpp/interface.hpp>
#include <rclcpp/node.hpp>

#include <tier4_system_msgs/msg/service_log.hpp>

#include <string>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

/// The wrapper class of rclcpp::Service for logging.
Expand Down Expand Up @@ -94,6 +94,6 @@ class Service
NodeInterface::SharedPtr interface_;
};

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_SERVER_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__SERVICE_SERVER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_PUBLISHER_HPP_
#define COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_PUBLISHER_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_PUBLISHER_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_PUBLISHER_HPP_

#include <rclcpp/publisher.hpp>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

/// The wrapper class of rclcpp::Publisher. This is for future use and no functionality now.
Expand All @@ -43,6 +43,6 @@ class Publisher
typename WrapType::SharedPtr publisher_;
};

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_PUBLISHER_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_PUBLISHER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_SUBSCRIPTION_HPP_
#define COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_SUBSCRIPTION_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_SUBSCRIPTION_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_SUBSCRIPTION_HPP_

#include <rclcpp/subscription.hpp>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

/// The wrapper class of rclcpp::Subscription. This is for future use and no functionality now.
Expand All @@ -40,6 +40,6 @@ class Subscription
typename WrapType::SharedPtr subscription_;
};

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_SUBSCRIPTION_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__RCLCPP__TOPIC_SUBSCRIPTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__SPECS_HPP_
#define COMPONENT_INTERFACE_UTILS__SPECS_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__SPECS_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__SPECS_HPP_

#include <rclcpp/qos.hpp>

namespace component_interface_utils
namespace autoware::component_interface_utils
{

template <class SpecT>
Expand All @@ -29,6 +29,6 @@ rclcpp::QoS get_qos()
return qos;
}

} // namespace component_interface_utils
} // namespace autoware::component_interface_utils

#endif // COMPONENT_INTERFACE_UTILS__SPECS_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__SPECS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPONENT_INTERFACE_UTILS__STATUS_HPP_
#define COMPONENT_INTERFACE_UTILS__STATUS_HPP_
#ifndef AUTOWARE__COMPONENT_INTERFACE_UTILS__STATUS_HPP_
#define AUTOWARE__COMPONENT_INTERFACE_UTILS__STATUS_HPP_

namespace component_interface_utils::status
namespace autoware::component_interface_utils::status
{

template <class T1, class T2>
Expand All @@ -26,6 +26,6 @@ void copy(const T1 & src, T2 & dst) // NOLINT(build/include_what_you_use): cppl
dst->status.message = src->status.message;
}

} // namespace component_interface_utils::status
} // namespace autoware::component_interface_utils::status

#endif // COMPONENT_INTERFACE_UTILS__STATUS_HPP_
#endif // AUTOWARE__COMPONENT_INTERFACE_UTILS__STATUS_HPP_
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>component_interface_utils</name>
<name>autoware_component_interface_utils</name>
<version>0.0.0</version>
<description>The component_interface_utils package</description>
<description>The autoware_component_interface_utils package</description>
<maintainer email="[email protected]">Takagi, Isamu</maintainer>
<maintainer email="[email protected]">Yukihiro Saito</maintainer>
<license>Apache License 2.0</license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "component_interface_utils/rclcpp/exceptions.hpp"
#include "component_interface_utils/specs.hpp"
#include "component_interface_utils/status.hpp"
#include "autoware/component_interface_utils/rclcpp/exceptions.hpp"
#include "autoware/component_interface_utils/specs.hpp"
#include "autoware/component_interface_utils/status.hpp"
#include "gtest/gtest.h"

TEST(interface, utils)
{
{
using component_interface_utils::ServiceException;
using autoware::component_interface_utils::ServiceException;
using ResponseStatus = autoware_adapi_v1_msgs::msg::ResponseStatus;
using ResponseStatusCode = ResponseStatus::_code_type;

Expand All @@ -34,7 +34,7 @@ TEST(interface, utils)
}

{
using component_interface_utils::ServiceException;
using autoware::component_interface_utils::ServiceException;
using ResponseStatus = autoware_adapi_v1_msgs::msg::ResponseStatus;
using ResponseStatusCode = ResponseStatus::_code_type;

Expand All @@ -48,10 +48,10 @@ TEST(interface, utils)
}

{
using component_interface_utils::ServiceException;
using autoware::component_interface_utils::ServiceException;
using ResponseStatus = autoware_adapi_v1_msgs::msg::ResponseStatus;
using ResponseStatusCode = ResponseStatus::_code_type;
using component_interface_utils::status::copy;
using autoware::component_interface_utils::status::copy;

class status_test
{
Expand Down
Loading

0 comments on commit 9939bae

Please sign in to comment.