ROS2下YOLO+Moveit+PCL機械臂自主避障抓取方案

整體運行架構

1.運行相機取像節點
. ./install/setup.bash
ros2 launch orbbec_camera gemini_330_series.launch.py depth_registration:=true
2.運行根據圖像x,y獲取z的service

基本操作記錄:

  1. 創建python包,在src目錄下
    ros2 pkg create test_python_topic --build-type ament_python --dependencies rclpy --license Apache-2.0
    2.創建service
    ros2 pkg create getzservice --dependencies sensor_msgs rosidl_default_generators --license Apache-2.0

source ~/test_ws/install/setup.bash

一、奧比中光Gemini335相機使用

https://www.orbbec.com.cn/index/Gemini330/info.html?cate=119&id=74
https://github.com/orbbec/OrbbecSDK_v2/releases
1.

cd ~/ros2_ws/
# 構建 Release 版本,默認為 Debug
colcon build --event-handlers  console_direct+  --cmake-args  -DCMAKE_BUILD_TYPE=Release
. ./install/setup.bash
ros2 launch orbbec_camera gemini_330_series.launch.py depth_registration:=true

話題是 /camera/depth_registered/points
得到的圖像是sensor_msgs/msg/PointCloud2
ros2 interface show sensor_msgs/msg/PointCloud2 可以看到圖像數據格式

. ./install/setup.bash
rviz2

寫一個節點

二、YOLO ROS的使用

https://github.com/mgonzs13/yolo_ros/tree/main

終端1:

. ./install/setup.bash
ros2 launch orbbec_camera gemini_330_series.launch.py depth_registration:=true

終端2:

. ./install/setup.bash
ros2 launch yolo_bringup yolo.launch.py input_image_topic:=/camera/color/image_raw  device:=cpu

終端3:

. ./install/setup.bash
ros2 topic info /camera/color/image_raw
rviz2

三、睿爾曼RM65的使用

https://develop.realman-robotics.com/robot/quickUseManual/

快速啟動:

colcon build
source ~/ros2_ws/install/setup.bash
ros2 launch rm_bringup rm_65_bringup.launch.py

一個一個啟動:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/zc9527/ros2_ws/src/ros2_rm_robot/rm_driver/lib

ros2 launch rm_driver rm_65_driver.launch.pyros2 launch rm_description rm_65_display.launch.pyros2 launch rm_control rm_65_control.launch.pyros2 launch rm_65_config real_moveit_demo.launch.py

joint_states代表機械臂當前的狀態,我們的rm_driver功能包運行時會發布該話題,這樣rviz中的模型就會根據實際的機械臂狀態進行運動。

rm_control功能包為實現moveit2控制真實機械臂時所必須的一個功能包,該功能包的主要作用為將moveit2規劃好的路徑點進行進一步的細分,將細分后的路徑點以透傳的方式給到rm_driver,實現機械臂的規劃運行。

rm_description功能包為顯示機器人模型和TF變換的功能包,通過該功能包,我們可以實現電腦中的虛擬機械臂與現實中的實際機械臂的聯動的效果
/robot_state_publisher

rm_moveit2_config是實現Moveit2控制真實機械臂的功能包,該功能包的主要作用為調用官方的Moveit2框架,結合我們機械臂本身的URDF生成適配于我們機械臂的moveit2的配置和啟動文件,通過該功能包我們可以實現moveit2控制虛擬機械臂和控制真實機械臂。
/interactive_marker_display_99263946702096
/move_group
/move_group_private_105684501566768
/moveit_simple_controller_manager
/rviz
/rviz_ssp_robot_description
/transform_listener_impl_5a47b008a910
/transform_listener_impl_601e972d1ab0

ros2 run rqt_graph rqt_graph
節點關系圖
rm_control/rm_control
rm_description/robot_state_publisher
rm_65_config /moveit_simple_controller_manager
rm_65_config //transform_listener_impl

ompl_planning不會自動生成,需要自己添加文件內容如下:

planning_plugin: ompl_interface/OMPLPlanner
request_adapters: >-default_planner_request_adapters/AddTimeOptimalParameterizationdefault_planner_request_adapters/ResolveConstraintFramesdefault_planner_request_adapters/FixWorkspaceBoundsdefault_planner_request_adapters/FixStartStateBoundsdefault_planner_request_adapters/FixStartStateCollisiondefault_planner_request_adapters/FixStartStatePathConstraints
start_state_max_bounds_error: 0.1
planner_configs:SBLkConfigDefault:type: geometric::SBLrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()ESTkConfigDefault:type: geometric::ESTrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0 setup()goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05LBKPIECEkConfigDefault:type: geometric::LBKPIECErange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5BKPIECEkConfigDefault:type: geometric::BKPIECErange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9failed_expansion_score_factor: 0.5  # When extending motion fails, scale score by factor. default: 0.5min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5KPIECEkConfigDefault:type: geometric::KPIECErange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9 (0.0,1.]failed_expansion_score_factor: 0.5  # When extending motion fails, scale score by factor. default: 0.5min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5RRTkConfigDefault:type: geometric::RRTrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05RRTConnectkConfigDefault:type: geometric::RRTConnectrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()RRTstarkConfigDefault:type: geometric::RRTstarrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05delay_collision_checking: 1  # Stop collision checking as soon as C-free parent found. default 1TRRTkConfigDefault:type: geometric::TRRTrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05max_states_failed: 10  # when to start increasing temp. default: 10temp_change_factor: 2.0  # how much to increase or decrease temp. default: 2.0min_temperature: 10e-10  # lower limit of temp change. default: 10e-10init_temperature: 10e-6  # initial temperature. default: 10e-6frountier_threshold: 0.0  # dist new state to nearest neighbor to disqualify as frontier. default: 0.0 set in setup()frountierNodeRatio: 0.1  # 1/10, or 1 nonfrontier for every 10 frontier. default: 0.1k_constant: 0.0  # value used to normalize expresssion. default: 0.0 set in setup()PRMkConfigDefault:type: geometric::PRMmax_nearest_neighbors: 10  # use k nearest neighbors. default: 10PRMstarkConfigDefault:type: geometric::PRMstarFMTkConfigDefault:type: geometric::FMTnum_samples: 1000  # number of states that the planner should sample. default: 1000radius_multiplier: 1.1  # multiplier used for the nearest neighbors search radius. default: 1.1nearest_k: 1  # use Knearest strategy. default: 1cache_cc: 1  # use collision checking cache. default: 1heuristics: 0  # activate cost to go heuristics. default: 0extended_fmt: 1  # activate the extended FMT*: adding new samples if planner does not finish successfully. default: 1BFMTkConfigDefault:type: geometric::BFMTnum_samples: 1000  # number of states that the planner should sample. default: 1000radius_multiplier: 1.0  # multiplier used for the nearest neighbors search radius. default: 1.0nearest_k: 1  # use the Knearest strategy. default: 1balanced: 0  # exploration strategy: balanced true expands one tree every iteration. False will select the tree with lowest maximum cost to go. default: 1optimality: 1  # termination strategy: optimality true finishes when the best possible path is found. Otherwise, the algorithm will finish when the first feasible path is found. default: 1heuristics: 1  # activates cost to go heuristics. default: 1cache_cc: 1  # use the collision checking cache. default: 1extended_fmt: 1  # Activates the extended FMT*: adding new samples if planner does not finish successfully. default: 1PDSTkConfigDefault:type: geometric::PDSTSTRIDEkConfigDefault:type: geometric::STRIDErange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05use_projected_distance: 0  # whether nearest neighbors are computed based on distances in a projection of the state rather distances in the state space itself. default: 0degree: 16  # desired degree of a node in the Geometric Near-neightbor Access Tree (GNAT). default: 16max_degree: 18  # max degree of a node in the GNAT. default: 12min_degree: 12  # min degree of a node in the GNAT. default: 12max_pts_per_leaf: 6  # max points per leaf in the GNAT. default: 6estimated_dimension: 0.0  # estimated dimension of the free space. default: 0.0min_valid_path_fraction: 0.2  # Accept partially valid moves above fraction. default: 0.2BiTRRTkConfigDefault:type: geometric::BiTRRTrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()temp_change_factor: 0.1  # how much to increase or decrease temp. default: 0.1init_temperature: 100  # initial temperature. default: 100frountier_threshold: 0.0  # dist new state to nearest neighbor to disqualify as frontier. default: 0.0 set in setup()frountier_node_ratio: 0.1  # 1/10, or 1 nonfrontier for every 10 frontier. default: 0.1cost_threshold: 1e300  # the cost threshold. Any motion cost that is not better will not be expanded. default: infLBTRRTkConfigDefault:type: geometric::LBTRRTrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05epsilon: 0.4  # optimality approximation factor. default: 0.4BiESTkConfigDefault:type: geometric::BiESTrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()ProjESTkConfigDefault:type: geometric::ProjESTrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05LazyPRMkConfigDefault:type: geometric::LazyPRMrange: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()LazyPRMstarkConfigDefault:type: geometric::LazyPRMstarSPARSkConfigDefault:type: geometric::SPARSstretch_factor: 3.0  # roadmap spanner stretch factor. multiplicative upper bound on path quality. It does not make sense to make this parameter more than 3. default: 3.0sparse_delta_fraction: 0.25  # delta fraction for connection distance. This value represents the visibility range of sparse samples. default: 0.25dense_delta_fraction: 0.001  # delta fraction for interface detection. default: 0.001max_failures: 1000  # maximum consecutive failure limit. default: 1000SPARStwokConfigDefault:type: geometric::SPARStwostretch_factor: 3.0  # roadmap spanner stretch factor. multiplicative upper bound on path quality. It does not make sense to make this parameter more than 3. default: 3.0sparse_delta_fraction: 0.25  # delta fraction for connection distance. This value represents the visibility range of sparse samples. default: 0.25dense_delta_fraction: 0.001  # delta fraction for interface detection. default: 0.001max_failures: 5000  # maximum consecutive failure limit. default: 5000TrajOptDefault:type: geometric::TrajOptrm_group:planner_configs:- SBLkConfigDefault- ESTkConfigDefault- LBKPIECEkConfigDefault- BKPIECEkConfigDefault- KPIECEkConfigDefault- RRTkConfigDefault- RRTConnectkConfigDefault- RRTstarkConfigDefault- TRRTkConfigDefault- PRMkConfigDefault- PRMstarkConfigDefault- FMTkConfigDefault- BFMTkConfigDefault- PDSTkConfigDefault- STRIDEkConfigDefault- BiTRRTkConfigDefault- LBTRRTkConfigDefault- BiESTkConfigDefault- ProjESTkConfigDefault- LazyPRMkConfigDefault- LazyPRMstarkConfigDefault- SPARSkConfigDefault- SPARStwokConfigDefault- TrajOptDefault

moveL運動:
ros2 launch rm_driver rm_65_driver.launch.py
ros2 launch rm_example rm_6dof_movej.launch.py

四、moveit2的使用

https://github.com/moveit/moveit2_tutorials/tree/humble
https://blog.csdn.net/forever0007/article/details/143745333
https://zhuanlan.zhihu.com/p/616101551

五、moveit2和睿爾曼機器人的聯合使用

ros2 pkg create \--build-type ament_cmake \--dependencies moveit_ros_planning_interface rclcpp \--node-name hello_moveit hello_moveit
source install/setup.bash
ros2 run hello_moveit hello_moveit

最簡單使用

#include <memory>#include <rclcpp/rclcpp.hpp>
#include <moveit/move_group_interface/move_group_interface.h>int main(int argc, char* argv[])
{// Initialize ROS and create the Noderclcpp::init(argc, argv);auto const node = std::make_shared<rclcpp::Node>("hello_moveit", rclcpp::NodeOptions().automatically_declare_parameters_from_overrides(true));// Create a ROS loggerauto const logger = rclcpp::get_logger("hello_moveit");// Create the MoveIt MoveGroup Interfaceusing moveit::planning_interface::MoveGroupInterface;auto move_group_interface = MoveGroupInterface(node, "rm_group");// Set a target Poseauto const target_pose = [] {geometry_msgs::msg::Pose msg;msg.orientation.w = 1.0;msg.position.x = 0.28;msg.position.y = -0.2;msg.position.z = 0.5;return msg;}();move_group_interface.setPoseTarget(target_pose);// Create a plan to that target poseauto const [success, plan] = [&move_group_interface] {moveit::planning_interface::MoveGroupInterface::Plan msg;auto const ok = static_cast<bool>(move_group_interface.plan(msg));return std::make_pair(ok, msg);}();// Execute the planif (success){move_group_interface.execute(plan);}else{RCLCPP_ERROR(logger, "Planing failed!");}// Shutdown ROSrclcpp::shutdown();return 0;
}

六、ROS2 PCL的使用

https://github.com/adrian-soch/pcl_tutorial?utm_source=chatgpt.com

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/pingmian/94011.shtml
繁體地址,請注明出處:http://hk.pswp.cn/pingmian/94011.shtml
英文地址,請注明出處:http://en.pswp.cn/pingmian/94011.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

快速入門Vue3——初體驗

目錄 前言 一、搭建環境 1.1、安裝Node.js 1.2、安裝Vite 二、項目創建 三、運行項目 四、集成Pinia 4.1、Pinia介紹 4.2、Pinia安裝 五、集成VueUse 5.1、vueuse簡介 5.2、vueuse安裝 六、集成Vant 6.1、Vant簡介 6.2、Vant安裝 前言 本專欄主要介紹如何使用…

深入理解Kubernetes核心:標簽與標簽選擇器實戰解析

在管理 Kubernetes 集群時&#xff0c;隨著 Pods、Services 等資源數量的增長&#xff0c;如何有效地組織和篩選它們&#xff0c;成為了一個核心問題。Kubernetes 為此提供了一個簡單卻極其強大的機制&#xff1a;標簽&#xff08;Labels&#xff09;和標簽選擇器&#xff08;L…

哈希和字符串哈希

哈希&#xff08;Hash&#xff09; Hash 表 Hash 表又稱為散列表&#xff0c;一般由 Hash 函數&#xff08;散列函數&#xff09;與鏈表結構共同實現。與離散化思想類似&#xff0c;當我們要對若干復雜信息進行統計時&#xff0c;可以用 Hash 函數把這些復雜信息映射到一個容…

【Docker基礎】Docker-Compose核心配置文件深度解析:從YAML語法到高級配置

目錄 前言 1 YAML基礎語法解析 1.1 YAML格式簡介 1.2 Docker-compose中的YAML語法規則 1.3 YAML數據類型在Compose中的應用 2 docker-compose.yml文件結構剖析 2.1 基本文件結構 2.2 版本聲明詳解 3 services配置深度解析 3.1 服務定義基礎 3.2 鏡像與構建配置 3.3…

如何判斷是否應該為了一個小功能而引入一個大體積的庫

在軟件開發中&#xff0c;判斷是否應該為了一個看似微小的功能&#xff0c;而引入一個大體積的第三方庫&#xff0c;是一項極其重要的、需要進行審慎的“投入產出比”分析的技術決策。這個決策&#xff0c;絕不能&#xff0c;僅僅基于“實現功能的便利性”&#xff0c;而必須&a…

相機定屏問題分析五:【跳幀異常】照片模式1x以上的焦段拍照之后定屏

【關注我&#xff0c;后續持續新增專題博文&#xff0c;謝謝&#xff01;&#xff01;&#xff01;】 上一篇我們講了&#xff1a; 這一篇我們開始講&#xff1a; 相機定屏問題分析五&#xff1a;【跳幀異常】照片模式1x以上的焦段拍照之后定屏9573412 目錄 一、問題背景 二…

Non-stationary Diffusion For Probabilistic Time Series Forecasting論文閱讀筆記

Non-stationary Diffusion For Probabilistic Time Series Forecasting 摘要 時間序列數據受到潛在的物理動力學和外部影響&#xff0c;其不確定性通常隨時間而變化。現有的去噪擴散概率模型&#xff08;DDPMs&#xff09;受到加性噪聲模型&#xff08;ANM&#xff09;的恒定方…

解決Docker 無法連接到官方鏡像倉庫

這個錯誤&#xff1a; Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)表示 Docker 無法連接到官方鏡像倉庫 registry-1.docker…

解決RAGFlow啟動時Elasticsearch容器權限錯誤的技術指南

文章目錄 問題現象 根本原因分析 解決方案步驟 1. 定位宿主機數據目錄 2. 修復目錄權限 3. 驗證權限狀態 4. 重啟服務 5. 檢查啟動狀態 永久解決方案:優化Docker Compose配置 高級故障排除 技術原理 問題現象 在啟動RAGFlow項目時,執行 docker logs ragflow-es-01 發現Elast…

【C++高階六】哈希與哈希表

【C高階六】哈希與哈希表1.什么是哈希&#xff1f;2.unordered系列容器3.哈希表3.1將key與存儲位置建立映射關系3.1.1直接定址法3.1.2除留余數法&#xff08;產生哈希沖突&#xff09;3.2解決哈希沖突的方法3.2.1閉散列&#xff08;開放定址法&#xff09;3.3.2開散列&#xff…

Vue 3 +Ant Design Vue 父容器樣式不影響子級,隔離

公共樣式文件 common.scss.zz-ant-status-bar {div {font-size: 12px;padding: 0 8px;} }頁面代碼<div class"zz-ant-status-bar"><a-row><a-col :span"6" ><a-progress :percent"progress.percent" size"small"…

k8s 簡介及部署方法以及各方面應用

Kubernetes 簡介及部署方法Kubernetes&#xff08;簡稱 K8s&#xff09;是一個開源的容器編排平臺&#xff0c;用于自動化容器化應用的部署、擴展、管理和運維。它由 Google 基于內部的 Borg 系統經驗開發&#xff0c;2014 年開源后由云原生計算基金會&#xff08;CNCF&#xf…

Class A 包含字段 x Class B 也包含字段 x,如果判斷List<A> lista 和 List<B> listb 有相同的 x?

要判斷兩個不同類型的對象列表 List<A> 和 List<B> 是否包含相同的 x字段值&#xff08;即兩個列表中至少有一個 x是相同的&#xff09;&#xff0c;你可以使用 Java 8 的 Stream API 來實現。import java.util.List; import java.util.Set; import java.util.stre…

SpringBoot整合Camunda工作流

什么是工作流&#xff1f;概述 工作流是將一組任務組織起來以完成某個經營過程&#xff1a;定義了任務的觸發順序和觸發條件&#xff0c;每個任務可以由一個或多個軟件系統完成&#xff0c;也可以由一個或一組人完成&#xff0c;還可以由一個或多個人與軟件系統協作完成&#x…

2025年09月計算機二級Java選擇題每日一練——第四期

計算機二級中選擇題是非常重要的&#xff0c;所以開始寫一個每日一題的專欄。 答案及解析將在末尾公布&#xff01; 今日主題&#xff1a;面向對象特性 1、有兩個類 A 和 B 的定義如下&#xff1a; class A{final int x10;public void show(){System.out.print(x " &quo…

《Nature》新文解讀:電化學輔助核聚變的實驗驗證與機制分析

前言一篇于2025年8月發表在《Nature》期刊上的重磅研究&#xff0c;由加拿大不列顛哥倫比亞大學&#xff08;UBC&#xff09;Curtis P. Berlinguette教授領導的跨學科團隊完成&#xff0c;首次在實驗上證實&#xff1a;通過電化學方法向鈀金屬靶中加載氘&#xff0c;可顯著提升…

【基礎-判斷】用戶在長視頻、短視頻、直播、通話、會議、拍攝類應用等場景下,可以采用懸停適配在折疊屏半折態時,上屏進行瀏覽下屏進行交互操作

用戶在長視頻、短視頻、直播、通話、會議、拍攝類應用等場景下,可以采用懸停適配在折疊屏半折態時,上屏進行瀏覽下屏進行交互操作。 解釋如下: ? 1. 懸停態適配機制的核心設計 HarmonyOS 針對折疊屏半折態(懸停態)提供了分屏交互框架,其核心邏輯是: 上屏(Upper Scre…

nodejs安裝后 使用npm 只能在cmd 里使用 ,但是不能在poowershell使用,只能用npm.cmd

nodejs安裝后 使用npm 只能在cmd 里使用 &#xff0c;但是不能在poowershell使用&#xff0c;只能用npm.cmdnodejs版本&#xff1a;22.18.0 剛安裝好nodejs&#xff0c;在 PowerShell 中無法執行 npm&#xff0c;但能執行npm.cmd&#xff0c;這通常是因為 PowerShell 的執行策略…

【鏈表 - LeetCode】2. 兩數相加

誰都逃不掉 LeetCode &#xff01;&#xff01;哈哈哈~~~ 開刷&#xff1a;&#xff09; 2025年08月22日 題目&#xff1a;2. 兩數相加 - 力扣&#xff08;LeetCode&#xff09; 知識點&#xff1a;鏈表 /*** Definition for singly-linked list.* struct ListNode {* in…

WG-Tools 在線開發者工具推薦:完全免費、無廣告干擾、無需安裝、即開即用

WG-Tools 在線開發者工具箱全面探秘: 一站式效率提升平臺前言一. WG-Tools 平臺介紹 &#x1f6e0;?平臺概覽技術架構亮點二. 功能模塊詳細介紹 &#x1f3af;&#x1f4dd; 文本處理工具 (Text Tools)1. JSON工具2. XML工具3. 文本對比4. 正則表達式工具5. Markdown編輯器6. …