Kinova_MOVO機(jī)器人基本操作及機(jī)械臂倒水demo實(shí)現(xiàn)
- 分類:技術(shù)博客
- 發(fā)布時(shí)間:2020-06-21 00:00:00
- 訪問(wèn)量:0
Kinova MOVO官網(wǎng)
Kinova參數(shù)頁(yè)
1、MOVO安裝教程
翻譯自movo-github-wiki
MOVO開(kāi)發(fā)硬件需求
官方只支持Ubuntu 14.04 Trusty, x64 platform (core i5, core i7), 8GB RAM。
軟件安裝
您需要安裝幾個(gè)開(kāi)發(fā)包才能在MOVO上進(jìn)行開(kāi)發(fā)。 一些包裝屬于Kinova外部開(kāi)發(fā)包,其他的是Kinova專用開(kāi)發(fā)包。 如果您在安裝Kinova開(kāi)發(fā)包時(shí)遇到任何障礙,請(qǐng)?jiān)诖颂巿?bào)告問(wèn)題。 對(duì)于任何專門針對(duì)外部庫(kù)的問(wèn)題,這些庫(kù)的支持團(tuán)隊(duì)可能是獲得修復(fù)的最佳選擇。 但是,我們很樂(lè)意回答您的任何問(wèn)題,并提供有關(guān)您使用MOVO開(kāi)發(fā)的任何問(wèn)題的幫助。 本節(jié)將指導(dǎo)您完成安裝過(guò)程。
-有兩種安裝的方式:自動(dòng)/手動(dòng)
自動(dòng)安裝腳本使用方式:創(chuàng)建工作區(qū)并克隆kinova-movo庫(kù)后,運(yùn)行交互式bash腳本* setup_remote_pc *以自動(dòng)執(zhí)行安裝。推薦采用自動(dòng)方式。
手動(dòng)安裝方式具體見(jiàn)此處。
連接到MOVO平臺(tái)
通過(guò)無(wú)線或有限兩種方式連接到MOVO平臺(tái)。
無(wú)線wifi(wifi名: MoVoWifi 密碼: Welcome00)
通過(guò)SSH登陸到MOVO,ssh movo@10.66.171.1,登陸密碼Welcome00。
若要將手柄連接到遠(yuǎn)程開(kāi)發(fā)者電腦上使用,打開(kāi)終端進(jìn)行以下操作:
cd ~/movo_ws
sws # alias sws='source ./devel/setup.bash' defined in .bashrc
roslaunch movo_remote_teleop movo_remote_teleop.launch
若要將手柄插在MOVO上使用,在遠(yuǎn)程開(kāi)發(fā)者電腦上SSH登陸到MOVO后,執(zhí)行以下操作:
cd ~/movo_ws
sws # alias sws='source ./devel/setup.bash' defined in .bashrc
roslaunch movo_remote_teleop movo_remote_teleop.launch
2、MOVO機(jī)器人的基本使用
官方提供了以下功能:
建立遠(yuǎn)程開(kāi)發(fā)者電腦與MOVO的連接
檢測(cè)遠(yuǎn)程連接狀態(tài)
使用真實(shí)機(jī)器人重新配置參數(shù)
查找Kinect序列號(hào)
為6自由度機(jī)械臂配置MOVO
-更新MOVO代碼
-診斷MOVO啟動(dòng)問(wèn)題
樣例DEMO
使用真實(shí)機(jī)器人建圖
使用真實(shí)機(jī)器人在rviz中導(dǎo)航地圖
使用直接操作模式控制真實(shí)機(jī)器人
使用輔助操作模式控制真實(shí)機(jī)器人
使用仿真機(jī)器人建圖
使用仿真機(jī)器人定位
3、制作倒水DEMO
基于Moveit對(duì)機(jī)械臂進(jìn)行規(guī)劃,具體學(xué)習(xí)可以參照此處:
通過(guò)c++接口調(diào)用Moveit進(jìn)行編程
ros::actionlib動(dòng)作服務(wù)器(action server)在動(dòng)作客戶端(action client)中的調(diào)用
ROS教程下載
以下為主程序
// movo_moveit_uoperbody.cpp
#include <moveit/move_group_interface/move_group.h>
#include <moveit/planning_scene_interface/planning_scene_interface.h>
#include <moveit_msgs/DisplayRobotState.h>
#include <moveit_msgs/DisplayTrajectory.h>
#include <moveit_msgs/AttachedCollisionObject.h>
#include <moveit_msgs/CollisionObject.h>
#include <control_msgs/GripperCommandActionGoal.h>
//grasp
#include <ros/ros.h>
#include <actionlib/client/simple_action_client.h>
#include <control_msgs/GripperCommandAction.h>
#include <control_msgs/GripperCommandGoal.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "movo_moveit");
ros::NodeHandle node_handle;
ros::AsyncSpinner spinner(1);
spinner.start();
//action grasp
actionlib::SimpleActionClient<control_msgs::GripperCommandAction> acr("/movo/right_gripper_controller/gripper_cmd", true);
ROS_INFO("Waiting for the gripper action server");
acr.waitForServer(ros::Duration(3));
ROS_INFO("Connected to move base server");
control_msgs::GripperCommandGoal grigoal_right;
actionlib::SimpleActionClient<control_msgs::GripperCommandAction> acl("/movo/left_gripper_controller/gripper_cmd", true);
// Wait 60 seconds for the action server to become available
ROS_INFO("Waiting for the gripper action server");
acl.waitForServer(ros::Duration(3));
ROS_INFO("Connected to move base server");
control_msgs::GripperCommandGoal grigoal_left;
moveit::planning_interface::MoveGroup group("upper_body");
moveit::planning_interface::MoveGroup l_group("left_arm");
moveit::planning_interface::MoveGroup r_group("right_arm");
group.setNamedTarget("homed_2")
moveit::planning_interface::MoveGroup::Plan upperbody_plan;
bool success_upper = group.plan(upperbody_plan);
ROS_INFO("Visualizing plan (pose goal) %s",success_upper?"":"FAILED");
if(success_upper)
group.execute(upperbody_plan);
group.setNamedTarget("plan_grasp");
moveit::planning_interface::MoveGroup::Plan upperbody_plan_1;
bool success_upper_1 = group.plan(upperbody_plan_1);
ROS_INFO("Visualizing plan (pose goal) %s",success_upper?"":"FAILED");
if(success_upper_1)
{
group.execute(upperbody_plan_1);
}
//opengrasp
grigoal_right.command.position = 0.16
ROS_INFO("Sending goal");
acr.sendGoal(grigoal_right);
acr.waitForResult();
if (acr.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have reached the goal!");
else
ROS_INFO("The base failed for some reason");
grigoal_left.command.position = 0.16;
ROS_INFO("Sending goal");
acl.sendGoal(grigoal_left);
acl.waitForResult();
if (acl.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have reached the goal!");
else
ROS_INFO("The base failed for some reason");
//grasp
sleep(3);
//youbi_1_2_3
r_group.setNamedTarget("right_grasp1");
moveit::planning_interface::MoveGroup::Plan right_grasp_plan_1;
bool success_right_grasp_1 = r_group.plan(right_grasp_plan_1);
ROS_INFO("Visualizing plan1 (pose goal) %s",success_upper?"":"FAILED");
if(success_right_grasp_1)
{
sleep(1);
r_group.execute(right_grasp_plan_1);
}
r_group.setNamedTarget("right_grasp2");
moveit::planning_interface::MoveGroup::Plan right_grasp_plan_2;
bool success_right_grasp_2 = r_group.plan(right_grasp_plan_2);
ROS_INFO("Visualizing plan2 (pose goal) %s",success_upper?"":"FAILED");
if(success_right_grasp_2)
{
sleep(1);
r_group.execute(right_grasp_plan_2);
}
//closegrasp_right
grigoal_right.command.position = 0.03;
ROS_INFO("Sending goal");
acr.sendGoal(grigoal_right);
acr.waitForResult();
if (acr.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have reached the goal!");
else
ROS_INFO("The base failed for some reason");
//grasp
r_group.setNamedTarget("right_grasp3");
moveit::planning_interface::MoveGroup::Plan right_grasp_plan_3;
bool success_right_grasp_3 = r_group.plan(right_grasp_plan_3);
ROS_INFO("Visualizing plan3 (pose goal) %s",success_upper?"":"FAILED");
if(success_right_grasp_3)
{
sleep(1);
r_group.execute(right_grasp_plan_3);
}
//zuobi1-2-3
l_group.setNamedTarget("left_grasp1");
moveit::planning_interface::MoveGroup::Plan left_grasp_plan_1;
bool success_left_grasp_1 = l_group.plan(left_grasp_plan_1);
ROS_INFO("Visualizing plan1_1 (pose goal) %s",success_upper?"":"FAILED");
if(success_left_grasp_1)
{
sleep(1);
l_group.execute(left_grasp_plan_1);
}
l_group.setNamedTarget("left_grasp2");
moveit::planning_interface::MoveGroup::Plan left_grasp_plan_2;
bool success_left_grasp_2 = l_group.plan(left_grasp_plan_2);
ROS_INFO("Visualizing plan2_1 (pose goal) %s",success_upper?"":"FAILED");
if(success_left_grasp_2)
{
sleep(1);
l_group.execute(left_grasp_plan_2);
}
//closegrasp_left
grigoal_left.command.position = 0.03;
ROS_INFO("Sending goal");
acl.sendGoal(grigoal_left);
acl.waitForResult();
if (acl.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have reached the goal!");
else
ROS_INFO("The base failed for some reason");
//grasp
l_group.setNamedTarget("left_grasp3");
moveit::planning_interface::MoveGroup::Plan left_grasp_plan_3;
bool success_left_grasp_3 = l_group.plan(left_grasp_plan_3);
ROS_INFO("Visualizing plan3_1 (pose goal) %s",success_upper?"":"FAILED");
if(success_left_grasp_3)
{
sleep(1);
l_group.execute(left_grasp_plan_3);
}
sleep(1);
//youbi-4
r_group.setNamedTarget("right_grasp4");
moveit::planning_interface::MoveGroup::Plan right_grasp_plan_4;
bool success_right_grasp_4 = r_group.plan(right_grasp_plan_4);
ROS_INFO("Visualizing plan4 (pose goal) %s",success_upper?"":"FAILED");
if(success_right_grasp_4)
{
sleep(1);
r_group.execute(right_grasp_plan_4);
}
sleep(3);
//youbi-3
r_group.setNamedTarget("right_grasp3");
moveit::planning_interface::MoveGroup::Plan right_grasp_plan_3_1;
bool success_right_grasp_3_1 = r_group.plan(right_grasp_plan_3_1);
ROS_INFO("Visualizing plan3 (pose goal) %s",success_upper?"":"FAILED");
if(success_right_grasp_3_1)
{
sleep(1);
r_group.execute(right_grasp_plan_3_1);
}
//youbi-2
r_group.setNamedTarget("right_grasp2");
moveit::planning_interface::MoveGroup::Plan right_grasp_plan_2_1;
bool success_right_grasp_2_1 = r_group.plan(right_grasp_plan_2_1);
ROS_INFO("Visualizing plan (pose goal) %s",success_upper?"":"FAILED");
if(success_right_grasp_2_1)
{
sleep(1);
r_group.execute(right_grasp_plan_2_1);
}
//opengrasp-right
grigoal_right.command.position = 0.16;
ROS_INFO("Sending goal");
acr.sendGoal(grigoal_right);
acr.waitForResult();
if (acr.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have reached the goal!");
else
ROS_INFO("The base failed for some reason");
//opengrasp
//youbi-1
r_group.setNamedTarget("right_grasp1");
moveit::planning_interface::MoveGroup::Plan right_grasp_plan_1_1;
bool success_right_grasp_1_1 = r_group.plan(right_grasp_plan_1_1);
ROS_INFO("Visualizing plan (pose goal) %s",success_upper?"":"FAILED");
if(success_right_grasp_1_1)
{
sleep(1);
r_group.execute(right_grasp_plan_1_1);
}
//zoubi-2
l_group.setNamedTarget("left_grasp2");
moveit::planning_interface::MoveGroup::Plan left_grasp_plan_2_1;
bool success_left_grasp_2_1 = l_group.plan(left_grasp_plan_2_1);
ROS_INFO("Visualizing plan1_1 (pose goal) %s",success_upper?"":"FAILED");
if(success_left_grasp_2_1)
{
sleep(1);
l_group.execute(left_grasp_plan_2_1);
}
//opengrasp-left
grigoal_left.command.position = 0.16;
ROS_INFO("Sending goal");
acl.sendGoal(grigoal_left);
acl.waitForResult();
if (acl.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have reached the goal!");
else
ROS_INFO("The base failed for some reason");
//grasp
//zoubi-1
l_group.setNamedTarget("left_grasp1");
moveit::planning_interface::MoveGroup::Plan left_grasp_plan_1_1;
bool success_left_grasp_1_1 = l_group.plan(left_grasp_plan_1_1);
ROS_INFO("Visualizing plan1_1 (pose goal) %s",success_upper?"":"FAILED");
if(success_left_grasp_1_1)
{
sleep(1);
l_group.execute(left_grasp_plan_1_1);
}
//dual-2
group.setNamedTarget("plan_grasp");
moveit::planning_interface::MoveGroup::Plan upperbody_plan_1_1;
bool success_upper_1_1 = group.plan(upperbody_plan_1_1);
ROS_INFO("Visualizing plan (pose goal) %s",success_upper?"":"FAILED");
if(success_upper_1_1)
{
group.execute(upperbody_plan_1_1);
}
sleep(4);
//closegripper
//closegrasp_right
grigoal_right.command.position = 0.03;
ROS_INFO("Sending goal");
acr.sendGoal(grigoal_right);
acr.waitForResult();
if (acr.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have reached the goal!");
else
ROS_INFO("The base failed for some reason");
//grasp
//closegrasp_left
grigoal_left.command.position = 0.03;
ROS_INFO("Sending goal");
acl.sendGoal(grigoal_left);
acl.waitForResult();
if (acl.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have reached the goal!");
else
ROS_INFO("The base failed for some reason");
//grasp
//dual-1
group.setNamedTarget("homed_2");
moveit::planning_interface::MoveGroup::Plan upperbody_plan_0_1;
bool success_upper_0_1 = group.plan(upperbody_plan_0_1);
ROS_INFO("Visualizing plan (pose goal) %s",success_upper?"":"FAILED");
if(success_upper_0_1)
group.execute(upperbody_plan_0_1);
sleep(2);
//dual-0
group.setNamedTarget("tucked");
moveit::planning_interface::MoveGroup::Plan upperbody_plan_0;
bool success_upper_0 = group.plan(upperbody_plan_0);
ROS_INFO("Visualizing plan (pose goal) %s",success_upper?"":"FAILED");
if(success_upper_0)
group.execute(upperbody_plan_0);
ros::shutdown();
return 0;
}
其中,我們通過(guò)在moveit配置中預(yù)存了很多的位姿如:right_grasp1實(shí)現(xiàn)精準(zhǔn)控制。
通過(guò)使用此語(yǔ)句設(shè)定目標(biāo)并發(fā)送:r_group.setNamedTarget(“right_grasp1”);
位姿預(yù)存在/kinova-movo/movo_moveit_config/config/movo_kg2.srdf文件中。格式如下:
<group_state name="plan_grasp" _cke_saved_name="plan_grasp" group="upper_body">
<joint name="right_elbow_joint" _cke_saved_name="right_elbow_joint" value="2.28" />
<joint name="right_shoulder_lift_joint" _cke_saved_name="right_shoulder_lift_joint" value="2.17" />
<joint name="right_shoulder_pan_joint" _cke_saved_name="right_shoulder_pan_joint" value="-2.56" />
<joint name="right_wrist_1_joint" _cke_saved_name="right_wrist_1_joint" value="-0.09" />
<joint name="right_wrist_2_joint" _cke_saved_name="right_wrist_2_joint" value="0.15" />
<joint name="right_wrist_3_joint" _cke_saved_name="right_wrist_3_joint" value="1.06" />
<joint name="left_elbow_joint" _cke_saved_name="left_elbow_joint" value="-2.28" />
<joint name="left_shoulder_lift_joint" _cke_saved_name="left_shoulder_lift_joint" value="-2.17" />
<joint name="left_shoulder_pan_joint" _cke_saved_name="left_shoulder_pan_joint" value="2.56" />
<joint name="left_wrist_1_joint" _cke_saved_name="left_wrist_1_joint" value="0.09" />
<joint name="left_wrist_2_joint" _cke_saved_name="left_wrist_2_joint" value="-0.15" />
<joint name="left_wrist_3_joint" _cke_saved_name="left_wrist_3_joint" value="2.06" />
<joint name="linear_joint" _cke_saved_name="linear_joint" value="0.45" />
<joint name="pan_joint" _cke_saved_name="pan_joint" value="0.0" />
<joint name="tilt_joint" _cke_saved_name="tilt_joint" value="0.0" />
</group_state>
---------------------
作者:躍動(dòng)的風(fēng) 王憲偉 大連大華中天科技有限公司軟件開(kāi)發(fā)工程師
來(lái)源:CSDN
原文:https://blog.csdn.net/qq_23670601/article/details/88712629
版權(quán)聲明:本文為博主原創(chuàng)文章,轉(zhuǎn)載請(qǐng)附上博文鏈接!
掃二維碼用手機(jī)看
掃一掃聯(lián)系我們
如何聯(lián)系我們
電 話:0411-81761733
傳 真:0411-81761733
郵 箱:cuiyxue@foxmail.com
手 機(jī):18698996116
Copyright ? 2016-2020 大連大華中天科技有限公司 版權(quán)所有 遼ICP備16010227號(hào)-2