修改默认生成的 #_moveit_config 包及配置文件
1.改写 demo.launch 文件
(1)改写 move_group.launch 文件的配置参数
<arg name="fake_execution" value="true"/> 改为 <arg name="fake_execution" value="false"/>
<!-- Run the main MoveIt executable without trajectory execution (we do not have controllers configured by default) -->
<include file="$(find wust_robot_moveit_config)/launch/move_group.launch">
<arg name="publish_monitored_planning_scene" value="true" />
<arg name="allow_trajectory_execution" value="true"/>
<arg name="fake_execution" value="false"/> //请看这个参数
<arg name="info" value="true"/>
<arg name="debug" value="$(arg debug)"/>
</include>
(2)改写 joint_state_publisher 节点启动参数
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<rosparam param="source_list">[/head/joint_states, /left_arm/joint_states, /right_arm/joint_states, /left_gripper/joint_states, /right_gripper/joint_states]</rosparam>
</node>
添加 rob_control 节点的启动文件
2.修改moveit_controller_manager参数
move_group.launch文件中,moveit_controller_manager在选择参数值时,“unless”前面那个velue值要修改为自己机器人名称
<!-- Trajectory Execution Functionality -->
<include ns="move_group" file="$(find wust_robot_moveit_config)/launch/trajectory_execution.launch.xml" if="$(arg allow_trajectory_execution)">
<arg name="moveit_manage_controllers" value="true" />
<arg name="moveit_controller_manager" value="wust_robot" unless="$(arg fake_execution)"/> //请看这里
<arg name="moveit_controller_manager" value="fake" if="$(arg fake_execution)"/>
</include>
moveit_controller_manager的参数 value=“ ”(我使用的名称)或(fake),这要取决于后面的参数fake_execution,而这个参数我们上一步已经改为了false,即当前moveit_controller_manager应该等于“我使用的机器人”,这个参数会传递给#_moveit_config/launch/trajectory_execution.launch.xml文件,该文件中有
<include file="$(find aubo_i5_moveit_config)/launch/$(arg moveit_controller_manager)_moveit_controller_manager.launch.xml" />
修改前应该启动fake_moveit_controller_manager.launch.xml,改动后启动 #_moveit_controller_manager.launch.xml,机器人模型中写明的机器人名称(name属性),会作为前缀写入这个文件的文件名,请前后保持统一,理解各个文件之间的调用关系。
3. 改写 #_moveit_controller_manager.launch.xml 文件
这个文件用于配置 MoveIt 的控制器,我们需要将MoveIt 的控制器指向我们上一步创建的控制器
<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 -->
<rosparam file="$(find my_robot_name_moveit_config)/config/controllers.yaml"/>
</launch>
将my_robot_name_moveit_config修改为你自己的moveit配置文件目录名称
4. 创建 controllers.yaml 文件
这个控制器用于直接和我们的机器人进行交互,上一步的代码最后一句指向了config目录下一个叫做controllers.yaml的文件,这个文件决定了你所使用的moveit控制器的基本参数。我们打开配置文件夹中的config目录,发现只有fake_controllers.yaml,所以,现在要做的就是复制一份这个文件,然后将名字改为controllers.yaml,打开这个新文件,将文件修改成如下形式:
controller_list:
- name: "aubo_i5"
action_ns: follow_joint_trajectory
type: FollowJointTrajectory
joints:
- shoulder_joint
- upperArm_joint
- foreArm_joint
- wrist1_joint
- wrist2_joint
- wrist3_joint
参数含义就好
**name:**这里你可以写一个与你机器人相关的名称,方便你使用
action_ns:follow_joint_trajectory ,follow_joint_trajectory 是后续action的名称的一部分,有关action的内容在下一章里,将来你需要填一个action的名称,这个名称就在这个配置文件里确定了,就是name/action_ns所代表的对应字符串的组合。
type: FollowJointTrajectory ,这个类型是ros下的自带action类型,是一种控制机械臂运动轨迹的数据结构,请原样填写,将来你可能还想控制手抓之类的结构,所填写的类型都是不一样的。
**joints:**这里是你机器人(机械臂)的关节名称,这些名称源自你的机器人模型文件,我们的controllers.yaml文件复制于fake_controllers.yaml文件,这部分应该是自动生成的。
来源:CSDN
作者:nmssg1
链接:https://blog.csdn.net/nmssg1/article/details/100665543