1.8. Skill 模块
- class gomerx.skill.Skill(client: gomerx.client.Client)
基类:
gomerx.module.Module
- delete_face(name: str) bool
删除人脸
- 参数
name (str) – 待删除人脸的姓名
- 返回
删除成功返回True, 失败返回False
- 返回类型
bool
- detect_color_blob(hsv_low: tuple = (0, 0, 0), hsv_high: tuple = (360, 100, 100), timeout: int = 1) tuple
检测色块
- 参数
hsv_low (tuple) – hsv颜色下边界
hsv_high (tuple) – hsv颜色上边界
timeout (int) – 超时时间, 单位 s
- 返回
result (bool) - 检测到色块返回True, 未检测到返回False
data (list) - result为True时, 返回色块中心坐标及宽高[x, y, w, h]
- 返回类型
tuple
- detect_face(timeout: int = 1) tuple
检测人脸
- 参数
timeout (int) – 超时时间, 单位 s
- 返回
result (bool) - 检测到人脸返回True, 未检测到返回False
data (list) - result为True时, 返回最大人脸中心坐标及宽高[x, y, w, h]
- 返回类型
tuple
- detect_line(hsv_low: tuple = (0, 0, 0), hsv_high: tuple = (360, 100, 100), timeout: int = 1) tuple
检测线段
- 参数
hsv_low (tuple) – hsv颜色下边界
hsv_high (tuple) – hsv颜色上边界
timeout (int) – 超时时间, 单位 s
- 返回
result (bool) - 检测到线段返回True, 未检测到返回False
data (list) - result为True时, 返回线段起点和终点坐标[x0, y0, x1, y1]
- 返回类型
tuple
- detect_pattern(id: str = 'A', timeout: int = 1) bool
检测图案
- 参数
id (str) – 图案名称, 支持’A’~’Z’, ‘0’~’9’
timeout (int) – 超时时间, 单位 s
- 返回
检测到指定图案返回True, 未检测到返回False
- 返回类型
bool
- detect_qrcode(timeout: int = 1) tuple
检测二维码
- 参数
timeout (int) – 超时时间, 单位 s
- 返回
result (bool) - 检测到二维码返回True, 未检测到返回False
data (str) - result为True时, 返回二维码字符串信息
- 返回类型
tuple
- get_face_list() tuple
获取已保存的人脸列表
- 参数
list – face_list
- 返回
result (bool) - 获取成功返回True, 失败返回False
data (list) - 包含人脸编号和姓名的列表
- 返回类型
tuple
- move_along_line(stop='end') bool
自动巡线直到线段消失, 使用前需先使用detect_line方法
- 参数
stop – 停止条件, ‘end’: 线段结束, ‘cross’: 岔路口
- 返回
巡线结束返回True, 异常返回False
- 返回类型
bool
- move_to_pattern(id: str = 'A', x: int = 0, y: int = 13) bool
移动至图案前指定位置
- 参数
id (str) – 图案名称, 支持’A’~’Z’, ‘0’~’9’
x (int) – 停止时, 图案中心线与机器人中心线左右距离, 范围[-0.4 * y ~ 0.4 * y], 图案在机器人右侧为正, 单位cm
y (int) – 停止时, 图案处于机器人摄像头平面前方距离, 范围[13 ~ 60], 单位cm
- 返回
成功移动到图案前指定位置返回True, 失败返回False
- 返回类型
bool
- recognize_face() tuple
识别检测到的人脸身份
- 返回
result (bool) - 识别出人脸身份为True, 未识别出为False
name (str) - 人脸姓名
- 返回类型
tuple
- save_face(name: str) bool
录入人脸
- 参数
name (str) – 待录入人脸的姓名
- 返回
录入成功返回True, 失败返回False
- 返回类型
bool