Skip to content

Commit

Permalink
Merge pull request #3 from OUXT-Polaris/feature/merge_launch
Browse files Browse the repository at this point in the history
Feature/merge launch
  • Loading branch information
hakuturu583 authored Jan 24, 2024
2 parents f514ea1 + adcc4ea commit 0de0dbb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 34 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ target_link_libraries(vrx_bridge_node
vrx_bridge_component
)

install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
Expand Down
35 changes: 12 additions & 23 deletions include/vrx_bridge/vrx_bridge_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,25 @@ extern "C" {
// demos/composition/include/composition/visibility_control.h at https://github.com/ros2/demos
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define VRX_BRIDGE_COMPONENT_EXPORT \
__attribute__((dllexport))
#define VRX_BRIDGE_COMPONENT_IMPORT \
__attribute__((dllimport))
#define VRX_BRIDGE_COMPONENT_EXPORT __attribute__((dllexport))
#define VRX_BRIDGE_COMPONENT_IMPORT __attribute__((dllimport))
#else
#define VRX_BRIDGE_COMPONENT_EXPORT \
__declspec(dllexport)
#define VRX_BRIDGE_COMPONENT_IMPORT \
__declspec(dllimport)
#define VRX_BRIDGE_COMPONENT_EXPORT __declspec(dllexport)
#define VRX_BRIDGE_COMPONENT_IMPORT __declspec(dllimport)
#endif
#ifdef VRX_BRIDGE_COMPONENT_BUILDING_DLL
#define VRX_BRIDGE_COMPONENT_PUBLIC \
VRX_BRIDGE_COMPONENT_EXPORT
#define VRX_BRIDGE_COMPONENT_PUBLIC VRX_BRIDGE_COMPONENT_EXPORT
#else
#define VRX_BRIDGE_COMPONENT_PUBLIC \
VRX_BRIDGE_COMPONENT_IMPORT
#define VRX_BRIDGE_COMPONENT_PUBLIC VRX_BRIDGE_COMPONENT_IMPORT
#endif
#define VRX_BRIDGE_COMPONENT_PUBLIC_TYPE \
VRX_BRIDGE_COMPONENT_PUBLIC
#define VRX_BRIDGE_COMPONENT_PUBLIC_TYPE VRX_BRIDGE_COMPONENT_PUBLIC
#define VRX_BRIDGE_COMPONENT_LOCAL
#else
#define VRX_BRIDGE_COMPONENT_EXPORT \
__attribute__((visibility("default")))
#define VRX_BRIDGE_COMPONENT_EXPORT __attribute__((visibility("default")))
#define VRX_BRIDGE_COMPONENT_IMPORT
#if __GNUC__ >= 4
#define VRX_BRIDGE_COMPONENT_PUBLIC \
__attribute__((visibility("default")))
#define VRX_BRIDGE_COMPONENT_LOCAL \
__attribute__((visibility("hidden")))
#define VRX_BRIDGE_COMPONENT_PUBLIC __attribute__((visibility("default")))
#define VRX_BRIDGE_COMPONENT_LOCAL __attribute__((visibility("hidden")))
#else
#define VRX_BRIDGE_COMPONENT_PUBLIC
#define VRX_BRIDGE_COMPONENT_LOCAL
Expand All @@ -63,11 +53,10 @@ extern "C" {
#endif

#include <geographic_msgs/msg/geo_pose_stamped.hpp>
#include <sensor_msgs/msg/imu.hpp>
#include <sensor_msgs/msg/nav_sat_fix.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <rclcpp/rclcpp.hpp>

#include <sensor_msgs/msg/imu.hpp>
#include <sensor_msgs/msg/nav_sat_fix.hpp>

namespace vrx_bridge
{
Expand Down
8 changes: 8 additions & 0 deletions launch/vrx_bringup.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<launch>
<!-- component container(動的にノードを載せられるExecutor)を用意 -->
<node_container pkg="rclcpp_components" exec="component_container_mt" name="vrx_bridge_container" namespace="vrx_bridge" args="">
<composable_node pkg="vrx_bridge" plugin="vrx_bridge::VRXBridgeComponent" name="vrx_bridge_component">
</composable_node>
</node_container>
<include file="$(find-pkg-share robotx_ekf)/launch/ekf.launch.xml"/>
</launch>
3 changes: 2 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
<depend>geographic_msgs</depend>
<depend>sensor_msgs</depend>
<depend>geometry_msgs</depend>
<depend>launch</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ouxt_lint_auto</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
12 changes: 4 additions & 8 deletions src/vrx_bridge_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

namespace vrx_bridge
{
VRXBridgeComponent::VRXBridgeComponent(
const rclcpp::NodeOptions & options)
VRXBridgeComponent::VRXBridgeComponent(const rclcpp::NodeOptions & options)
: Node("vrx_bridge", options)
{
gps_sub_ = this->create_subscription<sensor_msgs::msg::NavSatFix>(
Expand All @@ -37,8 +36,7 @@ VRXBridgeComponent::VRXBridgeComponent(
goal_pub_ = this->create_publisher<geometry_msgs::msg::PoseStamped>("/move_base_simple/goal", 1);
}

void VRXBridgeComponent::GPStopic_callback(
const sensor_msgs::msg::NavSatFix::SharedPtr msg)
void VRXBridgeComponent::GPStopic_callback(const sensor_msgs::msg::NavSatFix::SharedPtr msg)
{
geographic_msgs::msg::GeoPoseStamped gps;
gps.header = msg->header;
Expand All @@ -49,8 +47,7 @@ void VRXBridgeComponent::GPStopic_callback(
gps_pub_->publish(gps);
}

void VRXBridgeComponent::Imutopic_callback(
const sensor_msgs::msg::Imu::SharedPtr msg)
void VRXBridgeComponent::Imutopic_callback(const sensor_msgs::msg::Imu::SharedPtr msg)
{
sensor_msgs::msg::Imu imu;
imu.header = msg->header;
Expand All @@ -59,8 +56,7 @@ void VRXBridgeComponent::Imutopic_callback(
imu_pub_->publish(imu);
}

void VRXBridgeComponent::Goaltopic_callback(
const geometry_msgs::msg::PoseStamped::SharedPtr msg)
void VRXBridgeComponent::Goaltopic_callback(const geometry_msgs::msg::PoseStamped::SharedPtr msg)
{
geometry_msgs::msg::PoseStamped goal;
goal.header = msg->header;
Expand Down
3 changes: 1 addition & 2 deletions src/vrx_bridge_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
rclcpp::NodeOptions options;
auto component =
std::make_shared<vrx_bridge::VRXBridgeComponent>(options);
auto component = std::make_shared<vrx_bridge::VRXBridgeComponent>(options);
rclcpp::spin(component);
rclcpp::shutdown();
return 0;
Expand Down

0 comments on commit 0de0dbb

Please sign in to comment.