at.hefang


Nameat.hefang JSON
Version 1.5 PyPI version JSON
download
home_pagehttps://github.com/Hello-Mr-Crab/pywechat
SummaryA Powerful Windows-PC-Wechat automation Tool
upload_time2025-06-21 05:42:35
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseApache-2.0
keywords rpa windows wechat automation
VCS
bugtrack_url
requirements pyautogui pycaw pywin32 pywin32-ctypes pywinauto psutil
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Example Package

This is a simple example package. You can use
[GitHub-flavored Markdown](https://guides.github.com/features/mastering-markdown/)
to write your content.



'

import sys
import time

sys.path.append("/home/lemon/catkin_ws/src/aelos_smart_ros")

from leju import *


def handle_errors(func):
    def wrapper(*args, **kwargs):
        try:
            nodes.node_initial()
            return func(*args, **kwargs)
        except Exception as e:
            print(f"Error in {func.__name__}: {e}")
            nodes.serror(e)
            sys.exit(2)

    return wrapper


tag_action_threshold = {
    'normal': {
        'x': (0.245, -1000, '前进2-8', '下蹲'),
        'y': (0.03, -0.03, '左平移2-8', '右平移2-8'),
        'yaw': (112, 78, '向左转动2-8', '向右转动2-8')
    },
    'stufen': {
        'x': (0.2, -1000, '前进2-8', '下蹲'),
        'y': (0.03, -0.03, '左平移2-8', '右平移2-8'),
        'yaw': (295, 255, '向左转动2-8', '向右转动2-8')
    },
    'test':{
        'x': (0.25, -1000, '前进2-8', '下蹲'),
        'y': (0.1, -0.1, '左平移2-8', '右平移2-8'),
    }
}

color_params_threshold = {
    1: (43, 115, 109, 53, 255, 162),  # 绿色
    2: (12, 140, 118, 17, 255, 199),  # 橙色
}

color_xy_threshold = {
    'x': (370, 270, '右平移1-8', '左平移1-8'),
    'y': (1000, 370, '下蹲', '前进1-8'),
}

tag_actions = {
    1: ('前进2-8', False, True),
    2: ('右平移3-2', False, True),
    3: ('前进2-8', False, True),
    4: ('左平移3-2', False, True),
    5: ('前进2-8', False, False),
    6: ('前进2-8', False, True),
    7: ('右平移3-2', False, True),
    8: ('前进2-8', True, False)
}

head_color_threshold = 14
shest_color_threshold = 35
positive_geomag_threshold = (198, 180)
reverse_geomag_threshold = (26, 11)

"""描述该功能...
    向目标位移
"""


@handle_errors
def move_to_target(current, max_offset, min_offset, negative_action="", positive_action=''):
    if current <= max_offset and current >= min_offset:
        print("--已完成位移--")
        return True
    action = negative_action if current > max_offset else positive_action
    print(action)
    base_action.action(action)
    time.sleep(0.7)
    return False


"""描述该功能...
    找tag码
"""


@handle_errors
def find_tag(tag_id, geomag_max, geomag_min,  max_action='', min_action='',search_action='', step=True):
    print("--------开始调整地磁---------")
    while not move_to_target(sensor_port.get_magnet(), geomag_max, geomag_min, max_action, min_action):
        print(f"'地磁值:'{sensor_port.get_magnet()}")
        pass

    x=0
    if step:
        print(f"--------开始搜索{tag_id}号tag码--------")
        while artag_port.get_specifies_tag(tag_id, 'chest')[0] == 1000:
            print(f"Tag{tag_id}未识别到")
            base_action.action(search_action)
            print(search_action)
            if x>3:
                base_action.action('前进2-8')
            x+=1
            time.sleep(0.5)
        if artag_port.get_specifies_tag(tag_id, 'chest')[0] != 1000:
            adjusted_xy = {'x': False, 'y': False}
            while True:
                tag_xy = artag_port.get_specifies_tag(tag_id, 'chest')
                if all(adjusted_xy.values()):
                    break
                adjusted_xy['y'] = move_to_target(tag_xy[1], *tag_action_threshold['test']['y'])
                adjusted_xy['x'] = move_to_target(tag_xy[0], *tag_action_threshold['test']['x'])

            print(f"Tag{tag_id}'号识别成功'")
            return True


"""描述该功能....
    抱起颜色方块
"""


@handle_errors
def pickup_block(color_params):
    while True:
        print('-----开始调整位置-----')
        while colour_port.get_color_percent('chest', *color_params) < shest_color_threshold:
            color = colour_port.get_central_coordinate('chest', *color_params)
            print(f"'颜色坐标x:'{color[0]},'y:'{color[1]}")
            color_x = move_to_target(color[0], *color_xy_threshold['x'])
            color_y = move_to_target(color[1], *color_xy_threshold['y'])
            print(colour_port.get_color_percent('chest', *color_params))

        print('-----进入抱起颜色方块循环-----')
        if colour_port.get_color_percent('chest', *color_params) > shest_color_threshold:
            print('--到达位置--')
            base_action.action('抱起方块1-1')
            print('抱起颜色')
            time.sleep(1)

        if colour_port.get_color_percent('head', *color_params) >= head_color_threshold:
            print("已抱起方块")
            break
    return True


"""描述该功能...
    对齐tag码
"""


@handle_errors
def align_to_tag(tag_id=0, action="", stufen=False, stufen_2=True):
    print('--------进入通道循环--------')
    print(f"'开始向'{tag_id}'号tag靠近'")
    thresholds = tag_action_threshold['stufen' if stufen else 'normal']
    adjusted = {'x': False, 'y': False, 'yaw': False}
    while True:
        tag = artag_port.get_specifies_tag(tag_id, 'chest')
        print('胸部:', tag_id, "x: ", tag[0], "y: ", tag[1], "yaw: ", tag[2] + 180)
        if tag[0] == 1000:
            print('----id丢失----')
            base_action.action(tag_actions[tag_id - 1][0])
            print(tag_actions[tag_id - 1][0])
            time.sleep(0.2)
            continue
        print('-----开始调整位置-----')

        if not adjusted['yaw']:
            adjusted['yaw'] = move_to_target(tag[2] + 180, *thresholds['yaw'])
            if all(adjusted.values()):
                break
        if adjusted['yaw']:
            adjusted['y'] = move_to_target(tag[1], *thresholds['y'])
            adjusted['x'] = move_to_target(tag[0], *thresholds['x'])
        if adjusted['x'] and adjusted['yaw']:  # 再次调整yaw
            adjusted['yaw'] = False

    print('--------进入横向移动调整-------')
    if tag_id in (3, 6):  # 横向移动调整拐弯处
        steps = 2 if tag_id == 3 else 4  # 步数看实际步伐
        action = '右平移3-2' if tag_id == 3 else '左平移3-2'
        for _ in range(steps):
            base_action.action(action)

    next_id = tag_id + 1
    if stufen_2 and artag_port.get_specifies_tag(next_id, 'chest')[0] == 1000:  # 判断是否横移找tag码
        print(f" 开始识别{next_id}号tag码")
        base_action.action(action)
        print(action)
        find_tag(1, *positive_geomag_threshold, '向左转动2-8', '向右转动2-8', '左平移2-8', step=False)
        time.sleep(0.7)
        print(f"Tag {next_id} 识别成功")


"""描述该功能...
    进入通道
"""


@handle_errors
def tag_foeward():
    find_tag(1, *positive_geomag_threshold, '向左转动2-8', '向右转动2-8', '左平移3-2', step=True)
    print('------进入通道------')
    for id, (next_action, next_back, go_flag) in tag_actions.items():
        if id == 8:
            id = 1
        print(id, next_action)
        align_to_tag(id, next_action, next_back, go_flag)
        go_back = False
        if id == 5:
            print('----开始进入大本营----')
            go_back = place_block_at_base()
            find_tag(5, *reverse_geomag_threshold, '向左转动1步', '向右转动1步', '前进2-8',step=True)
            align_to_tag(5, '前进2-8', False, True)
        if go_back and id == 1:  # 回到起点
            for _ in range(2):  # 步速看实际步伐
                base_action.action('前进2-8')


"""描述该功能...
    放下方块
"""


@handle_errors
def place_block_at_base():
    for _ in range(4):  # 步速看实际步伐
        base_action.action('前进2-8')
    else:
        print('---到达位置---')
        base_action.action('向右转动1步')
        return True  


@handle_errors
def main():
    print("--------开始运行--------")
    while True:
        # 检查是否已捡起方块
        head_color_1 = colour_port.get_color_percent('head', *color_params_threshold[1])
        head_color_2 = colour_port.get_color_percent('head', *color_params_threshold[2])
        if head_color_1 >= head_color_threshold or head_color_2 >= head_color_threshold:
            print("----已抱起方块,开始导航----")
            tag_foeward()
            continue
            
        # 选择最近的方块
        chest_color_1 = colour_port.get_color_percent('chest', *color_params_threshold[1])
        chest_color_2 = -1
        # colour_port.get_color_percent('chest', *color_params_threshold[2])
        target_params = color_params_threshold[1] if chest_color_1 >= chest_color_2 else color_params_threshold[2]

        if pickup_block(target_params):
            tag_foeward()
            continue


if __name__ == "__main__":
    print("Run custom project")
    main()
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  import sys
import time
sys.path.append("/home/lemon/catkin_ws/src/aelos_smart_ros")

from leju import *

leju_variable_tag_x = None
leju_variable_tag_y = None
leju_variable_tag_yaw = None



def main():
    nodes.node_initial()
    try:


        while True:
            a=sensor_port.get_magnet()
            print(a)
            print("==============")
    except Exception as e:
        nodes.serror(e)
        exit(2)
    finally:
        nodes.finishsend()



def detect_coordinate_color():
    nodes.node_initial()
    try:
        while True:
            color_params_3 = (155, 98,100,174,175 ,159)
            color_params_1 = (36, 108, 94, 53, 255, 162)
            color_params_2 = (10, 233, 132, 16, 255, 203)
            color=colour_port.get_central_coordinate('chest',*color_params)
            print(f"'颜色1颜色坐标x:'{color_params_1[0]},'y:'{color_params_1[1]}")
            print(f"'颜色2颜色坐标x:'{color_params_2[0]},'y:'{color_params_2[1]}")
            print(f"'颜色3颜色坐标x:'{color_params_3[0]},'y:'{color_params_3[1]}")
    except Exception as e:
        print(e)
        nodes.serror(e)
        exit(2)



def detect_area_color():
    nodes.node_initial()
    try:
        while True:
            color_params_3 = (155, 98,100,174,175 ,159)
            color_params_1 = (36, 108, 94, 53, 255, 162)
            color_params_2 = (10, 233, 132, 16, 255, 203)
            shest_color = colour_port.get_color_percent('chest',*color_params_1)   
            head_color = colour_port.get_color_percent('head',*color_params_1)
            color = colour_port.get_color_percent('chest',*color_params_3)            
            print('胸部:'+str(shest_color),'头部'+str(head_color),'大本营'+str(color))
            # print('颜色坐标x:',color[0],'y:',color[1])

    except Exception as e:
        print(e)
        nodes.serror(e)
        exit(2)


def detect_all_tags():
    nodes.node_initial()
    try:
        print("开始检测")
        while True:
            print("开始")
            marker = artag_port.get_specifies_marker('chest')
            marker_1 = artag_port.get_specifies_marker('head')
            print("============")
            for ke in marker_1:
                print('头部:',ke, "x: ", marker_1[ke][0], "y: ", marker_1[ke][1], "yaw: ", marker_1[ke][2] + 180)
            for key in marker:
                print('胸部:',key, "x: ", marker[key][0], "y: ", marker[key][1], "yaw: ", marker[key][2] + 180)
            print("============")
            time.sleep(1)
    except Exception as e:
        print(e)
        nodes.serror(e)
        exit(2)

if __name__ == "__main__":
    print ("Run custom project")
    detect_all_tags()
'

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Hello-Mr-Crab/pywechat",
    "name": "at.hefang",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "rpa, windows, wechat, automation",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/f1/d3/edc404b9e300e2eaeed4bad310636c6d327d5c0b314772a95bc0d113929b/at_hefang-1.5.tar.gz",
    "platform": null,
    "description": "# Example Package\r\n\r\nThis is a simple example package. You can use\r\n[GitHub-flavored Markdown](https://guides.github.com/features/mastering-markdown/)\r\nto write your content.\r\n\r\n\r\n\r\n'\r\n\r\nimport sys\r\nimport time\r\n\r\nsys.path.append(\"/home/lemon/catkin_ws/src/aelos_smart_ros\")\r\n\r\nfrom leju import *\r\n\r\n\r\ndef handle_errors(func):\r\n    def wrapper(*args, **kwargs):\r\n        try:\r\n            nodes.node_initial()\r\n            return func(*args, **kwargs)\r\n        except Exception as e:\r\n            print(f\"Error in {func.__name__}: {e}\")\r\n            nodes.serror(e)\r\n            sys.exit(2)\r\n\r\n    return wrapper\r\n\r\n\r\ntag_action_threshold = {\r\n    'normal': {\r\n        'x': (0.245, -1000, '\u524d\u8fdb2-8', '\u4e0b\u8e72'),\r\n        'y': (0.03, -0.03, '\u5de6\u5e73\u79fb2-8', '\u53f3\u5e73\u79fb2-8'),\r\n        'yaw': (112, 78, '\u5411\u5de6\u8f6c\u52a82-8', '\u5411\u53f3\u8f6c\u52a82-8')\r\n    },\r\n    'stufen': {\r\n        'x': (0.2, -1000, '\u524d\u8fdb2-8', '\u4e0b\u8e72'),\r\n        'y': (0.03, -0.03, '\u5de6\u5e73\u79fb2-8', '\u53f3\u5e73\u79fb2-8'),\r\n        'yaw': (295, 255, '\u5411\u5de6\u8f6c\u52a82-8', '\u5411\u53f3\u8f6c\u52a82-8')\r\n    },\r\n    'test':{\r\n        'x': (0.25, -1000, '\u524d\u8fdb2-8', '\u4e0b\u8e72'),\r\n        'y': (0.1, -0.1, '\u5de6\u5e73\u79fb2-8', '\u53f3\u5e73\u79fb2-8'),\r\n    }\r\n}\r\n\r\ncolor_params_threshold = {\r\n    1: (43, 115, 109, 53, 255, 162),  # \u7eff\u8272\r\n    2: (12, 140, 118, 17, 255, 199),  # \u6a59\u8272\r\n}\r\n\r\ncolor_xy_threshold = {\r\n    'x': (370, 270, '\u53f3\u5e73\u79fb1-8', '\u5de6\u5e73\u79fb1-8'),\r\n    'y': (1000, 370, '\u4e0b\u8e72', '\u524d\u8fdb1-8'),\r\n}\r\n\r\ntag_actions = {\r\n    1: ('\u524d\u8fdb2-8', False, True),\r\n    2: ('\u53f3\u5e73\u79fb3-2', False, True),\r\n    3: ('\u524d\u8fdb2-8', False, True),\r\n    4: ('\u5de6\u5e73\u79fb3-2', False, True),\r\n    5: ('\u524d\u8fdb2-8', False, False),\r\n    6: ('\u524d\u8fdb2-8', False, True),\r\n    7: ('\u53f3\u5e73\u79fb3-2', False, True),\r\n    8: ('\u524d\u8fdb2-8', True, False)\r\n}\r\n\r\nhead_color_threshold = 14\r\nshest_color_threshold = 35\r\npositive_geomag_threshold = (198, 180)\r\nreverse_geomag_threshold = (26, 11)\r\n\r\n\"\"\"\u63cf\u8ff0\u8be5\u529f\u80fd...\r\n    \u5411\u76ee\u6807\u4f4d\u79fb\r\n\"\"\"\r\n\r\n\r\n@handle_errors\r\ndef move_to_target(current, max_offset, min_offset, negative_action=\"\", positive_action=''):\r\n    if current <= max_offset and current >= min_offset:\r\n        print(\"--\u5df2\u5b8c\u6210\u4f4d\u79fb--\")\r\n        return True\r\n    action = negative_action if current > max_offset else positive_action\r\n    print(action)\r\n    base_action.action(action)\r\n    time.sleep(0.7)\r\n    return False\r\n\r\n\r\n\"\"\"\u63cf\u8ff0\u8be5\u529f\u80fd...\r\n    \u627etag\u7801\r\n\"\"\"\r\n\r\n\r\n@handle_errors\r\ndef find_tag(tag_id, geomag_max, geomag_min,  max_action='', min_action='',search_action='', step=True):\r\n    print(\"--------\u5f00\u59cb\u8c03\u6574\u5730\u78c1---------\")\r\n    while not move_to_target(sensor_port.get_magnet(), geomag_max, geomag_min, max_action, min_action):\r\n        print(f\"'\u5730\u78c1\u503c\uff1a'{sensor_port.get_magnet()}\")\r\n        pass\r\n\r\n    x=0\r\n    if step:\r\n        print(f\"--------\u5f00\u59cb\u641c\u7d22{tag_id}\u53f7tag\u7801--------\")\r\n        while artag_port.get_specifies_tag(tag_id, 'chest')[0] == 1000:\r\n            print(f\"Tag{tag_id}\u672a\u8bc6\u522b\u5230\")\r\n            base_action.action(search_action)\r\n            print(search_action)\r\n            if x>3:\r\n                base_action.action('\u524d\u8fdb2-8')\r\n            x+=1\r\n            time.sleep(0.5)\r\n        if artag_port.get_specifies_tag(tag_id, 'chest')[0] != 1000:\r\n            adjusted_xy = {'x': False, 'y': False}\r\n            while True:\r\n                tag_xy = artag_port.get_specifies_tag(tag_id, 'chest')\r\n                if all(adjusted_xy.values()):\r\n                    break\r\n                adjusted_xy['y'] = move_to_target(tag_xy[1], *tag_action_threshold['test']['y'])\r\n                adjusted_xy['x'] = move_to_target(tag_xy[0], *tag_action_threshold['test']['x'])\r\n\r\n            print(f\"Tag{tag_id}'\u53f7\u8bc6\u522b\u6210\u529f'\")\r\n            return True\r\n\r\n\r\n\"\"\"\u63cf\u8ff0\u8be5\u529f\u80fd....\r\n    \u62b1\u8d77\u989c\u8272\u65b9\u5757\r\n\"\"\"\r\n\r\n\r\n@handle_errors\r\ndef pickup_block(color_params):\r\n    while True:\r\n        print('-----\u5f00\u59cb\u8c03\u6574\u4f4d\u7f6e-----')\r\n        while colour_port.get_color_percent('chest', *color_params) < shest_color_threshold:\r\n            color = colour_port.get_central_coordinate('chest', *color_params)\r\n            print(f\"'\u989c\u8272\u5750\u6807x:'{color[0]},'y:'{color[1]}\")\r\n            color_x = move_to_target(color[0], *color_xy_threshold['x'])\r\n            color_y = move_to_target(color[1], *color_xy_threshold['y'])\r\n            print(colour_port.get_color_percent('chest', *color_params))\r\n\r\n        print('-----\u8fdb\u5165\u62b1\u8d77\u989c\u8272\u65b9\u5757\u5faa\u73af-----')\r\n        if colour_port.get_color_percent('chest', *color_params) > shest_color_threshold:\r\n            print('--\u5230\u8fbe\u4f4d\u7f6e--')\r\n            base_action.action('\u62b1\u8d77\u65b9\u57571-1')\r\n            print('\u62b1\u8d77\u989c\u8272')\r\n            time.sleep(1)\r\n\r\n        if colour_port.get_color_percent('head', *color_params) >= head_color_threshold:\r\n            print(\"\u5df2\u62b1\u8d77\u65b9\u5757\")\r\n            break\r\n    return True\r\n\r\n\r\n\"\"\"\u63cf\u8ff0\u8be5\u529f\u80fd...\r\n    \u5bf9\u9f50tag\u7801\r\n\"\"\"\r\n\r\n\r\n@handle_errors\r\ndef align_to_tag(tag_id=0, action=\"\", stufen=False, stufen_2=True):\r\n    print('--------\u8fdb\u5165\u901a\u9053\u5faa\u73af--------')\r\n    print(f\"'\u5f00\u59cb\u5411'{tag_id}'\u53f7tag\u9760\u8fd1'\")\r\n    thresholds = tag_action_threshold['stufen' if stufen else 'normal']\r\n    adjusted = {'x': False, 'y': False, 'yaw': False}\r\n    while True:\r\n        tag = artag_port.get_specifies_tag(tag_id, 'chest')\r\n        print('\u80f8\u90e8\uff1a', tag_id, \"x: \", tag[0], \"y: \", tag[1], \"yaw: \", tag[2] + 180)\r\n        if tag[0] == 1000:\r\n            print('----id\u4e22\u5931----')\r\n            base_action.action(tag_actions[tag_id - 1][0])\r\n            print(tag_actions[tag_id - 1][0])\r\n            time.sleep(0.2)\r\n            continue\r\n        print('-----\u5f00\u59cb\u8c03\u6574\u4f4d\u7f6e-----')\r\n\r\n        if not adjusted['yaw']:\r\n            adjusted['yaw'] = move_to_target(tag[2] + 180, *thresholds['yaw'])\r\n            if all(adjusted.values()):\r\n                break\r\n        if adjusted['yaw']:\r\n            adjusted['y'] = move_to_target(tag[1], *thresholds['y'])\r\n            adjusted['x'] = move_to_target(tag[0], *thresholds['x'])\r\n        if adjusted['x'] and adjusted['yaw']:  # \u518d\u6b21\u8c03\u6574yaw\r\n            adjusted['yaw'] = False\r\n\r\n    print('--------\u8fdb\u5165\u6a2a\u5411\u79fb\u52a8\u8c03\u6574-------')\r\n    if tag_id in (3, 6):  # \u6a2a\u5411\u79fb\u52a8\u8c03\u6574\u62d0\u5f2f\u5904\r\n        steps = 2 if tag_id == 3 else 4  # \u6b65\u6570\u770b\u5b9e\u9645\u6b65\u4f10\r\n        action = '\u53f3\u5e73\u79fb3-2' if tag_id == 3 else '\u5de6\u5e73\u79fb3-2'\r\n        for _ in range(steps):\r\n            base_action.action(action)\r\n\r\n    next_id = tag_id + 1\r\n    if stufen_2 and artag_port.get_specifies_tag(next_id, 'chest')[0] == 1000:  # \u5224\u65ad\u662f\u5426\u6a2a\u79fb\u627etag\u7801\r\n        print(f\" \u5f00\u59cb\u8bc6\u522b{next_id}\u53f7tag\u7801\")\r\n        base_action.action(action)\r\n        print(action)\r\n        find_tag(1, *positive_geomag_threshold, '\u5411\u5de6\u8f6c\u52a82-8', '\u5411\u53f3\u8f6c\u52a82-8', '\u5de6\u5e73\u79fb2-8', step=False)\r\n        time.sleep(0.7)\r\n        print(f\"Tag {next_id} \u8bc6\u522b\u6210\u529f\")\r\n\r\n\r\n\"\"\"\u63cf\u8ff0\u8be5\u529f\u80fd...\r\n    \u8fdb\u5165\u901a\u9053\r\n\"\"\"\r\n\r\n\r\n@handle_errors\r\ndef tag_foeward():\r\n    find_tag(1, *positive_geomag_threshold, '\u5411\u5de6\u8f6c\u52a82-8', '\u5411\u53f3\u8f6c\u52a82-8', '\u5de6\u5e73\u79fb3-2', step=True)\r\n    print('------\u8fdb\u5165\u901a\u9053------')\r\n    for id, (next_action, next_back, go_flag) in tag_actions.items():\r\n        if id == 8:\r\n            id = 1\r\n        print(id, next_action)\r\n        align_to_tag(id, next_action, next_back, go_flag)\r\n        go_back = False\r\n        if id == 5:\r\n            print('----\u5f00\u59cb\u8fdb\u5165\u5927\u672c\u8425----')\r\n            go_back = place_block_at_base()\r\n            find_tag(5, *reverse_geomag_threshold, '\u5411\u5de6\u8f6c\u52a81\u6b65', '\u5411\u53f3\u8f6c\u52a81\u6b65', '\u524d\u8fdb2-8',step=True)\r\n            align_to_tag(5, '\u524d\u8fdb2-8', False, True)\r\n        if go_back and id == 1:  # \u56de\u5230\u8d77\u70b9\r\n            for _ in range(2):  # \u6b65\u901f\u770b\u5b9e\u9645\u6b65\u4f10\r\n                base_action.action('\u524d\u8fdb2-8')\r\n\r\n\r\n\"\"\"\u63cf\u8ff0\u8be5\u529f\u80fd...\r\n    \u653e\u4e0b\u65b9\u5757\r\n\"\"\"\r\n\r\n\r\n@handle_errors\r\ndef place_block_at_base():\r\n    for _ in range(4):  # \u6b65\u901f\u770b\u5b9e\u9645\u6b65\u4f10\r\n        base_action.action('\u524d\u8fdb2-8')\r\n    else:\r\n        print('---\u5230\u8fbe\u4f4d\u7f6e---')\r\n        base_action.action('\u5411\u53f3\u8f6c\u52a81\u6b65')\r\n        return True  \r\n\r\n\r\n@handle_errors\r\ndef main():\r\n    print(\"--------\u5f00\u59cb\u8fd0\u884c--------\")\r\n    while True:\r\n        # \u68c0\u67e5\u662f\u5426\u5df2\u6361\u8d77\u65b9\u5757\r\n        head_color_1 = colour_port.get_color_percent('head', *color_params_threshold[1])\r\n        head_color_2 = colour_port.get_color_percent('head', *color_params_threshold[2])\r\n        if head_color_1 >= head_color_threshold or head_color_2 >= head_color_threshold:\r\n            print(\"----\u5df2\u62b1\u8d77\u65b9\u5757\uff0c\u5f00\u59cb\u5bfc\u822a----\")\r\n            tag_foeward()\r\n            continue\r\n            \r\n        # \u9009\u62e9\u6700\u8fd1\u7684\u65b9\u5757\r\n        chest_color_1 = colour_port.get_color_percent('chest', *color_params_threshold[1])\r\n        chest_color_2 = -1\r\n        # colour_port.get_color_percent('chest', *color_params_threshold[2])\r\n        target_params = color_params_threshold[1] if chest_color_1 >= chest_color_2 else color_params_threshold[2]\r\n\r\n        if pickup_block(target_params):\r\n            tag_foeward()\r\n            continue\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    print(\"Run custom project\")\r\n    main()\r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n  import sys\r\nimport time\r\nsys.path.append(\"/home/lemon/catkin_ws/src/aelos_smart_ros\")\r\n\r\nfrom leju import *\r\n\r\nleju_variable_tag_x = None\r\nleju_variable_tag_y = None\r\nleju_variable_tag_yaw = None\r\n\r\n\r\n\r\ndef main():\r\n    nodes.node_initial()\r\n    try:\r\n\r\n\r\n        while True:\r\n            a=sensor_port.get_magnet()\r\n            print(a)\r\n            print(\"==============\")\r\n    except Exception as e:\r\n        nodes.serror(e)\r\n        exit(2)\r\n    finally:\r\n        nodes.finishsend()\r\n\r\n\r\n\r\ndef detect_coordinate_color():\r\n    nodes.node_initial()\r\n    try:\r\n        while True:\r\n            color_params_3 = (155, 98,100,174,175 ,159)\r\n            color_params_1 = (36, 108, 94, 53, 255, 162)\r\n            color_params_2 = (10, 233, 132, 16, 255, 203)\r\n            color=colour_port.get_central_coordinate('chest',*color_params)\r\n            print(f\"'\u989c\u82721\u989c\u8272\u5750\u6807x:'{color_params_1[0]},'y:'{color_params_1[1]}\")\r\n            print(f\"'\u989c\u82722\u989c\u8272\u5750\u6807x:'{color_params_2[0]},'y:'{color_params_2[1]}\")\r\n            print(f\"'\u989c\u82723\u989c\u8272\u5750\u6807x:'{color_params_3[0]},'y:'{color_params_3[1]}\")\r\n    except Exception as e:\r\n        print(e)\r\n        nodes.serror(e)\r\n        exit(2)\r\n\r\n\r\n\r\ndef detect_area_color():\r\n    nodes.node_initial()\r\n    try:\r\n        while True:\r\n            color_params_3 = (155, 98,100,174,175 ,159)\r\n            color_params_1 = (36, 108, 94, 53, 255, 162)\r\n            color_params_2 = (10, 233, 132, 16, 255, 203)\r\n            shest_color = colour_port.get_color_percent('chest',*color_params_1)   \r\n            head_color = colour_port.get_color_percent('head',*color_params_1)\r\n            color = colour_port.get_color_percent('chest',*color_params_3)            \r\n            print('\u80f8\u90e8\uff1a'+str(shest_color),'\u5934\u90e8'+str(head_color),'\u5927\u672c\u8425'+str(color))\r\n            # print('\u989c\u8272\u5750\u6807x:',color[0],'y:',color[1])\r\n\r\n    except Exception as e:\r\n        print(e)\r\n        nodes.serror(e)\r\n        exit(2)\r\n\r\n\r\ndef detect_all_tags():\r\n    nodes.node_initial()\r\n    try:\r\n        print(\"\u5f00\u59cb\u68c0\u6d4b\")\r\n        while True:\r\n            print(\"\u5f00\u59cb\")\r\n            marker = artag_port.get_specifies_marker('chest')\r\n            marker_1 = artag_port.get_specifies_marker('head')\r\n            print(\"============\")\r\n            for ke in marker_1:\r\n                print('\u5934\u90e8\uff1a',ke, \"x: \", marker_1[ke][0], \"y: \", marker_1[ke][1], \"yaw: \", marker_1[ke][2] + 180)\r\n            for key in marker:\r\n                print('\u80f8\u90e8\uff1a',key, \"x: \", marker[key][0], \"y: \", marker[key][1], \"yaw: \", marker[key][2] + 180)\r\n            print(\"============\")\r\n            time.sleep(1)\r\n    except Exception as e:\r\n        print(e)\r\n        nodes.serror(e)\r\n        exit(2)\r\n\r\nif __name__ == \"__main__\":\r\n    print (\"Run custom project\")\r\n    detect_all_tags()\r\n'\r\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A Powerful Windows-PC-Wechat automation Tool",
    "version": "1.5",
    "project_urls": {
        "Homepage": "https://github.com/Hello-Mr-Crab/pywechat"
    },
    "split_keywords": [
        "rpa",
        " windows",
        " wechat",
        " automation"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b9b3a57f9b59382a73b8bee391214ef3e103b5965ad1dbe1ef234702624bf16a",
                "md5": "2e8523fb2998ed22cb56db308afe5b4d",
                "sha256": "ce657d0786e734136b55c84bdcc4a7925d9d93e14b2af24afb7c5a53aee629a9"
            },
            "downloads": -1,
            "filename": "at_hefang-1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2e8523fb2998ed22cb56db308afe5b4d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4306,
            "upload_time": "2025-06-21T05:42:33",
            "upload_time_iso_8601": "2025-06-21T05:42:33.416002Z",
            "url": "https://files.pythonhosted.org/packages/b9/b3/a57f9b59382a73b8bee391214ef3e103b5965ad1dbe1ef234702624bf16a/at_hefang-1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f1d3edc404b9e300e2eaeed4bad310636c6d327d5c0b314772a95bc0d113929b",
                "md5": "da6990c2ed4d631dc7cb58c72643b459",
                "sha256": "4d673751e2dfd4661ca493d89cd066c6fc7dd890ef04f14d5d52183a056490d6"
            },
            "downloads": -1,
            "filename": "at_hefang-1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "da6990c2ed4d631dc7cb58c72643b459",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5230,
            "upload_time": "2025-06-21T05:42:35",
            "upload_time_iso_8601": "2025-06-21T05:42:35.345742Z",
            "url": "https://files.pythonhosted.org/packages/f1/d3/edc404b9e300e2eaeed4bad310636c6d327d5c0b314772a95bc0d113929b/at_hefang-1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-06-21 05:42:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Hello-Mr-Crab",
    "github_project": "pywechat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pyautogui",
            "specs": [
                [
                    ">=",
                    "0.9.54"
                ]
            ]
        },
        {
            "name": "pycaw",
            "specs": [
                [
                    ">=",
                    "20240210"
                ]
            ]
        },
        {
            "name": "pywin32",
            "specs": [
                [
                    ">=",
                    "308"
                ]
            ]
        },
        {
            "name": "pywin32-ctypes",
            "specs": [
                [
                    ">=",
                    "0.2.2"
                ]
            ]
        },
        {
            "name": "pywinauto",
            "specs": [
                [
                    ">=",
                    "0.6.8"
                ]
            ]
        },
        {
            "name": "psutil",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        }
    ],
    "lcname": "at.hefang"
}
        
Elapsed time: 0.91515s