Kinova_MOVO机器人基本操作及机械臂倒水demo实现
- 分类:技术博客
- 发布时间:2020-06-21 00:00:00
- 访问量:0
Kinova MOVO官网
Kinova参数页
1、MOVO安装教程
翻译自movo-github-wiki
MOVO开发硬件需求
官方只支持Ubuntu 14.04 Trusty, x64 platform (core i5, core i7), 8GB RAM。
软件安装
您需要安装几个开发包才能在MOVO上进行开发。 一些包装属于Kinova外部开发包,其他的是Kinova专用开发包。 如果您在安装Kinova开发包时遇到任何障碍,请在此处报告问题。 对于任何专门针对外部库的问题,这些库的支持团队可能是获得修复的最佳选择。 但是,我们很乐意回答您的任何问题,并提供有关您使用MOVO开发的任何问题的帮助。 本节将指导您完成安装过程。
-有两种安装的方式:自动/手动
自动安装脚本使用方式:创建工作区并克隆kinova-movo库后,运行交互式bash脚本* setup_remote_pc *以自动执行安装。推荐采用自动方式。
手动安装方式具体见此处。
连接到MOVO平台
通过无线或有限两种方式连接到MOVO平台。
无线wifi(wifi名: MoVoWifi 密码: Welcome00)
通过SSH登陆到MOVO,ssh movo@10.66.171.1,登陆密码Welcome00。
若要将手柄连接到远程开发者电脑上使用,打开终端进行以下操作:
cd ~/movo_ws
sws # alias sws='source ./devel/setup.bash' defined in .bashrc
roslaunch movo_remote_teleop movo_remote_teleop.launch
若要将手柄插在MOVO上使用,在远程开发者电脑上SSH登陆到MOVO后,执行以下操作:
cd ~/movo_ws
sws # alias sws='source ./devel/setup.bash' defined in .bashrc
roslaunch movo_remote_teleop movo_remote_teleop.launch
2、MOVO机器人的基本使用
官方提供了以下功能:
建立远程开发者电脑与MOVO的连接
检测远程连接状态
使用真实机器人重新配置参数
查找Kinect序列号
为6自由度机械臂配置MOVO
-更新MOVO代码
-诊断MOVO启动问题
样例DEMO
使用真实机器人建图
使用真实机器人在rviz中导航地图
使用直接操作模式控制真实机器人
使用辅助操作模式控制真实机器人
使用仿真机器人建图
使用仿真机器人定位
3、制作倒水DEMO
基于Moveit对机械臂进行规划,具体学习可以参照此处:
通过c++接口调用Moveit进行编程
ros::actionlib动作服务器(action server)在动作客户端(action client)中的调用
ROS教程下载
以下为主程序
// movo_moveit_uoperbody.cpp
#include
#include
#include
#include
#include
#include
#include
//grasp
#include
#include
#include
#include
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
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
// 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;
}
其中,我们通过在moveit配置中预存了很多的位姿如:right_grasp1实现精准控制。
通过使用此语句设定目标并发送:r_group.setNamedTarget(“right_grasp1”);
位姿预存在/kinova-movo/movo_moveit_config/config/movo_kg2.srdf文件中。格式如下:
---------------------
作者:跃动的风 王宪伟 QY千亿球友会网站软件开发工程师
来源:CSDN
原文:https://blog.csdn.net/qq_23670601/article/details/88712629
版权声明:本文为博主原创文章,转载请附上博文链接!
扫二维码用手机看
Copyright © 2016-2020 QY千亿球友会网站 版权所有 辽ICP备16010227号-2