ROS下利⽤moveit控制gazebo模型并在rviz中显⽰的探索总结ur_gazebo/ur5.launch
ur5_moveit_config/ur5_moveit_planning_execution.launch
ur5_moveit_config / moveit_rviz.launch
ur5.launch 启动了gazebo,以及控制器,moveit_rviz.launch 启动了rviz并加载模型,最后⼀个启动moveit的控制gui,参考下图:
⼤概了解到做法之后开始⾃⼰的尝试:
第⼀步建⽴机器⼈的描述,⾸先利⽤catkin_create_package在catkin⼯作⽬录下建⽴⼀个名字为robot_description的包,在其中建⽴⽬录urdf,⾥⾯存放机器⼈的⼀个描述⽂件robot.urdf。urdf包含基本的link和joint,注意urdf的link是以tree的形式通过joint组织起来的,关键的地⽅在于要添加transmission标签和ros-control插件,如下所⽰:
<transmission name="foot_trans">
<type>transmission_interface/SimpleTransmission</type>
<joint name="foot">#改为你⾃⼰的名称
<hardwareInterface>PositionJointInterface</hardwareInterface>
</joint>
<actuator name="foot_motor">
<mechanicalReduction>50</mechanicalReduction>
</actuator>
</transmission>
<gazebo>
disturb>asmble<plugin name="ros_control" filename="libgazebo_ros_control.so"/>
</gazebo>
关于urdf的具体细节如transmission是⼲嘛的,为什么要加gazebo标签可以参考ros和gazebo官⽅的说明,urdf⽂件建成后要先⽤ roslaunch urdf_tutorial display.launch model:=/your directory to urdf/robot.urdf命令启动⼀个rviz来进⾏验证。之后
在robot_description下建⽴⼀个launch⽬录,并在其中建⽴⽂件robot.launch,把模型加载到gazebo进⾏验证,具体内容如下:
<launch>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="worlds/empty.world"/>
</include>
<!-- Load the URDF/Xacro model of our robot -->
<param name="robot_description"command="$(find xacro)/xacro.py '$(find robot_description)/urdf/robot.urdf'" /> <!-- Run a python script to the nd a rvice call to gazebo_ros to spawn a URDF robot -->
ever<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="fal" output="screen"
args="-urdf -model robot -param robot_description"/>
</launch>
都验证成功后第⼀步就结束了。
第⼆步配置gazebo的启动配置,建⽴⼀个robot_gazebo的包,⽅法同上,建⽴⽬录launch,controller,worlds。
在launch下建⽴robot_gazerbo.launch将上⾯的launch⽂件内容复制进来,并添加如下内容:
<!-- Robot state publisher -->
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="50.0" />
<param name="tf_prefix" type="string" value="" />
</node>
<!-- joint_state_controller -->
<rosparam file="$(find robot_gazebo)/controller/joint_state_controller.yaml" command="load"/>
<node name="joint_state_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn joint_state_controller" respawn="fal" output="screen"/>
figured
<rosparam file="$(find robot_gazebo)/controller/controller_group_robot.yaml" command="load"/>
<node name="group_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn
lf_group_controller" respawn="fal" output="screen"/>
在controller⽬录下建⽴joint_state_controller.yaml 并将
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
添加进去,再建⽴controller_group_robot.yaml 添加如下内容:
group_controller:
type: position_controllers/JointTrajectoryController
joints:#在urdf中创建的joint,改为你⾃⼰的名称
- hip
- knee
- foot
constraints:
goal_time: 0.6
stopped_velocity_tolerance: 0.05旁注
hip: {trajectory: 0.1, goal: 0.1}
knee: {trajectory: 0.1, goal: 0.1}
foot: {trajectory: 0.1, goal: 0.1}
stop_trajectory_duration: 0.5
state_publish_rate: 25
action_monitor_rate: 10
recognize是什么意思
和之前⼀样在这⾥我们启动了gazebo加载了和我们的模型和empty.world (如果要加载⾃⼰的可以在worlds下建⽴.world⽂件,并修改对应的<arg name="world_name" value="worlds/your_world.world"/> ),另启动了Robot state publisher,加载了 joint_state_controller.yaml,启动了controller_manager加载控制器。完成之后启动
roslaunch robot_gazebo robot_gazerbo.launch,启动后利⽤rostopic list查看会出现如下所⽰的内容:
/clock
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/t_link_state
/gazebo/t_model_state
/joint_states
/group_controller/command
/group_controller/follow_joint_trajectory/cancel
/group_controller/follow_joint_trajectory/feedbackunproper
/group_controller/follow_joint_trajectory/goal
/group_controller/follow_joint_trajectory/result
/group_controller/follow_joint_trajectory/status
/group_controller/state
英语学习计划书/rosout
/rosout_agg
/tf
/
tf_static
这样的话第⼆步就完成了。
第三步配置moveit,⾸先利⽤moveit tup_assistant ⽣成正确的配置⽂件,将⽂件夹命名为robot_moveit_config,也放在catkin的⼯作⽬录下,参照moveit官⽹教程,有些细节需要注意,配置Planning Groups 的时候需要同时配置Joints,Links和Chain,配置End Effectors设置Parent Link为末端的Link,参考下图:
服装行业前景
完成后launch demo查看配置是否满⾜要求:launch robot_moveit_config demo.launch
然⽽仅仅利⽤tup_assistant 是不够的,我们还需要配置其他⽂件,进⼊~/robot_moveit_config/config⽂件夹下配置controllers.yaml,写⼊以下内容:
controller_list:
- name: group_controller
action_ns: follow_joint_trajectory type: FollowJointTrajectory
joints:
- hip
- kneeextendexpand
- foot
进⼊~/robot_moveit_config/launch