Control of the robotic arm
1 Slider Control
Click the ROS1 Shell
icon on the desktop or the corresponding icon in the lower bar of the desktop to open the ROS1 environment terminal:
Then run the command:
roslaunch mercury_a1 slider_control.launch
rviz and a slider component will be opened, and you will see the following interface:
Then you can control the model in rviz to make it move by dragging the slider. If you want the real mycobot to move with the model, you need to open another ROS1 environment terminal:
Then run the command:
rosrun mercury_a1 slider_control.py
Note: Since the robot arm will move to the current position of the model when the command is input, make sure that the model in rviz does not appear to be worn out before you use the command.
Do not drag the slider quickly after connecting the robot arm to prevent damage to the robot arm.
2 Model Following
In addition to the above controls, we can also let the model move by following the real robot arm. Open a ROS1 environment terminal:
Then run the command:
rosrun mercury_a1 follow_display.py
Then open another ROS1 environment terminal:
Then run the command:
roslaunch mercury_a1 mercury_follow.launch
It will open rviz to show the model following effect.
3 GUI control
On the basis of the previous contents, this package also provides a simple GUI control interface. This method is used for interaction between real robot arms. Connect to mycobot.
Open a ROS1 environment terminal:
Then run the command:
roslaunch mercury_a1 simple_gui.launch
Running effect:
Note: Before using the gripper switch button, make sure the adaptive gripper is connected to the end of the robot arm.
4 Keyboard control
Keyboard control is added in mercury_a1
package, and real-time Synchronization is performed in rviz. This function depends on pythonApi, so be sure to connect with the real robot arm.
Open a ROS1 environment terminal:
Then run the command:
roslaunch mercury_a1 teleop_keyboard.launch
Running effect is as follows:
Mercury A1 information will be output in the command line as follows:
SUMMARY
========
PARAMETERS
* /mercury_services/baud: 115200
* /mercury_services/port: /dev/ttyAMA1
* /robot_description: <?xml version="1....
* /rosdistro: noetic
* /rosversion: 1.15.14
NODES
/
mercury_services (mercury_a1_communication/mercury_services.py)
real_listener (mercury_a1/listen_real.py)
robot_state_publisher (robot_state_publisher/robot_state_publisher)
rviz (rviz/rviz)
ROS_MASTER_URI=http://localhost:11311
process[robot_state_publisher-1]: started with pid [14764]
process[rviz-2]: started with pid [14765]
process[mecharm_services-3]: started with pid [14766]
process[real_listener-4]: started with pid [14782]
[INFO] [1646649869.148017]: start ...
[INFO] [1646649869.156531]: /dev/ttyAMA1,115200
Mercury Status
--------------------------------
Joint Limit:
joint 1: -165 ~ +165
joint 2: -100 ~ +100
joint 3: -165 ~ +165
joint 4: -175 ~ +4
joint 5: -165 ~ +165
joint 6: -1 ~ +180
joint 7: -165 ~ +165
Connect Status: True
Servo Infomation: unknown
Servo Temperature: unknown
Atom Version: unknown
[INFO] [1646649869.427899]: ready
Then open another ROS1 environment terminal:
Then run the command:
rosrun mercury_a1 teleop_keyboard.py
You will see the following output in the command line:
Mercury Teleop Keyboard Controller
---------------------------
Movimg options(control coordinations [x,y,z,rx,ry,rz]):
w(x+)
a(y-) s(x-) d(y+)
z(z-) x(z+)
u(rx+) i(ry+) o(rz+)
j(rx-) k(ry-) l(rz-)
Gripper control:
g - open
h - close
Other:
1 - Go to init pose
2 - Go to home pose
3 - Resave home pose
q - Quit
currently: speed: 50 change percent: 5
In this terminal, you can control the state of the robot arm and move it using the keys in the command line.
Parameters supported by this script:
- _speed: the movement speed of the robot arm
- _change_percent: movement distance percentage
5 Moveit use
mercury_a1
has integrated the MoveIt section.
Click the ROS1 Shell
icon on the desktop or the corresponding icon in the lower bar of the desktop to open the ROS1 environment terminal:
Then run the command:
roslaunch mercury_a1_moveit mercury_a1.launch
The operation effect is as follows:
Can be planned and executed to demonstrate the effect:
If you need to let the real robot arm execute the plan synchronously, you need to open another ROS1 environment terminal:
Then run the command:
rosrun mercury_a1_moveit sync_plan.py
Then plan and execute again to demonstrate the effect: