-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from elephantrobotics/fix_myarm_handle
Fix myarm handle
- Loading branch information
Showing
15 changed files
with
1,173 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/python | ||
# -*- coding:utf-8 -*- | ||
# @File : all_run_test.py | ||
# @Author : Wang Weijian | ||
# @Time : 2023/07/11 15:38:45 | ||
# @function: the script is used to do something | ||
# @version : V1 | ||
|
||
import time | ||
from pymycobot.myarm import MyArm | ||
|
||
mc = MyArm('/dev/ttyAMA0') | ||
|
||
init_angles = [ | ||
[90, 0, 0, 0, 0, 0, 0], # zero point | ||
[-90, 0, 0, -90, 0, -90, 0], # first init point | ||
[90, 0, 0, -90, 0, -90, 0], # second init point | ||
[0, 80, 0, 0, 0, 0, 0], # four | ||
[-150, 80, 0, 0, 0, 0, 0], | ||
[150, 80, 0, 0, 0, 0, 0], # 6 | ||
[155.12, -79.27, -0.26, 76.46, 5.71, 45.0, -0.08], # 7 | ||
[-29.53, -48.11, 165, -89.2, 0.41, -43.56, 0.35], # 8 | ||
[87.62, 80, 165, -82.96, 165, -73.38, 0.26], # 9 | ||
[-114.16, 80, 165, -82.96, 165, -104.58, 0.26], # 10 | ||
[17.84, -2.1, 165, -100, 165, 64.16, -6.24], # 11 | ||
[-11.07, -11.68, 2.1, -93.42, 3.07, -9.14, -45.35], # 12 | ||
[-19.68, -16.96, -165, -84.28, -161.19, 1.05, -43.76] , # 13 | ||
[-108.89, -78.39, -165, -89.64, 165, 110, -0.7], # 14 | ||
[160.57, -78.92, 165, -84.63, -163.3, 1.05, -43.76], # 15 | ||
] | ||
|
||
low_speed = 10 | ||
medium_speed = 50 | ||
high_speed = 100 | ||
timet = int(3) | ||
|
||
|
||
def main(): | ||
""" | ||
体现myarm三种不同速度的多种运动姿态 | ||
:return: None | ||
""" | ||
mc.send_angles(init_angles[0], medium_speed) | ||
time.sleep(3+timet) | ||
|
||
mc.send_angles(init_angles[1], low_speed) | ||
time.sleep(10+timet) | ||
|
||
mc.send_angles(init_angles[2], high_speed) | ||
time.sleep(2+timet) | ||
|
||
mc.send_angles(init_angles[3], high_speed) | ||
time.sleep(4+timet) | ||
mc.send_angles(init_angles[4], high_speed) | ||
time.sleep(4.5+timet) | ||
mc.send_angles(init_angles[5], high_speed) | ||
time.sleep(6+timet) | ||
mc.send_angles(init_angles[6], medium_speed) | ||
time.sleep(4+timet) | ||
mc.send_angles(init_angles[7], medium_speed) | ||
time.sleep(8+timet) | ||
mc.send_angles(init_angles[8], medium_speed) | ||
time.sleep(4+timet) | ||
mc.send_angles(init_angles[9], high_speed) | ||
time.sleep(4+timet) | ||
mc.send_angles(init_angles[10], high_speed) | ||
time.sleep(4+timet) | ||
mc.send_angles(init_angles[11], high_speed) | ||
time.sleep(4+timet) | ||
mc.send_angles(init_angles[12], high_speed) | ||
time.sleep(4+timet) | ||
mc.send_angles(init_angles[13], medium_speed) | ||
time.sleep(8+timet) | ||
mc.send_angles(init_angles[14], high_speed) | ||
time.sleep(5+timet) | ||
mc.send_angles(init_angles[0], medium_speed) | ||
time.sleep(7.5+timet) | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import time | ||
from pymycobot.myarm import MyArm | ||
|
||
|
||
mc = MyArm('/dev/ttyAMA0') | ||
|
||
|
||
init_angles = [ | ||
[-60, 0, 0, -90, 0, -90, 0], # first init point | ||
[0, 0, 0, -90, 0, -90, 0], # second init point | ||
] | ||
|
||
box_angles = [ | ||
[-47.9, 17.31, 0.17, -89.91, -0.17, -56.07, 0.0], # D | ||
[-27.59, 44.82, -1.75, -48.95, 0.0, -55.89, -0.0], # C | ||
[52.99, 18.36, -1.4, -86.57, -0.17, -55.89, -0.0], # A | ||
[87.97, 18.28, -1.4, -86.57, -0.35, -71.19, -0.0], # B | ||
] | ||
|
||
|
||
# 开启 | ||
def gripper_on(): | ||
mc.set_gripper_state(0, 100) | ||
time.sleep(0.5) | ||
|
||
|
||
# 关闭 | ||
def gripper_off(): | ||
mc.set_gripper_state(1, 100) | ||
time.sleep(0.5) | ||
|
||
|
||
def move(): | ||
""" | ||
myarm使用夹爪模拟aikitV2套装抓取木块 | ||
""" | ||
mc.send_angles(init_angles[0], 50) | ||
time.sleep(3) | ||
|
||
mc.send_angles(init_angles[1], 50) | ||
time.sleep(3) | ||
gripper_on() | ||
mc.send_angles([0.0, 26.27, 0.17, -72.86, -0.17, -77.51, 0.0], 50) | ||
time.sleep(3) | ||
|
||
# mc.send_angles([0.0, -47.63, 0.17, -77.43, 0.08, -55.72, 0.0], 50) | ||
mc.send_angles([-2.02, 41.74, 0.43, -86.13, -0.17, -46.05, 0.0], 50) | ||
|
||
|
||
time.sleep(3) | ||
|
||
gripper_off() | ||
time.sleep(2) | ||
tmp = [] | ||
while True: | ||
if not tmp: | ||
tmp = mc.get_angles() | ||
else: | ||
break | ||
time.sleep(0.5) | ||
tmp[6] = 0.0 | ||
print(tmp) | ||
mc.send_angles([tmp[0], 0, 0, -90, -0.0, -90, tmp[6]], 50) | ||
# mc.send_angles([0, 0, 0, -90, 0, -90, 0], 50) | ||
time.sleep(3) | ||
mc.send_angles(box_angles[3], 50) | ||
time.sleep(4) | ||
gripper_on() | ||
time.sleep(2) | ||
mc.send_angles(init_angles[0], 50) | ||
time.sleep(4) | ||
|
||
|
||
if __name__ == '__main__': | ||
gripper_off() | ||
move() |
Oops, something went wrong.