Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iCartのROS 2パッケージ作成 #62

Open
ShunjiHashimoto opened this issue Nov 21, 2024 · 9 comments
Open

iCartのROS 2パッケージ作成 #62

ShunjiHashimoto opened this issue Nov 21, 2024 · 9 comments
Assignees

Comments

@ShunjiHashimoto
Copy link
Owner

No description provided.

@ShunjiHashimoto
Copy link
Owner Author

https://qiita.com/naga-karupi/items/f7e1dc4cfe65e5783181
こちらを参考にros2 pkgを作成する。

@ShunjiHashimoto
Copy link
Owner Author

https://github.com/ShunjiHashimoto/icart_mini_navigation
パッケージを作った

@ShunjiHashimoto
Copy link
Owner Author

次はypspurをros2で動かすのを試す。

@ShunjiHashimoto ShunjiHashimoto self-assigned this Nov 21, 2024
@ShunjiHashimoto
Copy link
Owner Author

https://github.com/open-rdc/icart_mini_driver
pkg構造について修正しようとしたがやめた。このまま使用する。

@ShunjiHashimoto
Copy link
Owner Author

非常停止ボタンについて聞く必要あり。

@ShunjiHashimoto
Copy link
Owner Author

icart-mini driverの修正箇所
CMakeList

cmake_minimum_required(VERSION 3.5)
project(icart_mini_driver)

# 必要なパッケージの検索
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)

# YP-Spur のライブラリとヘッダのパスを明示的に指定
find_library(YPSPUR_LIB ypspur PATHS /usr/local/lib)
find_path(YPSPUR_INCLUDE_DIR ypspur.h PATHS /usr/local/include)

if(NOT YPSPUR_LIB OR NOT YPSPUR_INCLUDE_DIR)
  message(FATAL_ERROR "YP-Spur library or include directory not found")
endif()

# 実行可能ファイルの生成
add_executable(icart_mini_driver
    src/icart_mini_driver_node.cpp
)

# YP-Spur ライブラリとヘッダをリンク
target_include_directories(icart_mini_driver PUBLIC ${YPSPUR_INCLUDE_DIR})
target_link_libraries(icart_mini_driver ${YPSPUR_LIB})

# rclcpp をリンク
ament_target_dependencies(icart_mini_driver rclcpp geometry_msgs nav_msgs sensor_msgs tf2 tf2_geometry_msgs)

# スクリプトのインストール
install(PROGRAMS scripts/ypspur_coordinator_bridge
    DESTINATION lib/${PROJECT_NAME})

# 共有ファイルのインストール
ament_package()

packages

<?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>icart_mini_driver</name>
  <version>0.1.0</version>
  <description>ROS 2 wrapper for ypspur </description>
  <maintainer email="[email protected]">Haruyama Kenta</maintainer>
  <license>BSD</license>

  <!-- <buildtool_depend>ament_cmake</buildtool_depend> -->
  <buildtool_depend>ament_cmake_auto</buildtool_depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <depend>ros2launch</depend>
  <depend>rclcpp</depend>
  <depend>geometry_msgs</depend>
  <depend>nav_msgs</depend>
  <depend>sensor_msgs</depend>
  <depend>tf2</depend>
  <depend>tf2_geometry_msgs</depend>
  <depend>tf2_ros</depend>
  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

@ShunjiHashimoto
Copy link
Owner Author

ShunjiHashimoto commented Nov 21, 2024

ros2 pkg create icart_mini_ypspur_bridge \
--build-type ament_cmake \
--node-name icart_mini_ypspur_bridge \
--dependencies rclcpp std_msgs sensor_msgs geometry_msgs nav_msgs tf2 tf2_geometry_msgs tf2_ros

これで依存関係を書いたりするのも楽できる

@ShunjiHashimoto
Copy link
Owner Author

ShunjiHashimoto commented Nov 22, 2024

freezeコマンド、unfreezeコマンドを作るか。

@ShunjiHashimoto
Copy link
Owner Author

freeコマンド、positiveフィードバック、手押しでもできるようになる

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant