此博文主要是用来记录ROS-Kinetic 中,用于机器人轨迹规划的MoveIt功能包的学习记录。
引:这个教程主要是通过Moveit工具箱,并且使用MoveGroup Interface, 同时创建一个 moveit_msgs::Grasp对象,实现机器人抓取物品,执行轨迹,并放下物品的全过程仿真。
关注点: 这个教程不仅仅是关于抓取和放下,同时也包含了RVIZ可视化,与机器人的运动学规划,非常具有学习意义。
第一部分: 了解 moveit_msgs/Grasp.msg.
定义:这是一个消息类, .msg文件是ROS在进行Topic(话题通信时),所预先定义的传送信息内容的预设格式。
其中包含内容:
(1)trajectory_msgs/JointTrajectory pre_grasp_posture: 这个变量定义了,机器人在进行抓取之前,在end_effector末端执行器这个运动组(group)所对应的机器人的轨迹位置。-----实际上就是抓之前的位姿。
(2)trajectory_msgs/JointTrajectory grasp_posture: 这个变量定义了,机器人在进行抓取时,在end_effector末端执行器这个运动组(group)所对应的机器人的轨迹位置。-----实际上就是抓取时的位姿
(3)geometry_msgs/PoseStamped grasp_pose: 这个是一个Pose变量,定义了在机器人尝试抓取时,末端执行其的pose(位置坐标+转角)
(4)moveit_msgs/GripperTranslation pre_grasp_approach: 这个变量定义了,在进行抓取之前,机器人末端的前进方向,以及前进距离;(从哪个方向接近被抓物体? 沿着这个方向,前进多少距离)
(5)moveit_msgs/GripperTranslation post_grasp_retreat: 这个变量定义了,在进行抓取到了之后,机器人末端的回撤方向,以及在这个回撤方向上回撤距离。(抓到了物体,从哪个方向离开? 离开距离是多少?)
(6)moveit_msgs/GripperTranslation post_place_retreat: 这个变量定义了,在进行放下了物体之后,机器人末端的回撤方向,以及在这个回撤方向上回撤距离。(放下了物体,从哪个方向离开? 离开距离是多少?)
第二部分: 源代码
-> 官方教程主要以代码实例为主,所以,在下边的代码中,主要通过注释的方式,解释代码含义,通过代码实例,学习MoveIt内部内容。
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2012, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Willow Garage nor the names of its
* contributors may be used to endorse or promote products