6R机械臂运动规划及仿真

博客 动态
0 167
羽尘
羽尘 2023-05-13 22:55:03
悬赏:0 积分 收藏

6R机械臂运动规划及仿真

博客地址:https://www.cnblogs.com/zylyehuo/

参考链接

Moveit!机械臂控制

文件下载-古月ROS教程视频配套资料

解决Could not find a package configuration file provided by “manipulation_msgs“

moveIt之Unable to identify any set of controllers that can actuate the specified joints问题解决

Unable to identify any set of controllers that can actuate the specified joints: joint1 joint2 ...出错

环境配置

Ubuntu 18.04 melodic

成果图

Part 1: Rviz 机械臂仿真

step1: 下载机械臂模型

下载地址

文件下载-古月ROS教程视频配套资料

step2: 创建工作空间

mkdir -p 6R_mechanical_arm/src
cd 6R_mechanical_arm
catkin_make

step3: src文件夹

将之前下载的机械臂模型中 description、gazebo、planning文件夹复制到 src文件夹下

step4: 在 rviz 中显示机械臂模型

在终端中运行 roscore
在工作空间 6R_mechanical_arm 中打开终端

roslaunch marm_description view_arm.launch

step5: 安装 MoveIt

在终端执行以下命令
sudo apt-get install ros-melodic-moveit

step6: 启动 MoveIt

在终端执行以下命令
rosrun moveit_setup_assistant moveit_setup_assistant

step7: 配置 MoveIt

(1)Start

(2)Self-Collisions

(3)Planning Groups(核心)

检查是否与下图一致

(4)Robot Poses

(5)End Effectors

(6)Author Information

(7)Configuration Files

step8: 重新编译工作空间

step9: 启动demo文件,测试 rviz 仿真环境

拖动规划

直接鼠标拖动机械臂末端执行器

点击 plan ,进行路径规划

点击 excute ,机械臂运动

设置动画是否循环播放

随机目标点规划

设置初始位姿

添加场景物体

可通过拖动箭头变换位置

Part 2: MoveIt 基础编程

以下代码运行都是在 rviz 打开的前提下执行

关节空间规划

在工作空间中打开终端

source ./devel/setup.bash

rosrun marm_planning moveit_fk_demo.py

工作空间规划

在工作空间中打开终端

source ./devel/setup.bash

rosrun marm_planning moveit_ik_demo.py

笛卡尔路径规划

显示路径

走直线

在工作空间中打开终端

source ./devel/setup.bash

rosrun marm_planning moveit_cartesian_demo.py _cartesian:=True   (走直线)

走曲线

在工作空间中打开终端

source ./devel/setup.bash

rosrun marm_planning moveit_cartesian_demo.py _cartesian:=False  (走曲线)

*

避障规划

在工作空间中打开终端

source ./devel/setup.bash

rosrun marm_planning moveit_obstacles_demo.py

Part 3: Gazebo 机械臂仿真

step1: 依赖文件配置

(1)关节轨迹控制器

trajectory_control.yaml

arm_trajectory_controller.launch

(2)MoveIt 控制器

在 6R_mechanical_arm/src/marm_moveit_config/config 路径下新建 controllers.yaml 文件

6R_mechanical_arm/src/marm_moveit_config/config/controllers.yaml

controller_manager_ns: controller_manager
controller_list:
  - name: arm/arm_joint_controller
    action_ns: follow_joint_trajectory
    type: FollowJointTrajectory
    default: true
    joints:
      - joint1
      - joint2
      - joint3
      - joint4
      - joint5
      - joint6

  - name: arm/gripper_controller
    action_ns: follow_joint_trajectory
    type: FollowJointTrajectory
    default: true
    joints:
      - finger_joint1
      - finger_joint2

6R_mechanical_arm/src/marm_moveit_config/launch/arm_moveit_controller_manager.launch.xml

<launch>
  <!-- Set the param that trajectory_execution_manager needs to find the controller plugin -->
  <arg name="moveit_controller_manager" default="moveit_simple_controller_manager/MoveItSimpleControllerManager" />
  <param name="moveit_controller_manager" value="$(arg moveit_controller_manager)"/>

  <!-- load controller_list -->
  <!-- Gazebo -->
  <rosparam file="$(find marm_moveit_config)/config/controllers.yaml"/>
</launch>

6R_mechanical_arm/src/marm_moveit_config/launch/moveit_planning_execution.launch

<launch>
 # The planning and execution components of MoveIt! configured to 
 # publish the current configuration of the robot (simulated or real)
 # and the current state of the world as seen by the planner
 <include file="$(find marm_moveit_config)/launch/move_group.launch">
  <arg name="publish_monitored_planning_scene" value="true" />
 </include>
 # The visualization component of MoveIt!
 <include file="$(find marm_moveit_config)/launch/moveit_rviz.launch"/>

  <!-- We do not have a robot connected, so publish fake joint states -->
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="/use_gui" value="false"/> 
    <rosparam param="/source_list">[/arm/joint_states]</rosparam>
  </node>

</launch>

(3)启动环境

arm_world.launch

(4)联结所有 launch 文件

arm_bringup_moveit.launch

step2: 启动 gazebo 和 rviz 仿真环境

在工作空间路径下打开终端,输入以下命令

source ./devel/setup.bash

roslaunch marm_gazebo arm_bringup_moveit.launch

调整 rviz 设置

调整 gazebo 设置

存在模型抖动现象,暂时不调整

step3: 使用 MoveIt

调整机器人目标位置

点击 Plan & Execute

问题汇总

1、Could not find a package configuration file provided by “manipulation_msgs“

  • 在这里插入图片描述

解决方法

参考地址:解决Could not find a package configuration file provided by “manipulation_msgs“

下载地址:

GitHub - ros-interactive-manipulation/manipulation_msgs: The package in this repo is DEPRECATED (see https://github.com/ros-interactive-manipulation/manipulation_msgs/issues/9)

GitHub - ros-interactive-manipulation/household_objects_database_msgs: Messages for the household_objects_database. The package in this repo is DEPRECATED and you're advised to see moveit_msgs instead (see also https://github.com/ros-interactive-manipulation/household_objects_database_msgs/issues/5)

2、点击 plan&execute 后,rviz有变化,gazebo无变化

解决方案一:
在终端执行以下代码

sudo apt install ros-melodic-ros-controllers
解决方案二:
修改文件:
工作空间/src/marm_moveit_config/launch/trajectory_execution.launch.xml

将参数 pass_all_args="true" 删掉即可
posted @ 2023-05-13 22:31  zylyehuo  阅读(0)  评论(0编辑  收藏  举报
回帖
    羽尘

    羽尘 (王者 段位)

    2233 积分 (2)粉丝 (11)源码

     

    温馨提示

    亦奇源码

    最新会员