基于视觉控制的足轮两式机器人设计与研究硬件电路与控制系统设计


    




    基视觉控制足轮两式机器
    硬件电路控制系统设计



    基视觉控制足轮两式机器
    硬件电路控制系统设计


    着类社会进步类然界探索范围断扩发明种样机器代类完成相危险工作难解决问题中机器常远距离移动方式三种分轮式履带式足式优缺点
    (1)轮式机器坦道路快速行走相泥泞崎岖复杂形难行进转弯半径转弯效率差灵活性较差
    (2)履带式机器相传统轮式机器够泥泞崎岖复杂形行进原转弯遇落差较障碍时难越
    (3)足式机器适应种复杂形尤跨越障碍方面相轮式机器履带式机器优势足式机器行进速度相较低步态行进稳定性环境关系控制难度较容易侧翻稳定性相较差
    设计方面根种类型机器优缺点取长补短轮式机器足式机器结合起制造出够适应种形灵活变换机器种机器根形灵活变换成形态取长补短种类机器优势发挥出例:坦形轮式形态行进行进速度快源消耗相较足式机器少复杂形足式形态行进灵活性高越野力强方面配置基础位机控制方式外搭配手部识视觉控制模式实现通手部动作变化控制机器运动方式提高设计操作样性
    关键词:足轮结合 数传输 位机 机交互









    Foot wheel two type robot based on vision control
    Hardware circuit and control system design

    Abstract
    With the progress of human society and the expansion of human's exploration of the natural world people have invented all kinds of robots to replace human beings to complete some relatively dangerous work or difficult problemsAmong them there are three kinds of longdistance moving methods commonly used in robots which are wheel type tracked type and foot type and each has its advantages and disadvantages
    1 The wheeled robot can walk quickly on a flat road but it is difficult to travel in other muddy and rugged complex terrain with a large turning radius poor turning efficiency and poor flexibility
    2 Compared with traditional wheeled robots tracked robots can travel in muddy rough and complex terrain and turn on the spot but it is difficult to cross when it encounters obstacles with a large drop
    3 Foottype robot can adapt to a variety of complex terrain especially it has great advantages over wheeled robot and tracked robot in crossing obstacles Howeverthe walking speed is relatively low and the stability of walking has a great relationship with the environment It is difficult to control easy to roll over and the stability is relatively poor
    On the one hand according to the advantages and disadvantages of various types of robots this design will combine the wheeled robot and foot robot to produce a robot that can adapt to a variety of terrains and flexibly transform This kind of robot can be flexibly transformed into different forms according to different terrains to learn from each other and give play to the advantages of different kinds of robots For example when traveling on flat terrain in the form of wheel the traveling speed is fast and the energy consumption is less than that of the foot robot But in the complex terrain can use the foot form to travel the flexibility is high and the offroad ability is strong On the other hand in addition to the basic control mode of the upper computer the visual control mode of hand recognition is also used to control the movement mode of the robot through the change of hand movements which improves the operational diversity of this design
    Keywords Combination of foot wheel Data transmission Upper computer The humancomputer interaction






























    目录
    1绪 1
    11课题研究背景意义 1
    12国外研究情况 1
    13国研究现状 3
    14设计应解决问题 4
    2 数传输搭建 6
    21 WIFI模块选择 6
    22位机ATKESP8266连接 8
    23足式运动方式程序实现 9
    24底层应程序设计 10
    3 位机编写 14
    31安装PyQt5工具包 14
    32位机循环程序 14
    33位机菜单创建 15
    34位机滑块条控件配置 17
    35 位机钮线程配置 19
    36图识 20
    4 硬件系统搭建 23
    41控芯片选择 23
    42硬件电源配置 24
    43驱动方式选择 26
    44光耦隔离电路设计 27
    45晶振电路 28
    46复位电路启动模式 29
    47 JTAG调试接口配置 30
    48硬件电路确定 30
    5总结展 33
    谢辞 34
    参考文献 35
    附录 36



    1绪
    着类社会进步类然界探索范围断扩发明种样机器代类完成相危险工作难解决问题中机器常远距离移动方式三种分轮式履带式足式优缺点
    (1)轮式机器坦道路快速行走相泥泞崎岖复杂形难行进转弯半径转弯效率差灵活性较差
    (2)履带式机器相传统轮式机器够泥泞崎岖复杂形行进原转弯履带式机器遇落差较障碍时难越
    (3) 足式机器种复杂形行走尤跨越障碍方面相轮式机器履带式机器着优势足式机器行进速度相较低步态行进稳定性环境关系控制难度较容易侧翻稳定性相较差
    11课题研究背景意义
    相足式结构轮式履带式机器技术更成熟履带式机器型机器较常坦克挖掘机等等轮式机器更常见汽车典型轮式结构机器类历史发展进程中单纯轮式履带式机器技术已非常成熟足式机器相轮式履带式结构更加复杂控制相困难着控制系统成熟芯片运算速度提升足式机器现代研究中已取巨发展特美国波士顿公司代表四足机器研究国外取重突破进步掀起类足式机器研究热潮
    设计方面根种类型机器优缺点取长补短轮式机器足式机器结合起制造出够适应种形灵活变换机器种机器根形灵活变换成形态取长补短种类机器优势发挥出例:坦形轮式形态行进行进速度快源消耗相较足式机器少复杂形足式形态行进灵活性高越野力强方面配置基础位机控制方式外搭配手部识视觉控制模式实现通手部动作变化控制机器运动方式提高设计操作样性
    12国外研究情况
    足式机器机构设计控制算法研究国外直受广泛关注特发达国家中机器已数十年发展技术已逐渐成熟成种标准设备工业界广泛应[[] 孙英飞罗爱华国工业机器发展研究科学技术工程201212
    ]中1992年成立波士顿公司具代表2005年波士顿公司设计第台名BigDog机器问世(图11示)机器BigDog满足美国军方士兵作战时减少体力消耗单兵作战时提高运送物资力设计款复杂形机器液压驱动系统士兵行军高行进速度达64公里时BigDog机器令惊叹控制算法研究波士顿公司机器BigDog设计控制系统实现周围环境感知行走时进行规划路径波士顿公司2005年设计BigDog机器控制算法前机器领域较难实现然BigDog噪音太会影响军队行动隐秘性军方抛弃BigDog机器成功研发带动国家足式结构机器研究
    2017年波士顿公司推出轮腿结合机构机器Hendle (图12)该足轮结合方式机器行进速度达9英里时垂直跳跃高达122厘米机器足轮结合方式非常完美解决单纯足式结构坦道路运动时耗动力效低等问题Hendle机器通强衡算法实现快速加速制动运动程中转弯原高速转弯单轮斜坡姿态保持稳定搬运货物快速台阶室外雪滑行弹跳等种功

    图11 机器BigDog 图12 机器Hendle
    日机器研究起步较早日机器技术方面研究世界范围处领先位早1985年日研究MAKOTO设计出名MELWALKⅢ机器(图13)MELWALKⅢ足式结构模拟昆虫关节腿部机构8度中6度适应形度转弯度驱动机器前运动1996年日HONDA公司推出第台控制行走双足机器P2(图14)P2机器足部装配压力传感器采连杆结构实现推车台阶等基功
    实验里机器尺寸普遍较利商实验室机器研究取进展研究机构开始研究型机器型机器相型机器具成重量低便生产商业等优势型机器2000年索尼推出智机器狗Aibo(图15)具代表Aibo机器拥20关节20度全身搭载彩色LED灯光触觉传感器反映情感类交互反馈索尼公司专门机器Aibo开发名Aibo生活应软件Aibo生活机器Aibo拥学力决定动作行Aibo机器交互中学行特征动作

    图13 机器MELWALKⅢ 图14 机器P2 图15 机器Aibo
    13国研究现状
    国国足式机器记载追溯三国时期运载粮食木牛流马历史久远法知木牛流马具体结构[[] 宋康康 实现跳跃功四足机器单腿结构设计运动建模分析 郑州轻工业学院 201806
    ]时年代技术限制木牛流马纯机械结构没控制系统控制代国足式机器逐渐展开研究1997年海交通学研究院设计JTUWM—2型全方位四足机器(图16示)该机器采缩放式腿部机构条腿伺服电机控制分3 度度电位器检测JTUWM—2型机器条腿足底装开关型触觉传感器检测腿着状况机体装姿态传感器检测机体倾斜角度[[] 马培荪马烈全方位四足步行机器JTUWM-Ⅱ转弯步态控制研究 海交通学学报1995(05)8792
    ]JTUWM—2型机器运动时极限步速达17kmh该机器目前足式机器典结构
    2011年山东学开启属中国BigDog863项目开发种液压驱动高性四足仿生机器[[] 方珂汇 四足机器机构设计杭州电子科技学 201510
    ](图17)2013年海交通学机械动力工程学院高峰教授带领团队研制六足仿生机器六爪章鱼救援机器进行载试验(图18)[[] 张世锦 基ARM六足机器控制系统设计 江苏科技学 201510
    ]台湾学林沛群教授参考动物然世界行走方式设计出miniRHex机器(图19)miniRHex机器采足轮结合方式行走该独特运动方式适应数然环境形[[] 张婷婷 基ARMCPLD四足机器嵌入式控制器硬件台设计 武汉科技学 20095
    ]

    图16 JTUWM—2机器 图17山东学 四足机器

    图18 六爪章鱼机器 图19 miniRHex机器
    14设计应解决问题
    分析国外研究足式机器研究成果问题中存4问题需解决:
    (1)足式机器然种复杂环境中运动相坦面足式机器转弯灵活度者运动速度轮式机器
    (2)足式机器结构相轮式机器更加复杂体型较足式机器量消耗更负载力明显低轮式机器
    (3)足式机器想实现稳定运动需采集处理数更中包括机器姿态腿间度控制足式机器控制系统芯片数处理求更高
    (4)目前足式机器结构复杂数处理芯片求高导致足式机器成较高实验室足式机器常实现商
    问题组机器进行方面改进:
    (1)采足轮结合结构相坦面轮式结构崎岖形规环境中改变机器运动方式足式结构运动
    (2)降低成提高商价值通数传输方式机器数处理高性终端完成底层机器端采处理力相低芯片通数传输底层芯片完成机器舵机控制
    (3)更户体验通基PyQt5设计位机实现机交互
    (4)增加操作性采位机图识结合方式户根需求选择两种控制机器方式
    (5)机器更简洁基Altium Designer设计集成电路机器总设计方案图110

    图110 总设计方案









    2 数传输搭建
    组选择数传输方式WIFIWIFI线通讯技术利电磁波空中传播面进行数交互通讯方式[[] 汪体成 基WiFi技术功智家居设备研究实现 武汉学20185
    ]线通讯需电线连接连接速度快方便受重视线技术直飞速发展线通讯技术已非常成熟线通讯技术种类繁常见线通讯WIFIRFID蓝牙等三种线通讯技术性表21WIFI基IEEE80211b协议种线传输技术信号稳定传输速度快覆盖范围广组网方便等特点相4G通讯太网通讯更方便成较低更线网络技术发展成熟手提电脑手机板电脑配置WIFI设计选择WIFI作机器数传输方式
    表21 线通讯技术性


    21 WIFI模块选择
    WIFI芯片根驱动方式分两类中类需控单元直接驱动控制种集成MAC层物理层嵌CPU存种方式控单元着较高求开发难度高类芯片模块化[[] 邢孝龙 基网络监控功率直流电源研究 辽宁工业学 201812
    ]通处理器常数接口WIFI模块进入通讯种开发模式效率更高开发成低第二种开发模式市场常开发方式
    设计选WIFI模块型号ATKESP8266原理图(图21)该WIFI模块通串口微控制单元MCU通信ATKESP8266WIFI模块TCP协议栈WIFI串口两者间进行数传输该WIFI模块设置两种工作模式:
    (1)线访问接入点(AP)模式该模式工作方式该模块设置WIFI热点然通手机电脑连接应WIFI热点线接入点AP模式实现局域网线控制典型应方式AP模式需访问互联网实现数发送接收足点该模式距离限制空旷空间里该模式连接距离远200米距离200米时数传输会稳定甚法连接设备
    (2)STA站点模式WIFI模块通路器连接互联网然通移动互联网端手机板电脑访问通访问互联网进连接WIFI模块终实现设备发送接收数STA模式优势通互联网实现设备控制控制距离远足点定需联网较落区者网络站点法覆盖区法进行数传输数通讯互联网会产生数接收延时果数接收时效性求较高设计太适合该模式
    ATKESP8266模块核心处理器ESP8266 EXESP8266EX结构图21示频支持 80 MHz160 MHz集成32 位微型 MCU

    图21 ATKESP8266 原理图 图22 ESP8266EX 结构图
    设计选串口线 WIFI AP 模式具体操作步骤模块工作模式设置线 WIFI 热点然通电脑者手机等设备连接该模块设置WIFI 热点实现设备间线数转换互传功中ATK_ESP8266 模块设置3子模块1UDP数报协议UDP模式需建立连接便发送数 2TCP客户端模式3TCP户端模式配置TCP客户端模式核心指令表22示
    TCP中文名传输控制协议(英语:Transmission Control Protocol)TCP协议运行划分三阶段:连接创建(connection establishment)数传送(data transfer)连接终止(connection termination)TCP数传送状态重机制保证TCP性包括:序号收TCP报文段进行排序检测重复数校验检测报文段错误错传输确认计时器检测纠正丢包延时[[] 华镕 透明绪功实现 动化博览2006(02)2729
    ]
    设计通ATK_ESP8266 模块设置AP模式机器端配置TCP服务端模式设置连接端口8086然通电脑连接ATK_ESP8266 模块设置WiFi热点然基PyQt5编写位机设置连接应模块IP址1921681125设置连接端口8086作TCP客户端连接ATK_ESP8266 模块设置服务端




    表22 TCP客户端模式核心指令

    22位机ATKESP8266连接
    位机利访问TCPIP程序中调Socket通信TCPIP协议实际物理网组完整网络协议[[] 周培 基Socket 时通信系统研究实现 湖南学 201010
    ]Socket称套接字种应程序访问通信协议应程序通常通套接字网络发出请求者应答网络请求机间者台计算机进程间通讯完成socket通信搭建般5部分组成:分:协议址端口号远址远端口号[[] 徐朋 基SOCKET跨台通讯系统研究设计 连理工学 2015
    ]
    Socket 基通信工作流程图23示中作客户端连接方式首先建立套接字socket()然调方法connect()开传输控制协议然连接服务端提供IP址端口port发送数服务端完成数传输调socketclose()关闭套接字

    图23 Socke通信工作流程
    Socket 通信重语句socketsocket([family[ type[ proto]]])函数创建套接字动初始化TCP服务器连接socketsocketconnect (hostport)中host连接址1921681125port连接端口8086通socketsocketsend()字符串数发送已连接服务端socketsocketsrecv()接收TCP返回数返回数类型字符类型Socoket客户端测试程序:
    import socket
    import sys
    s socketsocket(socketAF_INET socketSOCK_STREAM)
    host'ssss'(19216841)
    port 8086
    sconnect((hostport))
    msg'测试socket'
    ssend(msgencode('ascii'))
    sclose()











    23足式运动方式程序实现
    足式运动方式相轮式运动更复杂设计足式运动12舵机12舵机间合理配合实现足式运动关键步骤设计选择解决方法:先通算法计算机器运动时舵机间角度配合完成运动周期记录12舵机节点角度变化(表23)记录excel表格通位机访问excel表格数通Socket发送ARM芯片ARM芯片通次接收舵机角度数通调节引脚输出PWM控制舵机种设计方式减少ARM舵机运动算法计算量位机程序实现:
    dataxlrdopen_workbook('Dpictureexcel2xlsx')
    table datasheets()[0]
    b11
    while runing1and mode2
    a1 str(int(tablecell(b11)value))
    a2 str(int(tablecell(b12)value))
    a3 str(int(tablecell(b13)value))
    a4 str(int(tablecell(b14)value))
    a5 str(int(tablecell(b15)value))
    a6 str(int(tablecell(b16)value))
    a7 str(int(tablecell(b17)value))
    a8 str(int(tablecell(b18)value))














    a9 str(int(tablecell(b19)value))
    a10 str(int(tablecell(b110)value))
    a11 str(int(tablecell(b111)value))
    a12 str(int(tablecell(b112)value))
    a13str(4) msg'aaskskskskskskskskskskskskskk'(a1a2a3a4a5a6a7a8a9a10a11a12a13)
    if connectionTrue
    ssend(msgencode('ascii'))
    timesleep(05)
    if b1>142
    b11
    print(a2)
    b1b1+1


















    表23 足式运动舵机角度变化表

    24底层应程序设计
    配置ATK_ESP8266时ATKESP8266 模块采串口通信设计采STM32f103ZET63号串口ATKESP8266 模块进行数互传STM323号串口初始化程序
    void usart3_init(u32 bound)
    {
    NVIC_InitTypeDef NVIC_InitStructure
    GPIO_InitTypeDef GPIO_InitStructure
    USART_InitTypeDef USART_InitStructure
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB ENABLE) GPIOB时钟
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3ENABLE) 串口3时钟
    USART_DeInit(USART3) 复位串口3
    GPIO_InitStructureGPIO_Pin GPIO_Pin_10 PB10
    GPIO_InitStructureGPIO_Speed GPIO_Speed_50MHz
    GPIO_InitStructureGPIO_Mode GPIO_Mode_AF_PP 复推挽输出
    GPIO_Init(GPIOB &GPIO_InitStructure) 初始化PB10
    GPIO_InitStructureGPIO_Pin GPIO_Pin_11
    GPIO_InitStructureGPIO_Mode GPIO_Mode_IN_FLOATING浮空输入
    GPIO_Init(GPIOB &GPIO_InitStructure) 初始化PB11

    USART_InitStructureUSART_BaudRate bound波特率般设置9600
    USART_InitStructureUSART_WordLength USART_WordLength_8b字长8位数格式
    USART_InitStructureUSART_StopBits USART_StopBits_1停止位
    USART_InitStructureUSART_Parity USART_Parity_No奇偶校验位
    USART_InitStructureUSART_HardwareFlowControl USART_HardwareFlowControl_None硬件数流控制
    USART_InitStructureUSART_Mode USART_Mode_Rx | USART_Mode_Tx 收发模式


    USART_Init(USART3 &USART_InitStructure) 初始化串口 3
    USART_Cmd(USART3 ENABLE) 串口
    接收中断
    USART_ITConfig(USART3 USART_IT_RXNE ENABLE)开启中断
    设置中断优先级
    NVIC_InitStructureNVIC_IRQChannel USART3_IRQn
    NVIC_InitStructureNVIC_IRQChannelPreemptionPriority2 抢占优先级3
    NVIC_InitStructureNVIC_IRQChannelSubPriority 3 子优先级3
    NVIC_InitStructureNVIC_IRQChannelCmd ENABLE IRQ通道
    NVIC_Init(&NVIC_InitStructure) 根指定参数初始化VIC寄存器
    TIM7_Int_Init(1000172001) 10ms中断
    USART3_RX_STA0 清零
    TIM_Cmd(TIM7DISABLE) 关闭定时器7
    }


    ATK_ESP8266接收数时会数发送单片机串口3串口3接收数进行分析处理判断连续存两字符a’时开始采集数a11号舵机需旋转角度
    if(USART3_RX_STA&0X8000) 接收次数
    {
    rlenUSART3_RX_STA&0X7FFF 次接收数长度
    USART3_RX_BUF[rlen]0 添加结束符
    printf(sUSART3_RX_BUF) 发送串口
    sprintf((char*)p收d字节容rlen)接收字节数
    LCD_Fill(30+54115239130WHITE)
    POINT_COLORBRED
    Show_Str(30+5411515612p120) 显示接收数长度

    POINT_COLORBLUE
    LCD_Fill(30130239319WHITE)
    Show_Str(30130180190USART3_RX_BUF120)显示接收数
    aa0
    }
    for(bit5bit<10bit++)
    {
    Int a10
    if(USART3_RX_BUF[bit1]'a'&&USART3_RX_BUF[bit2]'a')
    {
    for(USART3_RX_BUF[bit]'k'bit++)
    {
    a1a1*10+(USART3_RX_BUF[bit]'0') 字符转换数字
    }
    break
    }
    }
    计算旋转角度a1引脚输出PWM 高电频时间舵机旋转角度关系图24机器选旋转270度角度舵机输入PWM高电频时间05ms时舵机角度0度输入PWM高电频时间2ms时舵机角度达270度编写函数程序测试舵机准确旋转位机发送角度位置图2526

    图24 输入PWM舵机角度关系 图25 舵机旋转79度 图26 舵机旋转163度
    3 位机编写
    位机提供机交互创建GUI应程序设计PC端通位机发送数底层ARM芯片创建GUI应程序PyQt5非常错选择PyQtQTPython专门提供GUI扩展Python作脚语言起初具备GUI工具Python语法简单手容易面象特性轻松制作种工具模块30年发展Python已然发展成现代受欢迎编程语言Qt挪威公司1995年推出C++图形户界面应程序开发框架QT具非常丰富c++类库开发户界面流工具PyQt5拥620类6000方法函数python模块集PyQt5应windows Mac OSlinux三常见操作系统
    31安装PyQt5工具包
    简单安装PyQt5工具包Python带(Pythonpip)进行安装Pythonpip提供Python种类型包载安装卸载功Python官方网站载Python版会带安装包理工具(Pythonpip)PythonpipPython脚语言进行安装(输入 sudo python3 getpippy)确定安装Python pip 工具Windows系统中通快捷键(Win+R)运行话框输入 pip install pyqt5(图31)完成安装

    图31 通window话框安装python包理工具
    32位机循环程序
    PyQt5程序前需先导入PyQt5模块方法:
    from PyQt5QtWidgets import*
    from PyQt5QtGui import*
    from PytCore import*
    循环部分采面象编程方式首先创建继承QMainWindow类调initUI()方法创建位机交互界面开启循环程序:

    class Example(QMainWindow)
    def __init__(self)
    super()__init__() #__init__()方法构造器方法
    selfinitUI()
    def initUI(self)
    selfsetGeometry(400300900600) #设置界面位置 屏幕(400300)位置开始显
    示900*600(宽900高600)界面
    selfsetWindowTitle('足轮两式机器位机') #窗口添加标题标题栏展示
    selfshow() #控件桌面显示出存里创建显示器显示出
    if __name__ '__main__'
    app QApplication(sysargv)
    appsetWindowIcon(QIcon(Ddatapythonimagesa1ico))
    ex Example()
    sysexit(appexec_())


    33位机菜单创建
    设计菜单栏选择配置Socket通信中IP址端口PyQt5 中QAction类专门设置户界面菜单工具栏QAction类配置菜单栏中图标文状态文快捷键等等
    Action(IP)关联容进行设计IP QAction('19214841' self checkableTrue)效果鼠标点击IP址菜单时菜单会显示连接IP址19214841通triggeredconnect(selftoggleMenu)方法进行事件连接点击IP钮会触发函数toggleMenu()(效果图32示)菜单栏程序设计:
    函数toggleMenu()配置连接IP址host19216841
    函数toggleMenu2()配置连接端口 port8086
    函数toggleMenu3()进入TCP 客户端连接

    IP QAction('19214841' self checkableTrue) # checkableTrue会鼠标点击保持状态
    IPsetStatusTip('选择IP址')
    IPsetChecked(False)
    IPtriggeredconnect(selftoggleMenu) #传递钮参数方式

    port QAction('8086' self checkableTrue)
    portsetStatusTip('选择端口')
    portsetChecked(False)
    porttriggeredconnect(selftoggleMenu2)

    mode QAction('开始连接' self checkableTrue)
    modesetChecked(False)
    modetriggeredconnect(selftoggleMenu3)

    def toggleMenu(self state) #配置连接IP址host19216841
    global host
    if state
    selfstatusbarshow()
    selfstatusbarshowMessage('连接IP址19214841')
    host'ssss'(19216841)
    else
    selfstatusbarhide()

    def toggleMenu2(self state) #配置连接端口 port8086
    global port
    if state
    selfstatusbarshow()
    selfstatusbarshowMessage('连接端口8086')
    port 8086
    print(port)
    else
    selfstatusbarhide()

    def toggleMenu3(self state) #进入TCP 客户端连接
    global sconnection
    s socketsocket(socketAF_INET socketSOCK_STREAM)
    if state
    selfstatusbarshow()
    print(port)
    print(host)
    sconnect((hostport))
    msg'测试通讯'
    ssend(msgencode('ascii'))
    selfstatusbarshowMessage('连接成功')
    connectionTrue
    print(connection)
    else
    selfstatusbarhide()
    connectionFalse
    sclose()



    图32 位机菜单栏
    34位机滑块条控件配置
    调试更方便位机引滑块条控件QSlider()类机器舵机角度进行调试实现功鼠标应滑动滑块条控件滑块条控件应该数字会通socketsend()函数发送出服务端接受信号时控制应舵机旋转达应角度实现调试功
    滑块条信号改变selfangle()函数关联滑块条数进行读取通socketsend()函数发送出中需注意点滑块条数类型整数函数send()发送数类型需字符串滑动条数进行数类型转换
    滑动条单纯代表数果想直观数显现需QLCDNumber()通selfsld1valueChangedconnect(selflcd1display)方法滑块变化数字变化绑定起效果图33示程序:
    selfsld1QSlider(QtHorizontalself) #设置控件水方式显示
    selfsld1setFocusPolicy(QtNoFocus) #设置控件样式
    selfsld1setGeometry(60 50 200 30) #设置控件位置
    selfsld1setMinimum(0) #设置控件值0
    selfsld1setMaximum(270) # 设置控件值0
    selfsld1setValue(0) #设置控件初始值0
    selfsld1setTickInterval(50) #设置刻度间格
    selfsld1setTickPosition(QSliderTicksBothSides) #设置刻度位置:滑块两侧绘制刻度线
    selfsld1valueChangedconnect(selfangle)#设置滑块条信号滑块值发生改变时发射信号
    def angle(self)
    global a1a2a3a4a5a6a7a8a9a10a11a12a13 #设置全局变量
    a13str(1) #a13标识号
    a1str(selfsld1value()) #滑动条数进行数类型转换
    if connectionTrue #判断否已建立连接
    msg'aaskskskskskskskskskk'(a1a2a3a4a5a6a7a8a13)
    ssend(msgencode('ascii')) #发送数

    selflcd1QLCDNumber(self)
    selflcd1setDigitCount(3)
    selflcd1setGeometry(270405050)
    selflcd1setSegmentStyle(2)
    selfsld1valueChangedconnect(selflcd1display)





    图33 滑块条控件
    35 位机钮线程配置
    selfbtn1QPushButton(' up 'self) #创建钮设置钮字符
    selfbtn1setIcon(QIcon(QPixmap(D\data\python\images\png))) #设置钮图标
    selfbtn1setDefault(True) #设置钮默认状态
    selfbtn1resize(8060) #设置钮
    selfbtn1move(450120) #设置钮位置
    selfbtn1clickedconnect(selfbtnstate) #设置钮信号btnstate()函数关联
    def btnstate(self)
    global modethread1
    senderselfsender() #获取钮字符
    if sendertext()'up' #判断钮符
    if mode1
    mode1
    thread1 myThread(1 Thread1 1) #产生线程
    thread1start() #开启线程
    钮需继承类QPushButton()钮时会连续发送数机器进行特定运动程序实例效果图34

    图34钮控件
    通钮进行循环发送数时作单线程程序法通位机钮中断循环位机钮会触发响应设计通引入线程解决问题线程计算机编程中概念[[] 谷建光 基HTTP 协议线程网络载框架研究实现 南京理工学 20114
    ]线程时间运行程序轨迹提高程序运行效率[[] 范鸥Linux 线程实现技术研究[J]吉林建筑工程学院学报201229(3):8284
    ]常见操作系统中需时间发送接收数数进行处理操作种情况线程处理线程运行特点:
    (1)设计程序运行速度更快
    (2)运线程运行时间长程务交台处理线程单线程更复杂重复线程会导致程序存混乱系统崩溃
    (3)线程时间执行程序线程程序中提供独立程序入口程序出口
    (4)线程现操作系统核心运线程系统时实现网络数接收发送修改文件读取户数等等
    (5)程序线程等务时释放存占提高CPU利率
    Python语言中通调thread()函数产生新线程位机调线程通Socket通信机制发送数测试程序:
    class myThread (threadingThread)
    def __init__(self threadID name counter)
    threadingThread__init__(self)
    selfthreadID threadID
    selfname name
    selfcounter counter
    def run(self) #运线程程序
    b1100
    while mode1 #判断否模式1
    if b1>0 and b1<260and connectionTrue #判断TCP否连接
    b1b1+4
    a1str(b1) msg'aaskskskskskskskskskk'(a1a2a3a4a5a6a7a8a9)
    ssend(msgencode('ascii'))
    print(b1)
    timesleep(015)


    36图识
    提高机器操作性位机中集成手部识功手部识基Opencv输入手部图进行处理通特定手势代表机器特定运动方式具体步骤:
    (1)肤色分割通皮肤肤色外界环境颜色手部外界分离出提取信息
    (2)图效果增强通输入图进行中值滤波操作消图中噪音
    (3)图二极化处理通图二极化处理图片分黑白两部分分析目标关环境信息分离出利信息进行处理
    (4)手势轮廓绘制图中手势边界信息绘制出
    (5)手部信息识通识手部轮廓图中出手指间凸缺陷点判断出读取图中手部伸出手指数
    手部识流程图35手部识效果图36位机整体界面图37

    图35 图识流程图

    图36 手部识效果

    图37 位机操作界面
    4 硬件系统搭建
    硬件控制系统基础稳定硬件系列整产品性着决定性影响设计硬件系统总框架图41设计足轮两式机器设计方案机器机械体位机舵机舵机驱动电路电机电机驱动电路ARM处理器组成具体流程位机通WIFI通信ARM建立数连接足式动方式ARM接收位机发送舵机角度ARM通调节引脚输出PWM光耦隔离电路改变舵机角度轮式运动方式改变引脚高低电频电机驱动电路控制直流电机

    图41 硬件系统总框架
    41控芯片选择
    控制芯片选择STM32F103ZET6STM32意法半导体(ST)公司生产ARM CorteM3 核产品[[] 闫晓俊 基STM32WIFI视频传输研究设计 中北学 20165
    ]采哈佛架构拥独立指令总线数总线系统结构图42STM32常见家庭动化智家居型机器产品工业控制动力设备STM32F103ZET6拥5串口通信接口2IIC2高级定时器4 通定时器2 基定时器功强工作频率高达72MHzSTM32F103ZET6芯片满足部分家庭动化产品智家居机器产品性求
    设计STM32F103ZET6系统搭建参考意法半导体(ST)公司编写stm32f10xx硬件开发手册stm32f10xx硬件开发手册全面介绍芯片硬件功包括stm23系统中硬件电源配置晶振电路复位电路JTAG调试接口配置芯片启动模式

    图42 stm32系统结构图
    42硬件电源配置
    机器12舵机保证12舵机电供应稳定设计电池航模锂电池(图43)该航模电池正常工作时提供111V输入电压电池容量2200MAH放电倍率30C设计舵机正常工作时电压5V控制芯片STM32F103ZET6工作电压33V电源设计中通两级降压方式111V两次降压降33V芯片供电(电源设计框架图44)原舵机驱动需5V电压原111V电压直接降33V电压降低会产生较幅度纹波

    图43 航模锂电池 图44 电源设计框架
    首先先降压芯片LM7805(图45)输入电压111V降压5VLM7805稳压芯片参考电路(图46)输出端输入端分联01μF033μF瓷介电容考虑电耦合滤谐波影响实际电路中消电耦合滤谐波通常会选择增联电容输出端串联电感(电路图47)然线性稳压芯片AMS111733VLM7805芯片输出电压降压33V提供控制芯片供电(图48)

    图45 LM7805 图46 LM7805参考电路

    图47 5V稳定压电路 图48 33V稳压电路
    保证STM32F103ZET6正常工作需输入电压20~36V芯片电源供应图49VDDA电源采嵌入式调压器提供电源VDDA关闭时实时时钟(RTC)备寄存器VBAT引脚供电相51系列单片机电源输入引脚STM32F103ZET611电源输入引脚芯片部走线复杂果单引脚作电源输入会导致输入电压降严重影响芯片工作性设计原理图时11VDD需接入33V电压


    图49 芯片电源供应图

    43驱动方式选择
    常见足式机器会电机驱动者液压驱动方式液压驱动方式型机器中相较常波士顿设计BigDog机器液压作驱动方式液压驱动方式优点力矩稳定性控制简单响应快速足点制造工艺复杂体积重量维护成高液压驱动方式缺点明显型机器设计会更倾电机驱动方式常见足式机器驱动电机步进电机伺服电机舵机
    伺服电机通调节输入脉时间长短控制电机旋转角度[[] 韩军浩 步进电机交流伺服电机性综合较[J] 通讯世界10064222(2019)05018402
    ]伺服电机般作闭环控制伺服电机驱动器带UVW 三相电形成电磁场转子磁场作转动时电机带编码器反馈信号驱动器驱动器根反馈值目标值进行较调整转子转动角度[[] 王勇 步进电机伺服电机较[J] 中企业理科技 201012
    ]伺服电机输出力矩较普遍运运转稳工业生产线机器关节会高频率反复运动伺服电机没刹车功伺服电机作机器关节驱动时关节旋转固定角度时没刹车片电机锁死采伺服电机作驱动方式会降低关节旋转角度精确度
    舵机种电机定位系统称呼舵机伺服电机者电机实现[[] 基ARM六足机器控制系统设计 江苏科技学 201510
    ]舵机控制方式控制芯片产生额定脉信号舵机中驱动电路通接收脉信号放控制电机旋转舵机旋转角度确定较电位器实现舵机旋转角度时较电位器电阻会改变检测电位器阻值确定舵机目前角度较电位器中检测舵机角度反馈舵机控制电路完成闭环控制(原理图410示)
    步进电机(图411)种电脉转化角位移执行机构步进电机接收脉数转化转动角度步进电机般作开环控制步进电机缺乏反馈机制控制精度相伺服电机舵机低步进电机般具载力选较转矩步进电机保证机器正常工作样会产生力矩浪费现象步进电机低速旋转时会产生低频振动现象足式机器足式机构运转速度较慢低频振动现象足式机器控制影响较
    舵机控制简单带闭环系统精度控制旋转角度带减速齿轮组体积较型机器会选择舵机作驱动方式设计通价格扭矩转角度质量尺寸性反应速度灵敏度等方面终选定RDS3225数码舵机(图412)扭矩25kg转角度270°工作电压48~6V带负载旋转速度013秒60度尺寸40mm*20mm*40mm

     
    图410 舵机工作原理图


    图411 步进电机 图412 舵机
    44光耦隔离电路设计
    设计12舵机舵机旋转频率高舵机旋转时会产生电流波动舵机时旋转时瞬间输出电流会STM32额定工作电压33V额定工作电流36mA果直接stm32引脚作脉PWM输入舵机旋转瞬间输出电流会stm32工作稳定死机误动作等障严重情况会烧毁控制芯片[[] 魏君 基ARM型双足机器设计研究 石家庄铁道学 201601
    ]
    系统稳定运行控制芯片stm32产生PWM信号隔离输入舵机中常见隔离方式变压器隔离电容耦合隔离光耦隔离[[] 陆泉森李军鲍鸿 光耦隔离技术智测控系统中应[J] 机械电子 100120080200533
    ]文选择隔离方式光耦隔离光耦隔离相隔离方式特点抗干扰力更强光耦隔离芯片积响应速度快隔离电路芯片型号PC817X3CSP9F(图413)光耦隔离电路图414芯片输出PWM光耦隔离达舵机控制电路前端负载隔开达舵机输出电流法反馈输入端保护控制芯片增加系统稳定性

    图413 光耦隔离芯片PC817X3CSP9F 图 314 光耦隔离电路

    45晶振电路
    晶振名晶体振荡器种具高精度高稳定度振荡器芯片运行提供基准信号[[] 朱乐乐 基ARM CortexM4核功教育机器开发研究 兰州学20135





    附录

    附录1


    仿生四足机器开发
    Thanhtam Ho Sunghac Choi Sangyoon Lee


    文介绍种型四足机器设计原型该机器行走运动两压电复合驱动器实现设计中仿生思想获运动敏捷性重载持续性机器腿设计灵感昆虫腿部形态两条腿关节(臀部膝盖)做两种基动作抬腿走腿机器框架设计相水面斜率机器前移动外机器实现四足动物跳跃运动实验表明该机器携带约100克额外负载相高速度运行四足机器原型成构建压电复合驱动移动机器重步
    关键词四足机器 压电复合驱动器 跳跃运动
    1介绍
    年机器设计然系统结构功中汲取灵感然生物系统机械结构极复杂条腿许度量储存系统肌肉系统工系统高效然运动方法直接应机器极困难克服困难应该考虑简化想法腿机器设计中减少腿数量度例子
    简化机器机械结构模仿生物肌肉考虑非传统致动器特压电致动器已应许型腿式机器设计中[1]De Ambroggi等科学家设计种压电驱动三足跳蚤机器跳蚤灵感机器体积(约2cm×2cm)重量轻负载力足缺点控制器板必须机器分开
    Goldfarb事开发压电驱动中尺度四足机器长度9厘米宽度65厘米高度5厘米重量51克[2]该机器具供电操作力粗糙表面操作性然该机器构建智材料驱动移动机器方面显示出良效果缺乏运动灵活性重载持续性采腿动物昆虫仿生思想会增强点
    仿生腿机器例子独立六足机器长度35毫米重量3克[3]该机器设计交流三脚架步态驱动两压电驱动器说明仿生机器尺寸优势实验结果没显示出成功运动
    文工作发展压电驱动器驱动中尺度腿式机器面压电驱动腿式机器相仿生思想机器设计运动中更应考虑昆虫腿结构功机器中采常见四足动物移动类型
    文采种压电复合致动器轻质压电陶瓷复合曲线致动器(LIPCA)LIPCA生成机器两种运动步态LIPCA压电陶瓷层玻璃环氧碳环氧层组成(见图1)机器中版LIPCA C2实验结果表明LIPCA C2系列[4]中产生位移

    图1 LIPCAC2结构PZT陶瓷层
    碳环氧树脂玻璃环氧树脂
    LIPCA作中尺度腿机器执行机构具许优点首先LIPCA线性致动器非常适合腿机器机构[5]第二LIPCA种轻量级执行器中尺度机器理想属性第三类型压电复合作动器相LIPCA具更高力更位移
    幸LIPCA缺点完全移动机器需携带额外负载通常包括控制电路电池需致动器产生更强力量然LIPCA活性够强外位移迫建立型机械放器结果机制变更加复杂沉重压电驱动器样LIPCA需高驱动电压工作LIPCA作腿式机器执行器缺点需运动机制进行巧妙设计导致仿生思想应
    2机器设计
    21四足动物运动
    然界中运动类型应四足机器中行走跳跃常见运动(见图2)行走程中边前腿边腿形成机器移动时移动处阶段相反跳跃运动中两条前腿组成两条腿组成两相反阶段移动节介绍四足机器原型跳跃运动

    图2 行走跳跃运动四足动物(前视图)
    22腿设计
    中尺度腿式机器设计中重素机构稳定性简单性生物系统中发现种样腿部结构昆虫六条更腿哺乳动物四条腿类两条腿事实机器腿越少保持衡时需做更努力控制运动
    拥六条六条腿机器稳定性方面具显著优势样机器静态稳定步态设计六条腿做出两三脚架步态组腿站组摇摆例昆虫蜘蛛够出生立行走结构求复杂适合中尺度机器相反四条腿配置六条腿配置简单然足够稳定性四条腿配置成机器更合理选择注意两片LIPCA放置条腿关节
    步行机器条腿通常14度(DOF)度通执行器[6]实现般说腿机器操作性机器腿度成正腿机器说表现出复杂敏捷动作条腿需三四度求条腿需执行器消耗量量控制复杂性高
    前腿机器进行量实验出结机器腿完成基动作举起行走少需两度种运动单腿部关节种排列产生(例参见图3)哺乳动物等动物相昆虫腿产生推力更更效利驱动器力量




    图3带两三度腿
    简化机构条腿设计成关节髋关节LIPCA部件驱动两条腿中LIPCA运动通曲柄转移腿通种简化需两块LIPCA驱动机器四条腿降低量消耗总质量机器条腿结构图4示

    图4条腿髋关节
    (简单起见条腿设计关节)
    条腿度实现简单设计驱动机器前移动需更仔细考虑述条腿少需两度实现举起摆动例度摆动腿时腿面抬起然问题通改变前腿腿长度解决图5显示角α助效前运动




    图5机器框架角(α)腿
    角度腿长度差造成
    原理腿移动方设置机器框架方行腿移动时尖端接触面种行类似腿抬起腿移动时末端面接触形成推力机器前移动
    23运动模拟
    利ADAMS软件建立机器等效模型进行机构仿真模拟中考察工作频率楼板摩擦力车身框架角等设计素影响模拟中基设计变量机器质量腿旋转角度保持变机器计算机模型图6示

    图6机器ADAMS软件中进行计算机仿真等效模型
    仿真工作中工作频率10hz60hz间变化时机器模型跳跃步态正常移动仿真结果表明然条腿关节机器获稳定运动图7显示模拟工作中边界模式四种状态图2图7发现相似模式

    图7仿真中机器跳跃步态
    3机器原型
    31边界原型
    目前原型中LIPCA作动器固频率较高采边界运动驱动机器高速运行边界原型两片LIPCA实现移动唇两腿相连形成组唇前腿构成组立卡通曲柄连接腿立卡移动时曲柄旋转腿移动图8描述边界原型总体设计

    图8边界原型总体设计
    32制造
    机器零部件CAD制作成制作程中丙烯酸材料需轻坚固车身机器部分先组装然螺栓螺母碳棒碳进行组装作步两LIPCA片连接机器身体框架
    样机重量约50克长宽高分120毫米115毫米75毫米图9显示边界原型LIPCA位移机器腿位移关系LIPCA谐振频率处位移约3mm通放机制增加5mm (见图10)

    图9跳跃机器原型

    图10 LIPCA位移腿部位移关系
    4实验
    41频率速度影响
    板胶合板进行量实验评估原型性电源示波器提供高电压测量交流电压频率
    斜坡信号符号信号相方形信号电压产生更功率更位移LIPCA约370Vpp信号驱动频率580 Hz间超频率原型法正常移动实验装置图11示

    图11运动轨迹电源示波器组成实验装置
    第组实验测量机器频率运动速度LIPCA零件进行激励测量机器移动轨道末端时间通改变频率机器频率速度数(见表1)图12边界原型频率速度数结果表明施加附加载荷情况50hz频率边界原型速度470 mm·s−1
    图12频率速度(附加重量)
    42角度速度影响
    前节述身体框架角度影响机器运动确定角度优值进行实验通长度腿改变角度图13显示机器速度测量α角值结果表明8˚效α值边界原型

    图13速度角度α(额外重量)
    43负载试验
    第三组实验应机器原型找出携带少负载附加额外负载十条运行整踪测量时间实验效载荷边界原型发现总结实验结果图14果负载连接速度降机器然运行67毫米·s−1 100克效载荷然边界原型弱点没运动称配置力

    图14效载荷速度
    5讨结
    文中报告中尺度轻快速四足机器两块智材料LIPCA驱动机器腿部结构受生物系统结构启发然机器简单机制然足够稳定性昆虫腿构型应机器设计中效利驱动器功率四足动物种运动类型中采跳跃运动制作边界原型进行仿真实验实验结果表明该跳跃机器运动速度效载荷方面具较强力事实原型速度470毫米·秒−1相惊意味着机器秒移动约四倍体长距离
    实验身体框架角α澄清角度机器运动目前止优值α8˚实验表明该机器原型实现更高效运动α优值
    机器原型丙烯制成相较坚硬易组装拆卸方面提高机器性首先目前正开发种型轻型供电电路机器够携带电路电池电路电池总重量预计100克考虑仿生思想更应机器材料转变成轻质坚固复合材料然原型改进认构建智材料驱动移动机器重步

    参考文献
    [1] De Ambroggi F Fortuna L Muscato G PLIF Piezo light intelligent fleanew microrobots controlled by selflearning techniques Proceeding of the IEEE International Conference on Robotics and Automation 1997 2 1767–1772
    [2] Goldfarb M Golgola M Fischer G Garcia E Development of a piezoelectricallyactuated mesoscale robot quadruped Journal of Micromechatronics 2001 1 205–219
    [3] Sahai R Avadhanula S Groff R Steltz E Wood R Fearing R S Towards a 3g crawling robot through the integration of microrobot technologies Proceeding of the IEEE International Conference on Robotics and Automation 2006 1 296–302
    [4] Yoon K J Park K H Lee S K Goo N S Park H C Analytical design model for a piezocomposite unimorph actuator and its verification using lightweight piezocomposite curved actuators Smart Material and Structures 2004 13 459–467
    [5] Sandin P E Robot Mechanism and Mechanical Devices Illustrated McGrawHill New York USA 2003
    [6] Siegwart R Nourbakkhsh I R Introduction to Autonomous Mobile Robots The MIT Press Cambridge MA USA 2004






























    附录2

    Development of a Biomimetic Quadruped Robot
    Thanhtam Ho Sunghac Choi Sangyoon Lee

    Abstract
    This paper presents the design and prototype of a small quadruped robot whose walking motion is realized by two piezocomposite actuators In the design biomimetic ideas are employed to obtain the agility of motions and sustainability of a heavy load The design of the robot legs is inspired by the leg configuration of insects two joints (hip and knee) of the leg enable two basic motions lifting and stepping The robot frame is designed to have a slope relative to the horizontal plane which makes the robot move forward In addition the bounding locomotion of quadruped animals is implemented in the robot Experiments show that the robot can carry an additional load of about 100 g and run with a fairly high velocity The quadruped prototype can be an important step towards the goal of building an autonomous mobile robot actuated by piezocomposite actuators
    Keywords quadruped robot piezocomposite actuator bounding locomotion



    1 Introduction
    In recent times robot designs often import ideas from the structures and functions of natural systems However direct application of natural locomotion methods to robots is extremely difficult due to several reasons an enormous complexity in the mechanical structure of biological systems many degrees of freedom in each leg far more efficient energy storage system and muscular system than artificial ones Therefore in order to overcome those difficulties ideas of simplification should be considered In the design of legged robots reducing the number of legs or degrees of freedom can be an example
    As an effort to simplify the robot mechanism and to mimic biological muscles unconventional actuators have been considered In particular piezoelectrical actuators have been used in several designs of small legged robots[1–3] De Ambroggi et al introduced a piezoelectrically actuated flea robot with three legs[1] The robot inspired from fleas possesses a small size (approximately 2 cm by 2 cm) and light weight but has shortcomings in the ability of carrying a load and hence the controller board must be separated from the robot
    Goldfarb and his coworkers developed a piezoelectrically actuated mesoscale quadruped robot with the length of 9 cm width of 65 cm height of 5 cm and the weight of 51 g[2] The robot has the capabilities of selfpowered operation and maneuverability on rough surfaces Though the robot shows promising results towards building autonomous mobile robots actuated by smart materials it lacks agility of motions and sustainability of a heavy load which may be augmented by adopting biomimetic ideas from legged animals or insects
    A recent example of biomimetic legged robot is a selfcontained hexapod robot with 35 mm length and 3 g weight[3] The robot is designed to move in the alternating tripod gait driven by two piezoelectric actuators It shows the advantage in the size of biomimetic robot but the experimental results have not shown a successful locomotion yet
    The work presented here is for the development of mesoscale legged robots that are actuated by piezoelectrical actuators Compared to the piezoelectrically actuated legged robots above more biomimetic ideas are applied to the design and locomotion of robot The structures and functions of insect leg are considered and the most common locomotion type of quadruped animals is also employed in the robot
    In this work a piezocomposite actuator named Lightweight Piezoceramic Composite Curve Actuator (LIPCA) is used LIPCA is used to generate two kinds of locomotion gaits of the robots LIPCA is made of a piezoelectric ceramic layer and other layers of glassepoxy and carbonepoxy (see Fig 1) Among several versions of LIPCA LIPCA C2 is used for our robots because experimental results show that LIPCA C2 can produce the largest displacement among other series[4]

    Fig 1 Structure of LIPCAC2 layers of PZT ceramic
    carbonepoxy and glassepoxy
    LIPCA possesses several advantages as the actuator for mesoscale legged robots First LIPCA is a linear actuator and so wellsuited for legged robot mechanisms[5] Second LIPCA is a lightweight actuator which is a desirable attribute for mesoscale robots Third LIPCA has a higher force and a larger displacement than other types of piezocomposite actuators
    Unfortunately LIPCA has some drawbacks too For a fully autonomous locomotion a robot needs to carry an additional load that typically includes a control circuit and a battery which requires an actuator to produce a stronger force However the active force of LIPCA is not strong enough In addition the displacement is not so large either which forces to build a large mechanical amplifier As a result the mechanism becomes more complicated and heavier Finally like other piezoelectric actuators LIPCA requires a high drive voltage for operation Therefore using LIPCA as actuator for legged robots in spite of the weakness entails a clever design of locomotion mechanism which leads to the employment of biomimetic ideas
    2 Robot design
    21 Locomotion of quadrupeds
    Many locomotion types in nature can be applied for quadruped robots among which walking and bounding are the most general locomotions (see Fig 2) In the walking the front leg on one side and the rear leg on the opposite side make a pair and they move in the same phase when the robot moves On the contrary in the bounding locomotion two front legs make a pair and two rear legs make another one and two pairs move in the opposite phases The bounding locomotion is employed in our fourlegged prototype robot that is described in the next section


    Fig 2 Walking and bounding locomotions of
    quadrupeds (top view)
    22 Leg design
    In the design of a mesoscale legged robot the most important factors can be the stability and simplicity of mechanism A variety of leg configurations are found in biological systems Insects have six or more legs while mammals have four and humans have two legs In fact the less the number of legs of a robot has the more attempts we have to do to control the locomotion while maintaining the balance
    Robots with six or more legs have a significant advantage in stability In such robots the statically stable gait design is possible because six legs can make two tripod gaits One set of legs stands on the ground while the other set swings above the ground For example insects and spiders are able to walk immediately after the birth[6] However the configuration requires a higher complicacy of mechanism so it is not suitable for mesoscale robots On the contrary fourlegged configurations are much simpler than sixlegged ones but they still have a sufficient stability Therefore fourlegged configurations can be a more reasonable choice for our robots Note that two pieces of LIPCA are placed up and down and each leg has only one joint
    Usually each leg of walking robots has one to four degrees of freedom (DOF) and each DOF can be realized by one actuator[6] In general the maneuverability of legged robots is proportional to the number of DOF of robot legs For a legged robot to show complex and agile maneuvers three or four DOF may be necessary for each leg which entails several actuators per leg a large amount of energy consumption and a high complexity of control
    Numerous experiments with legged robots that we conducted previously led to a conclusion that at least two DOF is necessary in order for the robot leg to perform the most basic motions lifting and stepping Such motions can be generated by a variety of arrangements of joints in an individual leg (see Fig 3 for example) Compared with the arrangements of other animals such as mammals insect legs generate a less thrusting force and so the power of actuators can be used more effectively


    Fig 3 Legs with two or three degrees of freedom
    In order to simplify the mechanism each leg is designed to have only one joint the hip joint One LIPCA piece actuates two legs in which the motion of LIPCA is transferred to the legs by means of a crank By this simplification only two pieces of LIPCA are required to actuate four legs of the robot such that the energy consumption and total mass are reduced The structure of individual leg of our robots is illustrated in Fig 4

    Fig 4 Hip joint of a leg (Each leg is designed to have
    only one joint for simplicity)
    Using one DOF per leg can lead to a simple design but more careful considerations are necessary for driving he robot to move forward As discussed above at least two DOF are required for each leg in order to implement both lifting and swinging For example one DOF is for swinging the leg but it cannot lift up the leg from the ground at the same time However this problem could be solved in our robots by making a difference of the lengths of front and rear legs Fig 5 shows how the angle α can contribute effectively to the forward movement

    Fig 5 Robot frame angle (α) and the tip of the leg The
    angle is created by the difference of leg lengths
    The principle is as follows The moving direction of the leg is set to be parallel to the robot frame direction Hence when the leg moves upward the tip does not contact the ground This behavior is similar to lifting the leg up from the ground When the leg moves downward the end point contacts the ground and forms a pushing force which enables the robot to move forward
    23 Simulation of locomotion
    Using the ADAMS software we built an equivalent model of the robot for the mechanism simulation In the simulation the effect of several design factors such as the working frequency friction of the floor and the body frame angle were examined In all simulations the basic design variables such as the robot mass and the leg rotation angle were kept constants A computer model of the robot is shown in Fig 6

    Fig 6 Equivalent model of the robot for computer
    simulation in ADAMS software
    In the simulation work when the working frequency varies from 10 Hz to 60 Hz the robot model moved properly in bounding gait The simulation results also show that though each leg has only one joint the robot still obtains a stable locomotion Fig 7 displays four states of the bounding mode from the simulation work Comparing Fig 2 with Fig 7 a similar pattern can be found

    Fig 7 Bounding gait of the robot in the simulation
    3 Robot prototype
    31 Bounding prototype
    In the current prototype only bounding locomotion is employed because the natural frequency of LIPCA actuator is fairly high so it can drive the robot to run with a high velocity The bounding prototype uses two pieces of LIPCA to realize locomotion The upper LIPCA is connected to both rear legs which forms one group and the lower LIPCA and front legs constitute the other group The LIPCA is connected to the legs by means of a crank When a LIPCA moves the crank rotates and the legs move as a result Fig 8 describes the overall design of bounding prototype


    Fig 8 Overall design of bounding prototype

    32 Fabrication
    Robots were built from the CAD work of all the components For the fabrication acrylic material was used because a light and rigid body was desired Each part of the robots was fabricated first and then they were assembled by using bolts nuts carbon rods and carbon pipes As the final step two LIPCA pieces were attached to the robot body frame
    The weight of the prototype is about 50 g and the length width and height are 120 mm 115 mm 75 mm respectively Fig 9 shows the bounding prototype The displacement of LIPCA has the following relation with that of robot leg the maximum displacement of LIPCA at the resonant frequency is about 3 mm which is increased to 5 mm with 10˚ rotation range by means of amplification mechanism (see Fig 10)


    Fig 9 Bounding robot prototype


    Fig 10 Relations of LIPCA displacement and
    leg displacement
    4 Experiment
    41 Effect of frequency on the velocity
    Numerous experiments were conducted on a flat plywood panel to evaluate the performance of the prototype A power supply and an oscilloscope were used to supply a high voltage and measure the frequency of AC voltage
    A square signal voltage was used because it could produce more power and larger displacement of LIPCA than ramp or sign signals LIPCA was actuated by about 370 Vpp signal with frequency in the range of 5 to 80 Hz beyond which the prototype cannot move properly The experimental apparatus is shown in Fig 11

    Fig 11 Experimental apparatus composed of a locomotion
    track a power supply and an oscilloscope
    The first set of experiments was to measure the locomotion velocity of the robot at different frequencies We excited the LIPCA pieces and measured the time for the robot to move to the end on the track By changing the frequency we could get the velocity data of the robot at various frequencies (see Table 1) Fig 12 shows the velocity data for various frequencies of the bounding prototype It is shown that when no additional load is applied the maximum velocity 470 mm·s−1 of the bounding prototype can be obtained at 50 Hz frequency


    Fig 12 Velocity for different frequency
    (no additional weight)
    42 Effect of angle on the velocity
    As described in previous section the angle of the body frame affects the motion of robot In order to determine the optimal value of this angle several experiments were performed By using legs which have different length the angle can be changed Fig 13 shows the velocities of robot measured at several values of α angle The results show that 8˚ may be the most efficient value of α of the bounding prototype

    Fig 13 Velocity for different angle α
    (no additional weight)
    43 Payload experiments
    The third set of experiments was applied to the robot prototype only in order to find out how much load it can carry After attaching an additional payload to therobot we had it run the whole track and measured the time From these experiments the maximum payload of the bounding prototype was found The experimental results are summarized in Fig 14 If a load is attached the velocity drops but the robot can still run at 67 mm·s−1with the payload of 100 g However the weakness of the bounding prototype is that it does not have the ability of turning motion due to the symmetric configuration

    Fig 14 Velocity for different payloads
    5 Discussion and conclusion
    In this paper we reported a mesoscale light fast fourlegged robot which is actuated by two pieces of a smart material LIPCA The leg configuration of robots is inspired by the structure of biological systems Though the robot has a simpler mechanism it still has a sufficient stability The configuration of insect legs is applied to the robot design and the power of actuators is used efficiently Among several locomotion types of quadrupeds the bounding motion is employed A bounding prototype was fabricated and several simulations and experiments were conducted Experimental results show that the bounding robot has a superior ability in terms of the locomotion velocity and the payload In fact the maximum speed of the bounding prototype 470 mm·s−1 is quite remarkable since it means that the robot can move about four times its body length per second
    Experiments with different body frame angles α clarify how this angle contributes to the movement of the robot and by far the optimal value of α is 8˚ Experiments also show that the robot prototype can attain more efficient motion with the optimal value of α
    Since the robot prototypes are made of acrylic they are relatively rigid and easy to assemble and disassemble There are several aspects to improve the performance of the robot First of all a small and light power supply circuit is currently under development such that the robot could be able to carry the circuit and battery The total weight of the circuit and battery is expected to be less than 100 g We also consider more application of biomimetic ideas to the robot and change of the material into lightweight and strong composites Though the prototypes are yet to be improved they are considered as an important step in building autonomous mobile robots actuated by smart materials
    References
    [1] De Ambroggi F Fortuna L Muscato G PLIF Piezo light intelligent fleanew microrobots controlled by selflearning techniques Proceeding of the IEEE International Conference on Robotics and Automation 1997 2 1767–1772
    [2] Goldfarb M Golgola M Fischer G Garcia E Development of a piezoelectricallyactuated mesoscale robot quadruped Journal of Micromechatronics 2001 1 205–219
    [3] Sahai R Avadhanula S Groff R Steltz E Wood R Fearing R S Towards a 3g crawling robot through the integration of microrobot technologies Proceeding of the IEEE Interna[]tional Conference on Robotics and Automation 2006 1 296–302
    [4] Yoon K J Park K H Lee S K Goo N S Park H C Analytical design model for a piezocomposite unimorph actuator and its verification using lightweight piezocomposite curved actuators Smart Material and Structures 2004 13 459–467
    [5] Sandin P E Robot Mechanism and Mechanical Devices Illustrated McGrawHill New York USA 2003
    [6] Siegwart R Nourbakkhsh I R Introduction to Autonomous Mobile Robots The MIT Press Cambridge MA USA 2004








































    附录3
    import sys
    import serial
    import threading
    import socket
    import time
    import cv2
    import numpy as np
    import math
    import xlrd
    from PyQt5QtWidgets import*
    from PyQt5QtGui import*
    from PyQt5QtCore import*
    #from PyQt5QtWidgets import QMainWindow QAction QApplication
    global sa1a2a3a4a5a6a7a8a9a10a11a12a13
    global moderuning
    global connectionthread1

    connectionFalse
    exitFlag 0

    class myThread (threadingThread)
    def __init__(self threadID name counter)
    threadingThread__init__(self)
    selfthreadID threadID
    selfname name
    selfcounter counter
    def run(self)
    dataxlrdopen_workbook('Dpictureexcel2xlsx')
    table datasheets()[0]
    b11


    if runing2and mode1 #轮式左转
    msg'aa0k235k35k0k235k35k0k235k35k0k235k35k1kk' #a131
    print(足式左转)
    if connectionTrue #判断否连接
    ssend(msgencode('ascii'))
    timesleep(05)
    if runing2and mode2 #轮式前进
    msg'aa0k235k35k0k235k35k0k235k35k0k235k35k2kk' #a132
    print(足式前进)
    if connectionTrue
    ssend(msgencode('ascii'))
    timesleep(05)

    if runing2and mode3 #轮式右转
    msg'aa0k235k35k0k235k35k0k235k35k0k235k35k3kk' #a133
    print(足式右转)
    if connectionTrue
    ssend(msgencode('ascii'))
    timesleep(05)

    if runing2and mode0 #轮式停止
    msg'aa0k235k35k0k235k35k0k235k35k0k235k35k0kk' #a130
    print(足式停止)
    if connectionTrue
    ssend(msgencode('ascii'))
    timesleep(05)

    while runing1and mode2 #足式式前进
    #print(111)
    a1 str(int(tablecell(b11)value))
    a2 str(int(tablecell(b12)value))
    a3 str(int(tablecell(b13)value))
    a4 str(int(tablecell(b14)value))
    a5 str(int(tablecell(b15)value))
    a6 str(int(tablecell(b16)value))
    a7 str(int(tablecell(b17)value))
    a8 str(int(tablecell(b18)value))
    a9 str(int(tablecell(b19)value))
    a10 str(int(tablecell(b110)value))
    a11 str(int(tablecell(b111)value))
    a12 str(int(tablecell(b112)value))
    a13str(4)
    msg'aaskskskskskskskskskskskskskk'(a1a2a3a4a5a6a7a8a9a10a11a12a13)
    if connectionTrue
    ssend(msgencode('ascii'))
    timesleep(05)
    if b1>142
    b11
    print(a2)
    b1b1+1

    class Example(QMainWindow)

    def __init__(self)
    super()__init__()
    selfinitUI()


    def initUI(self)


    IP QAction('19214841' self checkableTrue)
    IPsetStatusTip('选择IP址')
    IPsetChecked(False)
    IPtriggeredconnect(selftoggleMenu)

    port QAction('8086' self checkableTrue)
    portsetStatusTip('选择端口')
    portsetChecked(False)
    porttriggeredconnect(selftoggleMenu2)

    mode QAction('开始连接' self checkableTrue)
    #modesetStatusTip('选择端口')
    modesetChecked(False)
    modetriggeredconnect(selftoggleMenu3)

    selfstatusbar selfstatusBar()
    selfstatusbarshowMessage('Ready')

    menubar selfmenuBar()
    viewMenu menubaraddMenu('IP址')
    viewMenu2 menubaraddMenu('端口')
    viewMenu3 menubaraddMenu('状态')
    viewMenuaddAction(IP)
    viewMenu2addAction(port)
    viewMenu3addAction(mode)



    selflabel1QLabel(self)
    selflabel1setText(左1)
    selflabel1setFont(QFont(Roman times12QFontBold))
    selflabel1move(548)

    selflabel2QLabel(self)
    selflabel2setText(左2)
    selflabel2setFont(QFont(Roman times12QFontBold))
    selflabel2move(5118)

    selflabel3QLabel(self)
    selflabel3setText(左3)
    selflabel3setFont(QFont(Roman times12QFontBold))
    selflabel3move(5188)

    selflabel4QLabel(self)
    selflabel4setText(左1)
    selflabel4setFont(QFont(Roman times12QFontBold))
    selflabel4move(5258)

    selflabel5QLabel(self)
    selflabel5setText(左2)
    selflabel5setFont(QFont(Roman times12QFontBold))
    selflabel5move(5328)

    selflabel6QLabel(self)
    selflabel6setText(左3)
    selflabel6setFont(QFont(Roman times12QFontBold))
    selflabel6move(5398)

    selflabel7QLabel(self)
    selflabel7setText(右1)
    selflabel7setFont(QFont(Roman times12QFontBold))
    selflabel7move(33048)

    selflabel8QLabel(self)
    selflabel8setText(右2)
    selflabel8setFont(QFont(Roman times12QFontBold))
    selflabel8move(330118)

    selflabel9QLabel(self)
    selflabel9setText(右3)
    selflabel9setFont(QFont(Roman times12QFontBold))
    selflabel9move(330188)

    selflabel10QLabel(self)
    selflabel10setText(右1)
    selflabel10setFont(QFont(Roman times12QFontBold))
    selflabel10move(330258)

    selflabel11QLabel(self)
    selflabel11setText(右2)
    selflabel11setFont(QFont(Roman times12QFontBold))
    selflabel11move(330328)

    selflabel12QLabel(self)
    selflabel12setText(右3)
    selflabel12setFont(QFont(Roman times12QFontBold))
    selflabel12move(330398)


    pe QPalette() #设置label字体颜色
    pesetColor(QPaletteWindowTextQtdarkCyan)#设置字体颜色
    selflabel1setPalette(pe)
    selflabel2setPalette(pe)
    selflabel3setPalette(pe)
    selflabel4setPalette(pe)
    selflabel5setPalette(pe)
    selflabel6setPalette(pe)
    selflabel7setPalette(pe)
    selflabel8setPalette(pe)
    selflabel9setPalette(pe)
    selflabel10setPalette(pe)
    selflabel11setPalette(pe)
    selflabel12setPalette(pe)


    selfbtn1QPushButton(' up 'self)
    selfbtn1setIcon(QIcon(QPixmap(D\data\python\images\png)))
    selfbtn1setDefault(True)
    selfbtn1resize(8060)
    selfbtn1move(800120)
    selfbtn1clickedconnect(selfbtnstate)

    selfbtn2QPushButton('stop'self)
    selfbtn2setIcon(QIcon(QPixmap(D\data\python\images\png)))
    selfbtn2setDefault(True)
    selfbtn2resize(8060)
    selfbtn2move(800190)
    selfbtn2clickedconnect(selfbtnstate)

    selfbtn3QPushButton('left'self)
    selfbtn3setIcon(QIcon(QPixmap(D\data\python\images\左png)))
    #selfbtn3setCheckable(True)
    selfbtn3setDefault(True)
    selfbtn3resize(8060)
    selfbtn3move(710190)
    selfbtn3clickedconnect(selfbtnstate)

    selfbtn4QPushButton('right'self)
    selfbtn4setIcon(QIcon(QPixmap(D\data\python\images\右png)))
    selfbtn4setDefault(True)
    #selfbtn4setCheckable(True)
    selfbtn4resize(8060)
    selfbtn4move(890190)
    selfbtn4clickedconnect(selfbtnstate)

    selfbtn5QPushButton('video'self)
    selfbtn5setIcon(QIcon(QPixmap(D\data\python\images\手3png)))
    selfbtn5setDefault(True)
    #selfbtn4setCheckable(True)
    selfbtn5resize(8060)
    selfbtn5move(1150120)
    selfbtn5clickedconnect(selfbtnstate)

    selfbtn6QPushButton('close'self)
    selfbtn6setIcon(QIcon(QPixmap(D\data\python\images\closeico)))
    selfbtn6setDefault(True)
    #selfbtn4setCheckable(True)
    selfbtn6resize(8060)
    selfbtn6move(1150190)
    selfbtn6clickedconnect(selfbtnstate)

    selfbtn7QPushButton('wheel'self)
    selfbtn7setIcon(QIcon(QPixmap(D\data\python\images\轮子png)))
    selfbtn7setDefault(True)
    #selfbtn4setCheckable(True)
    selfbtn7resize(8060)
    selfbtn7move(1060190)
    selfbtn7clickedconnect(selfbtnstate)

    selfbtn8QPushButton('leg'self)
    selfbtn8setIcon(QIcon(QPixmap(D\data\python\images\蜘蛛侠png)))
    selfbtn8setDefault(True)
    #selfbtn4setCheckable(True)
    selfbtn8resize(8060)
    selfbtn8move(1060120)
    selfbtn8clickedconnect(selfbtnstate)


    selfsld1QSlider(QtHorizontalself)
    selfsld1setFocusPolicy(QtNoFocus)
    selfsld1setGeometry(60 50 200 30)
    selfsld1setMinimum(0)
    selfsld1setMaximum(270)
    selfsld1setValue(0)
    selfsld1setTickInterval(50)
    selfsld1setTickPosition(QSliderTicksBothSides)

    selfsld2QSlider(QtHorizontalself)
    selfsld2setFocusPolicy(QtNoFocus)
    selfsld2setGeometry(60 120 200 30)
    selfsld2setMinimum(0)
    selfsld2setMaximum(270)
    selfsld2setValue(0)
    selfsld2setTickInterval(50)
    selfsld2setTickPosition(QSliderTicksBothSides)

    selfsld3QSlider(QtHorizontalself)
    selfsld3setFocusPolicy(QtNoFocus)
    selfsld3setGeometry(60 190 200 30)
    selfsld3setMinimum(0)
    selfsld3setMaximum(270)
    selfsld3setTickInterval(50)
    selfsld3setTickPosition(QSliderTicksBothSides)

    selfsld4QSlider(QtHorizontalself)
    selfsld4setFocusPolicy(QtNoFocus)
    selfsld4setGeometry(60260 200 30)
    selfsld4setMinimum(0)
    selfsld4setMaximum(270)
    selfsld4setTickInterval(50)
    selfsld4setTickPosition(QSliderTicksBothSides)

    selfsld5QSlider(QtHorizontalself)
    selfsld5setFocusPolicy(QtNoFocus)
    selfsld5setGeometry(60330 200 30)
    selfsld5setMinimum(0)
    selfsld5setMaximum(270)
    selfsld5setTickInterval(50)
    selfsld5setTickPosition(QSliderTicksBothSides)

    selfsld6QSlider(QtHorizontalself)
    selfsld6setFocusPolicy(QtNoFocus)
    selfsld6setGeometry(60400 200 30)
    selfsld6setMinimum(0)
    selfsld6setMaximum(270)
    selfsld6setTickInterval(50)
    selfsld6setTickPosition(QSliderTicksBothSides)

    selfsld7QSlider(QtHorizontalself)
    selfsld7setFocusPolicy(QtNoFocus)
    selfsld7setGeometry(39050 200 30)
    selfsld7setMinimum(0)
    selfsld7setMaximum(270)
    selfsld7setTickInterval(50)
    selfsld7setTickPosition(QSliderTicksBothSides)

    selfsld8QSlider(QtHorizontalself)
    selfsld8setFocusPolicy(QtNoFocus)
    selfsld8setGeometry(390120 200 30)
    selfsld8setMinimum(0)
    selfsld8setMaximum(270)
    selfsld8setTickInterval(50)
    selfsld8setTickPosition(QSliderTicksBothSides)

    selfsld9QSlider(QtHorizontalself)
    selfsld9setFocusPolicy(QtNoFocus)
    selfsld9setGeometry(390190 200 30)
    selfsld9setMinimum(0)
    selfsld9setMaximum(270)
    selfsld9setTickInterval(50)
    selfsld9setTickPosition(QSliderTicksBothSides)

    selfsld10QSlider(QtHorizontalself)
    selfsld10setFocusPolicy(QtNoFocus)
    selfsld10setGeometry(390260 200 30)
    selfsld10setMinimum(0)
    selfsld10setMaximum(270)
    selfsld10setTickInterval(50)
    selfsld10setTickPosition(QSliderTicksBothSides)

    selfsld11QSlider(QtHorizontalself)
    selfsld11setFocusPolicy(QtNoFocus)
    selfsld11setGeometry(390330 200 30)
    selfsld11setMinimum(0)
    selfsld11setMaximum(270)
    selfsld11setTickInterval(50)
    selfsld11setTickPosition(QSliderTicksBothSides)

    selfsld12QSlider(QtHorizontalself)
    selfsld12setFocusPolicy(QtNoFocus)
    selfsld12setGeometry(390400 200 30)
    selfsld12setMinimum(0)
    selfsld12setMaximum(270)
    selfsld12setTickInterval(50)
    selfsld12setTickPosition(QSliderTicksBothSides)

    selfsld1valueChangedconnect(selfangle)
    selfsld2valueChangedconnect(selfangle)
    selfsld3valueChangedconnect(selfangle)
    selfsld4valueChangedconnect(selfangle)
    selfsld5valueChangedconnect(selfangle)
    selfsld6valueChangedconnect(selfangle)
    selfsld7valueChangedconnect(selfangle)
    selfsld8valueChangedconnect(selfangle)
    selfsld9valueChangedconnect(selfangle)
    selfsld10valueChangedconnect(selfangle)
    selfsld11valueChangedconnect(selfangle)
    selfsld12valueChangedconnect(selfangle)

    selflcd1QLCDNumber(self)
    selflcd1setDigitCount(3)
    selflcd1setGeometry(270405050)
    selflcd1setSegmentStyle(2)
    selfsld1valueChangedconnect(selflcd1display)

    selflcd2QLCDNumber(self)
    selflcd2setDigitCount(3)
    selflcd2setGeometry(2701105050)
    selflcd2setSegmentStyle(2)
    selfsld2valueChangedconnect(selflcd2display)

    selflcd3QLCDNumber(self)
    selflcd3setDigitCount(3)
    selflcd3setGeometry(2701805050)
    selflcd3setSegmentStyle(2)
    selfsld3valueChangedconnect(selflcd3display)

    selflcd4QLCDNumber(self)
    selflcd4setDigitCount(3)
    selflcd4setGeometry(2702505050)
    selflcd4setSegmentStyle(2)
    selfsld4valueChangedconnect(selflcd4display)

    selflcd5QLCDNumber(self)
    selflcd5setDigitCount(3)
    selflcd5setGeometry(2703205050)
    selflcd5setSegmentStyle(2)
    selfsld5valueChangedconnect(selflcd5display)

    selflcd6QLCDNumber(self)
    selflcd6setDigitCount(3)
    selflcd6setGeometry(2703905050)
    selflcd6setSegmentStyle(2)
    selfsld6valueChangedconnect(selflcd6display)

    selflcd7QLCDNumber(self)
    selflcd7setDigitCount(3)
    selflcd7setGeometry(600405050)
    selflcd7setSegmentStyle(2)
    selfsld7valueChangedconnect(selflcd7display)

    selflcd8QLCDNumber(self)
    selflcd8setDigitCount(3)
    selflcd8setGeometry(6001105050)
    selflcd8setSegmentStyle(2)
    selfsld8valueChangedconnect(selflcd8display)

    selflcd9QLCDNumber(self)
    selflcd9setDigitCount(3)
    selflcd9setGeometry(6001805050)
    selflcd9setSegmentStyle(2)
    selfsld9valueChangedconnect(selflcd9display)

    selflcd10QLCDNumber(self)
    selflcd10setDigitCount(3)
    selflcd10setGeometry(6002505050)
    selflcd10setSegmentStyle(2)
    selfsld10valueChangedconnect(selflcd10display)

    selflcd11QLCDNumber(self)
    selflcd11setDigitCount(3)
    selflcd11setGeometry(6003205050)
    selflcd11setSegmentStyle(2)
    selfsld11valueChangedconnect(selflcd11display)

    selflcd12QLCDNumber(self)
    selflcd12setDigitCount(3)
    selflcd12setGeometry(6003905050)
    selflcd12setSegmentStyle(2)
    selfsld12valueChangedconnect(selflcd12display)


    selfbtn QPushButton('发送角度' self)
    selfbtnmove(1140 50)
    selfbtnclickedconnect(selfshowDialog)

    selfle1 QLineEdit(self)
    selfle1resize(4030)
    selfle1move(70050)
    selfle1setMaxLength(3)
    selfle1setPlaceholderText('000')

    selfle2 QLineEdit(self)
    selfle2resize(4030)
    selfle2move(75050)
    selfle2setMaxLength(3)
    selfle2setPlaceholderText('000')

    selfle3 QLineEdit(self)
    selfle3resize(4030)
    selfle3move(80050)
    selfle3setMaxLength(3)
    selfle3setPlaceholderText('000')

    selfle4 QLineEdit(self)
    selfle4resize(4030)
    selfle4move(85050)
    selfle4setMaxLength(3)
    selfle4setPlaceholderText('000')

    selfle5 QLineEdit(self)
    selfle5resize(4030)
    selfle5move(90050)
    selfle5setMaxLength(3)
    selfle5setPlaceholderText('000')

    selfle6 QLineEdit(self)
    selfle6resize(4030)
    selfle6move(95050)
    selfle6setMaxLength(3)
    selfle6setPlaceholderText('000')

    selfle7 QLineEdit(self)
    selfle7resize(4030)
    selfle7move(100050)
    selfle7setMaxLength(3)
    selfle7setPlaceholderText('000')

    selfle8 QLineEdit(self)
    selfle8resize(4030)
    selfle8move(105050)
    selfle8setMaxLength(3)
    selfle8setPlaceholderText('000')

    selfsetGeometry(4003001250500)
    selfsetWindowTitle('足轮两式机器位机')
    selfshow()

    def btnstate(self)
    global modethread1runing
    senderselfsender()

    def removeBG(frame)
    fgmask bgModelapply(framelearningRate0)
    # kernel cv2getStructuringElement(cv2MORPH_ELLIPSE (3 3))
    # res cv2morphologyEx(fgmask cv2MORPH_OPEN kernel)
    kernel2 npones((3 3) npuint8)
    fgmask cv2erode(fgmask kernel2 iterations1)
    res cv2bitwise_and(frame frame maskfgmask)
    return res

    def _get_eucledian_distance(beg end)
    istr(beg)split('')
    ji[0]split('(')
    x1int(j[1])
    ki[1]split(')')
    y1int(k[0])
    istr(end)split('')
    ji[0]split('(')
    x2int(j[1])
    ki[1]split(')')
    y2int(k[0])
    dmathsqrt((x1x2)*(x1x2)+(y1y2)*(y1y2))
    return d


    def getContours(a)#提取9000轮廓
    vaildContours []
    for cont in a
    if cv2contourArea(cont)>900
    vaildContoursappend(cv2convexHull(cont))
    return vaildContours

    def skin(a)
    ret gray cv2threshold(a 20 255 cv2THRESH_BINARY)
    return gray

    def skinMask(roi)
    YCrCb cv2cvtColor(roi cv2COLOR_BGR2YCR_CB) #转换YCrCb空间
    (ycrcb) cv2split(YCrCb) #拆分出YCrCb值
    cr1 cv2GaussianBlur(cr (55) 0)
    _ skin cv2threshold(cr1 0 255 cv2THRESH_BINARY + cv2THRESH_OTSU) #Ostu处理
    res cv2bitwise_and(roiroi mask skin)
    return res

    def med_smooth(a)
    median cv2medianBlur(a 5)
    return median

    if sendertext()'video'
    width height 300 300 #设置拍摄窗口
    x0y0 300 100 #设置选取位置
    isBgCaptured 0#背景拾取标志位
    vccv2VideoCapture(0)
    oepn frame vcread()#vcread()读取图第帧
    yuan_frameframe
    bgModel cv2createBackgroundSubtractorMOG2(0 50)
    while oepn
    cv2waitKey(200)
    retframe vcread()
    frame_yuantu cv2flip(frame 1)
    hlen(frame_yuantu)
    wlen(frame_yuantu[0])
    frameframe_yuantu[int(0)int(h2)int(w2)int(w)]
    cv2imshow('tu' frame_yuantu)
    cv2imshow('tu1' frame)
    img removeBG(frame)#背景
    cv2imshow('mask' img)
    pic_blurmed_smooth(img)
    picskinMask(pic_blur) #肤色检测
    pic_gray cv2cvtColor(pic cv2COLOR_BGR2GRAY) #转成灰度图
    kernel npones((55)npuint8)
    pic_open cv2morphologyEx(pic_gray cv2MORPH_OPEN kernel) #做开运算先腐蚀膨胀
    pic_gsmh cv2GaussianBlur(pic_open (5 5) 1) #做高斯模糊操作减边缘
    pic_2zskin(pic_gsmh) #阈值操作二极化
    contours hierarchy cv2findContours(pic_2z cv2RETR_EXTERNAL cv2CHAIN_APPROX_NONE)
    ret npones(frameshape npuint8) #做黑布ret显示轮廓
    res1 cv2drawContours(ret contours 1 (0 0 255) 2) #黑布绘制轮廓
    cv2imshow('rsj1'ret)
    length len(contours)#标出轮廓数量
    maxArea 1
    if cv2waitKey(10) & 0xFF 27 #退出键退出
    break
    if length > 0
    for i in range(length)
    temp contours[i]
    area cv2contourArea(temp)
    if area > maxArea
    maxArea area
    ci i
    need_contour contours[ci]#轮廓
    hull cv2convexHull(need_contour) #计算框凸包
    hull_d cv2convexHull(need_contourreturnPoints False) #计算框凸包 返回点值
    defects cv2convexityDefects(need_contourhull_d)
    far1None
    ndefects 0#凸缺陷点数
    if defects is not None
    sys[]
    for i in range(defectsshape[0])
    sef_ defects[i0]
    beg tuple(need_contour[s][0])
    end tuple(need_contour[e][0])
    far tuple(need_contour[f][0])
    a _get_eucledian_distance(beg end)
    b _get_eucledian_distance(beg far)
    c _get_eucledian_distance(end far)
    angle mathacos((b ** 2 + c ** 2 a ** 2) (2 * b * c)) # * 57
    if angle < mathpi2 #90
    ndefects ndefects + 1
    far1far
    cv2line(retbegend[02550]2)#画出凸包
    cv2circle(retfar15[255255255]1)#画出凸缺陷点
    print('手势'+str(ndefects+1))
    if ndefects3and mode3
    thread1 myThread(1 Thread1 1)
    modendefects
    thread1start()
    if ndefects2and mode2
    thread1 myThread(1 Thread1 1)
    modendefects
    thread1start()
    cv2imshow('rsj'ret)#显示处理终处理结果

    vcrelease()
    cv2destroyAllWindows()

    if sendertext()'leg'
    runing1 #足式方式运动
    print(runing1)
    if sendertext()'wheel'
    runing2 #轮式方式运动
    print(runing2)
    if sendertext()'left'
    if mode1
    mode1
    timesleep(05)
    thread1start()
    #timesleep(2)
    if sendertext()'right'
    if mode3
    mode3
    print(mode)
    timesleep(05)
    thread1start()
    print(2)
    if sendertext()' up '
    if mode2
    mode2
    print(mode)
    thread1start()
    if sendertext()'stop'
    thread1 myThread(1 Thread1 1)
    mode0
    if runing2
    thread1start()
    timesleep(05)
    thread1 myThread(1 Thread1 1)
    print(mode)
    #print(a1)

    def angle(self)
    global a1a2a3a4a5a6a7a8a9a10a11a12a13
    a13str(1)
    a1str(selfsld1value())
    a2str(selfsld2value())
    a3str(selfsld3value())
    a4str(selfsld4value())
    a5str(selfsld5value())
    a6str(selfsld6value())
    a7str(selfsld7value())
    a8str(selfsld8value())
    a9str(selfsld5value())
    a10str(selfsld6value())
    a11str(selfsld7value())
    a12str(selfsld8value())
    print(a1)
    if connectionTrue
    print(33)
    msg'aaskskskskskskskskskskskskskk'(a1a2a3a4a5a6a7a8a9a10a11a12a13)
    ssend(msgencode('ascii'))

    def showDialog(self)
    a1selfle1text()
    a2selfle2text()
    a3selfle3text()
    a4selfle4text()
    a5selfle5text()
    a6selfle6text()
    a7selfle7text()
    a8selfle8text()

    msg'aasksksksksksksksk'(a1a2a3a4a5a6a7a8)
    ssend(msgencode('ascii'))
    print(a3)
    print(type(a3))

    def toggleMenu(self state)
    global host
    if state
    selfstatusbarshow()
    selfstatusbarshowMessage('连接IP址19214841')
    host'ssss'(19216841)
    else
    selfstatusbarhide()

    def toggleMenu2(self state)
    global port
    if state
    selfstatusbarshow()
    selfstatusbarshowMessage('连接端口8086')
    port 8086
    print(port)
    else
    selfstatusbarhide()

    def toggleMenu3(self state)
    global sconnection
    s socketsocket(socketAF_INET socketSOCK_STREAM)
    if state
    selfstatusbarshow()
    print(port)
    print(host)
    sconnect((hostport))
    msg'aaaaaaaaaaaaaaaabbfffffsrr'(1)
    ssend(msgencode('ascii'))
    selfstatusbarshowMessage('连接成功')
    connectionTrue
    print(connection)
    else
    selfstatusbarhide()
    connectionFalse
    sclose()


    if __name__ '__main__'
    app QApplication(sysargv)
    appsetWindowIcon(QIcon(Ddatapythonimagesa1ico))
    ex Example()
    sysexit(appexec_())

    ]STM32f103ZET6三时钟分HSI晶振时钟(高速部时钟信号)PLL时钟HSE晶振时钟(高速外部时钟信号)stm32官方推荐高速外部时钟晶振频率4~16MHz(图415)设计stm32系统高速外部时钟连接振荡频率8MHzHSE晶体晶体连接芯片23号引脚(OSC_IN)24号引脚(OSC_OUT)外stm32系统中需配置低速外部时钟源果采外部石英晶体振荡器产生时钟信号提供系统外部低速晶振必须选择频率32768kHzHSE外部晶体时钟部件提供高精确时钟源保证外部输入时钟源准确性外部晶体两端串联陶瓷电容电容选典型值5pF25pF具体选电容值需参考电路中HSE晶体频率设计晶振电路图416


    图 415外部时钟电路图 图416 STM32晶振电路
    46复位电路启动模式
    复位电路系统稳定工作程序进入死循环中通复位电路重启程序STM32f103ZET6集成电复位掉电复位电路(复位参考电路图417)5事件触发系统复位分:
    (1)低功耗理复位
    (2)软件复位(SW复位)
    (3) 独立门狗计数终止(IWDG复位)
    (4)窗口门狗计数终止(WWDG复位)
    (5)NRST引脚出现低电(外部复位)
    复位电路原理图图418
    STM32f103ZET6通BOOT0BOOT1设置三种启动模式图419选择启动模式物理存储区域映射存储块0(启动存储区)户通设置BOOT1BOOT0引脚需启动模式般开发者说芯需第种(Main Flash memory)第三种(Embedded Memory)启动模式第种模式JTAG载程序芯片正常工作第三种启动模式方便调试开发者需修改程序中部分容时果重新载程序会较慢第三种启动模式快速测试程序第二种启动模式stm32出厂时芯片系统存储器预置段BootLoader种启动模式般厂家设置根需载程序前分BOOT0BOOT1置01选择第种模式启动键载电路图420集成电路中通跳线帽调节启动模式

    图417 stm32复位参考电路 图418 stm32 复位电路

    图419 启动模式 图420 键载电路
    47 JTAG调试接口配置
    JTAG连接器载程序边界扫描访问芯片部信号逻辑状态查程序运行情况芯片引脚状态等等STM32标准JTAG连接器连接方式图421实际电路JTAG引脚连接图422示

    图421 JTAG连接器实现 图422 JTAG电路
    48硬件电路确定
    官方参考文档中stm32F103ZET6系统参考硬件电路图423设计硬件电路官方系统参考电路基础进行调整终stm32系统实际原理图电路图424示

    图423 系统参考电路 图424 stm32系统电路
    通原理图绘制集成电路板(图425)集成电路板布线焊接时需注意5问题:
    (1)减少PCB交叉耦合屏蔽效果设计集成电路供电层接导致独立出电路分开
    (2)线电压线路相较粗线应点连接起PCB没器件区域需量覆铜
    (3)晶振需量芯片减少干扰晶振面量走线高电压高电流回路中通常采增加连线宽度办法保证电源稳定
    (4)PCB焊接时模块逐步焊接完成模块焊接时应该测试该模块否正常工作样方便查找障焊接观察焊点否存虚焊等问题
    (5)设计STM32F103ZET6芯片144引脚引脚间距离较焊接时需特心焊接步骤先松香芯片固定焊盘观察引脚否焊盘准焊接时应选含锡量较高锡条焊接完成PCB洗板水固定芯片松香清洗干净次观察引脚否虚焊相邻引脚否连接

    图425 集成电路板












    5总结展
    着第五代通信技5G发展预见未中通5g技术实现时万物互联5G技术直观感受观视频载电影速度提高移动数带宽提高网速提高设想否着数传输速度越越快网络延时忽略计终端设立高性处理器现电脑手机等设备通互联网终端处理器处理种数数带宽提高减少网络延时户感受设备延时反应通种方式设备处理器性求达限度减少
    确定毕业设计题目组型机器市场进行调查发现市场型机器商十分低分析三原第体积问题机器舵机太保证机器力矩满足情况需舵机体积较原导致机器体积法设计更第二操作性强足式机器机械结构限制运动速度够快速会户操作性降低第三型足式机器价格轮式机器高首先足式机器结构需满足机器运动度时足式机器腿部系统需3舵机然机器需设计4腿部结构样导致机器成程度提高外足式机器进行运动时需处理数更需引入算法更加复杂机器控制芯片数处理力求更高芯片需花费成更高第三控制系统复杂相轮式机器足式机器需涉容更首先衡足式机器关节需运动关节需运动时保证机器衡十分重然动作协调足式机器协调运动直研究研究重点相低成足式机器动作协调差低端芯片数处理速度够快会导致机器卡顿
    针芯片处理速度问题选择数处理电脑位机完成方面减少机器端芯片处理数压力方面通位机设计增加户操作体验位机通发送数控制舵机会存问题:组采连续次发送数方式控制机器单舵机旋转60度发送30次数舵机次旋转2度舵机旋转两度间隔中会出现微卡顿
    未定万物互联时代日常中逐渐增机器身影扫机器等等然现足式机器没普相信着技术更新通足轮结合设计机器会逐渐展示出优势







    参考文献
    文档香网(httpswwwxiangdangnet)户传

    《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
    该内容是文档的文本内容,更好的格式请下载文档

    下载文档到电脑,查找使用更方便

    文档的实际排版效果,会与网站的显示效果略有不同!!

    需要 5 香币 [ 分享文档获得香币 ]

    下载文档

    相关文档

    基于ESP8266的四足机器人的设计

    科技文明发展会推动人类社会历史的进步,21世纪是一个“人工智能”的时代,科技产物在发展人工智能满足当下需求外,也为未来的社会发展做出重要的铺垫作用,制造的机器人也被注入了“智能”的元素,使得机器...

    3年前   
    962    0

    基于PLC的温室控制系统的设计

    基于PLC的温室控制系统的设计摘 要随着人们生活水平的提高,由温室大棚种植的反季节蔬菜成为人们越来越离不开的食物,所以温室大棚技术越来越重要,而温度控制是最为重要的一环。考虑到PLC具有灵活...

    3年前   
    833    0

    基于PID的温度控制系统设计论文

     (20XX届) 毕业设计 题  目:   基于PID的温度控制系统设计  学  院:             专  业:     电气工程及其自动...

    5年前   
    2002    0

    基于视觉传感器的自主扫雷机器人设计与实现

    摘要:在当今的世界安全形势下,扫雷小车的出现可以减少各国人员在扫雷过程中的人员伤亡,扫雷小车实用性能强更适合在军事化领域或者是民用领域上应用。让它具有光明的发展前景。针对这一情况,本毕业设计就对...

    4年前   
    1141    0

    基于STM32的六足仿生机器人设计

     基于STM32的六足仿生机器人设计——机械结构设计 基于STM32的六足仿生机器人设计——机械结构设计摘 要在各种地形方面,相较于履带式移...

    2年前   
    632    0

    基于Multisim的声光控路灯控制系统设计与仿真课程设计

    信息工程学院课程设计报告书题目: 基于Multisim的声光控路灯控制系统设计与仿真 课 程:电子线路课程设计 专 业:电气工程及其自动化班 级: ...

    1年前   
    367    0

    毕业设计(论文)基于PLC的停车场车位控制系统设计

    基于PLC的停车场车位控制 系统设计 系 别:机电与自动化学院 专 业 班:电气工程及其自动化xx班 姓 名: 学 号:20xx113xx 指导教师: 201x年6月 基于...

    5年前   
    3091    0

    基于单片机的空调温度控制系统设计毕业设计

     毕业设计  题 目 基于单片机的空调温度控制系统设计 学生姓名 学 号 学 院 计算机与信息工程系 专业班级 指导...

    5年前   
    2576    0

    基于PLC的造纸机控制系统设计毕业设计

    X职业技术学院毕 业 设 计 (论 文) 题目名称: 姓 名: ...

    4年前   
    1080    0

    基于PLC的组合机床电气控制系统设计毕业设计

    基于PLC的组合机床电气控制系统设计摘 要应用组合机床加工大批量零件,快捷高效,生产效率高是机械加工的发展方向。本次设计任务是制定三面铣组合机床用来对Z512W型台式钻床主轴箱的Ф80、Ф90...

    5个月前   
    182    0

    基于FPGA的电梯控制系统设计毕业设计论文

    毕 业 设 计 [论 文]题 目: 基于FPGA的电梯控制系统设计 学 院: 电气与信息工程学院 ...

    3年前   
    1277    0

    毕业设计论文基于PLC的停车场车位控制系统设计

    基于PLC的停车场车位控制系统设计系 别:机电与自动化学院专 业 班:电气工程及其自动化班姓 名: 学 号:指导教师: 2011年X月基于PLC的停车场车位控制系统设计Des...

    6个月前   
    296    0

    多功能智能轮椅设计-运动控制系统的设计与实现

     多功能智能轮椅设计—运动控制系统的设计与实现多功能智能轮椅设计-运动控制系统的设计与实现摘 要在现如今智能化高速发展的时代,智能、科技已然成为时代的主题之一,智能产品也被越来越多运用到各行...

    3年前   
    624    0

    基于PID控制算法的热水器智能控制系统设计

    基于PID控制算法的热水器智能控制系统设计——语音识别系统设计基于PID控制算法的热水器智能控制系统设计——语音识别系统设计摘 要伴随着物联网、大数据、人工智能的发展,对于语音识别有了更高要...

    2年前   
    570    0

    激光器电源温度控制系统硬件设计

    随着激光加工技术的发展,激光器也在不断向前发展,激光器已成为现代激光加工系统中必不可少的核心部分之一。激光器的正常运行需要有稳定的电源供应,即激光器电源,激光器电源系统是一种受控供电系统,决定着...

    3年前   
    617    0

    水平多关节型工业机器人设计—机身与大臂结构及控制系统设计

    水平多关节工业机器人用于许多工业领域的机械自动化操作,例如自动装配,搬运和电镀。工业机器人由机器人臂,单片机,伺服控制器和检测单元组成。 适用于各种类型和批次的柔性制造生产。

    3年前   
    805    0

    基于stm32的两轮自平衡车控制系统设计

    基于STM32的两轮自平衡车控制系统设计 Control system design of two wheel se...

    2年前   
    901    0

    基于51单片机的红外线遥控智能台灯设计-智能台灯的控制系统电路设计

    随着社会的发展,智能产品也随着变化,电子产品快速发展,我们家用电器智能化越来越多,常见的智能家居如电饭煲,电磁炉,台灯等主要系统都具有一个共同的特点,那就是利用单片机控制系统作为本次的核心系统,...

    3年前   
    969    0

    基于PLC控制电机变频调速试验系统的硬件设计

    费和节约能源;由于其高速度、高精度、高功率因数,可以提高产品的质量,生产能力,和同时降低材料和设备的消耗,也能减少机械磨损和噪音,改善车间的工作环境,满足生产工艺要求。

    3年前   
    592    0

    多功能轮椅的研究-控制系统及框架结构设计

    本文先对多功能智能轮椅的研究背景、目的、意义、国内外的现状作了阐述,然后总结了本论文主要解决的核心问题和关键技术。根据多功能智能轮椅的主要功能要求,本论文分别对轮椅的机械结构和控制系统进行了研究和设计。

    3年前   
    939    0

    文档贡献者

    爱***享

    贡献于2021-09-06

    下载需要 5 香币 [香币充值 ]
    亲,您也可以通过 分享原创文档 来获得香币奖励!
    下载文档

    该用户的其他文档