OpenManipulator-P机械臂入门教程-Master Slave示例
说明
在该示例中,需要用到两个OpenManipulator机械臂,一个是Master角色,一个是Slave角色
在Master-Slave模式中,Master机械臂将会与Slave机械臂同步移动
在Record模式中,其将会保存Master机械臂和Slave机械臂在录制过程中移动过的轨迹;然而在play模式中,Slave机械臂将会执行此前Master被记录下的轨迹
前提准备
- 准备两个OpenManipulator机械臂,两个U2D2控制板和一台电脑
- Master机械臂由使用者来控制,其舵机ID设置如下,波特率为1000000bps
Name | DYNAMIXEL ID |
---|---|
Joint 1 | 21 |
Joint 2 | 22 |
Joint 3 | 23 |
Joint 4 | 24 |
Joint 5 | 25 |
Joint 6 | 26 |
Gripper | 27 |
- Slave机械臂将与Master OpenManipulator同步移动,其舵机ID设置如下,波特率为1000000bps
Name | DYNAMIXEL ID |
---|---|
Joint 1 | 1 |
Joint 2 | 2 |
Joint 3 | 3 |
Joint 4 | 4 |
Joint 5 | 5 |
Joint 6 | 6 |
Gripper | 7 |
注:若两个机械臂的ID都相同,那么可以用
R+ manager 2.0
工具来更改舵机ID如果没有安装相关应用, 则使用如下方法安装
$ cd ~/ros1_op_ws/src/
$ git clone https://github.com/ROBOTIS-GIT/open_manipulator_p_applications.git
$ cd ~/ros1_op_ws&& catkin_make
操作步骤
- 运行roscore
roscore
- 查看两个机械臂是否连上PC;U2D2控制板连接的端口为
ttyUSB*
$ ls /dev/ttyUSB*
正常会出现
ttyUSB0
和ttyUSB1
保持机械臂默认姿态如图
启动Slave机械臂
- 启动命令
roslaunch open_manipulator_p_master_slave open_manipulator_p_master_slave.launch usb_port:=/dev/ttyUSB1
- 启动界面
SUMMARY
========
PARAMETERS
* /open_manipulator/control_period: 0.01
* /open_manipulator/moveit_sample_duration: 0.05
* /open_manipulator/planning_group_name: arm
* /open_manipulator/using_moveit: False
* /open_manipulator/using_platform: True
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
/
open_manipulator (open_manipulator_controller/open_manipulator_controller)
ROS_MASTER_URI=http://localhost:11311
process[open_manipulator-1]: started with pid [23452]
Joint Dynamixel ID : 21, Model Name : XM430-W350
Joint Dynamixel ID : 22, Model Name : XM430-W350
Joint Dynamixel ID : 23, Model Name : XM430-W350
Joint Dynamixel ID : 24, Model Name : XM430-W350
Gripper Dynamixel ID : 25, Model Name :XM430-W350
[ INFO] [1544509070.096942788]: Succeeded to init /open_manipulator
启动Master机械臂
- 保持机械臂姿态,如图
- 启动命令
roslaunch open_manipulator_master_slave open_manipulator_master.launch usb_port:=/dev/ttyUSB1
- 界面如下
SUMMARY
========
PARAMETERS
* /open_manipulator/open_manipulator_master/gripper_id: 5
* /open_manipulator/open_manipulator_master/joint1_id: 1
* /open_manipulator/open_manipulator_master/joint2_id: 2
* /open_manipulator/open_manipulator_master/joint3_id: 3
* /open_manipulator/open_manipulator_master/joint4_id: 4
* /open_manipulator/open_manipulator_master/service_call_period: 0.01
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
/open_manipulator/
open_manipulator_master (open_manipulator_master_slave/open_manipulator_master)
ROS_MASTER_URI=http://localhost:11311
process[open_manipulator/open_manipulator_master-1]: started with pid [32026]
Joint Dynamixel ID : 1, Model Name : PRO-PLUS-PH54-200-S500-R
Joint Dynamixel ID : 2, Model Name : PRO-PLUS-PH54-200-S500-R
Joint Dynamixel ID : 3, Model Name : PRO-PLUS-PH54-100-S500-R
Joint Dynamixel ID : 4, Model Name : PRO-PLUS-PH54-100-S500-R
Joint Dynamixel ID : 5, Model Name : PRO-PLUS-PH42-020-S300-R
Joint Dynamixel ID : 6, Model Name : PRO-PLUS-PH42-020-S300-R
模式设置
- 同时可以在Master机械臂的启动终端窗口看到以下信息;
- 从中可以查看当前的控制模式和机器臂的状态(关节角度和Tool Position)
-----------------------------
Control Your OpenManipulator!
-----------------------------
Present Control Mode
Master - Slave Mode
-----------------------------
1 : Master - Slave Mode
2 : Start Recording Trajectory
3 : Stop Recording Trajectory
4 : Play Recorded Trajectory
-----------------------------
Present Joint Angle J1: -0.170 J2: 0.367 J3: -0.046 J4: 0.959
Present Tool Position: 0.000
-----------------------------
- 其中有四种控制模式
1. Master-Slave Mode: Master机械臂将会与Slave机械臂同步移动;可以尝试用手去移动Master机械臂,那么Slave机械臂会跟着同步移动
2. Start Recording Trajectory: Master机械臂将会与Slave机械臂同步移动,程序会记录移动轨迹。
3. Stop Recording Trajectory: 停止记录
4. Play Recorded Trajectory: 只有Slave机械臂将会执行此前被记录下的轨迹
演示视频
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号