四足机器人步态仿真(三)四足机器人基础步态仿真

观前提醒,本章主要内容为分析四足机器人步态实现和姿态控制,碰撞体积等程序
步态效果:

一、完整代码如下 

# -*- coding: utf-8 -*-import pybullet as pimport timeimport numpy as npp.connect(p.GUI)p.createCollisionShape(p.GEOM_PLANE)p.createMultiBody(0,0)#Dog robot part shapessh_body = p.createCollisionShape(p.GEOM_BOX,halfExtents=[0.45, 0.08, 0.02])sh_extraweight = p.createCollisionShape(p.GEOM_BOX,halfExtents=[0.45, 0.08, 0.025])sh_roll = p.createCollisionShape(p.GEOM_BOX,halfExtents=[0.02, 0.02, 0.02])sh_hip = p.createCollisionShape(p.GEOM_BOX,halfExtents=[0.02, 0.02, 0.02])sh_knee = p.createCollisionShape(p.GEOM_BOX,halfExtents=[0.02, 0.02, 0.02])sh_foot = p.createCollisionShape(p.GEOM_SPHERE,radius=0.04)#The Dog robot is the body with other shapes linked to itbody_Mass = 1visualShapeId = -1link_Masses=[.1, .1, .1, .1,             .1, .1, .1, .1,             .1, .1, .1, .1,             .1, .1, .1, .1,             20]linkCollisionShapeIndices=[sh_roll, sh_hip, sh_knee, sh_foot,                           sh_roll, sh_hip, sh_knee, sh_foot,                           sh_roll, sh_hip, sh_knee, sh_foot,                           sh_roll, sh_hip, sh_knee, sh_foot,                           sh_extraweight]nlnk=len(link_Masses)linkVisualShapeIndices=[-1]*nlnk    #=[-1,-1,-1, ... , -1]#link positions wrt the link they are attached toxhipf=0.4xhipb=-0.4yhipl=0.1xoffh=0.05yoffh=0.05hu=0.3hl=0.3linkPositions=[[xhipf, yhipl, 0], [xoffh, yoffh, 0], [0, 0, -hu], [0, 0, -hl],               [xhipf, -yhipl, 0], [xoffh, -yoffh, 0], [0, 0, -hu], [0, 0, -hl],               [xhipb, yhipl, 0], [xoffh, yoffh, 0], [0, 0, -hu], [0, 0, -hl],               [xhipb, -yhipl, 0], [xoffh, -yoffh, 0], [0, 0, -hu], [0, 0, -hl],               [0,0,+0.029]]linkOrientations=[[0,0,0,1]]*nlnklinkInertialFramePositions=[[0,0,0]]*nlnk#Note the orientations are given in quaternions (4 params). There are function to convert of Euler angles and backlinkInertialFrameOrientations=[[0,0,0,1]]*nlnk#indices determine for each link which other link it is attached to# for example 3rd index = 2 means that the front left knee jjoint is attached to the front left hipindices=[0, 1, 2, 3,         0, 5, 6, 7,         0, 9,10,11,         0,13,14,15,         0]#Most joint are revolving. The prismatic joints are kept fixed for nowjointTypes=[p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_PRISMATIC,            p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_PRISMATIC,            p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_PRISMATIC,            p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_PRISMATIC,            p.JOINT_PRISMATIC]#revolution axis for each revolving jointaxis=[[1,0,0], [0,1,0], [0,1,0], [0,0,1],      [1,0,0], [0,1,0], [0,1,0], [0,0,1],      [1,0,0], [0,1,0], [0,1,0], [0,0,1],      [1,0,0], [0,1,0], [0,1,0], [0,0,1],      [0,0,1]]#Drop the body in the scene at the following body coordinatesbasePosition = [0,0,1]baseOrientation = [0,0,0,1]#Main function that creates the dogdog = p.createMultiBody(body_Mass,sh_body,visualShapeId,basePosition,baseOrientation,                        linkMasses=link_Masses,                        linkCollisionShapeIndices=linkCollisionShapeIndices,                        linkVisualShapeIndices=linkVisualShapeIndices,                        linkPositions=linkPositions,                        linkOrientations=linkOrientations,                        linkInertialFramePositions=linkInertialFramePositions,                        linkInertialFrameOrientations=linkInertialFrameOrientations,                        linkParentIndices=indices,                        linkJointTypes=jointTypes,                        linkJointAxis=axis)            #Due to the weight the prismatic extraweight block needs to be motored upjoint=16p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=0.01,force=1000,maxVelocity=3)#Same for the prismatic feet spheresjoint=3p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=0.0,force=1000,maxVelocity=3)joint=7p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=0.0,force=1000,maxVelocity=3)joint=11p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=0.0,force=1000,maxVelocity=3)joint=15p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=0.0,force=1000,maxVelocity=3)#Add earth like gravityp.setGravity(0,0,-9.81)p.setRealTimeSimulation(1)#Point the camera at the robot at the desired angle and distancep.resetDebugVisualizerCamera( cameraDistance=1.5, cameraYaw=-30, cameraPitch=-30, cameraTargetPosition=[0.0, 0.0, 0.25])if (0):    t0=time.time()    t=time.time()    while ((t-t0)<10):        t=time.time()    p.disconnect()    brake#Scenery e.g. an inclined boxboxHalfLength = 2.5boxHalfWidth = 2.5boxHalfHeight = 0.2sh_colBox = p.createCollisionShape(p.GEOM_BOX,halfExtents=[boxHalfLength,boxHalfWidth,boxHalfHeight])mass = 1block=p.createMultiBody(baseMass=0,baseCollisionShapeIndex = sh_colBox,                        basePosition = [-2,0,-0.1],baseOrientation=[0.0,0.1,0.0,1])#Add extra lateral friction to the feet spheresp.changeDynamics(dog,3,lateralFriction=2)p.changeDynamics(dog,7,lateralFriction=2)p.changeDynamics(dog,11,lateralFriction=2)p.changeDynamics(dog,15,lateralFriction=2)#Function to calculate roll, hip and knee angles from the x,y,z coords of the foot wrt the hip.def xyztoang(x,y,z,yoffh,hu,hl):    dyz=np.sqrt(y**2+z**2)    lyz=np.sqrt(dyz**2-yoffh**2)    gamma_yz=-np.arctan(y/z)    gamma_h_offset=-np.arctan(-yoffh/lyz)    gamma=gamma_yz-gamma_h_offset    lxzp=np.sqrt(lyz**2+x**2)    n=(lxzp**2-hl**2-hu**2)/(2*hu)    beta=-np.arccos(n/hl)    alfa_xzp=-np.arctan(x/lyz)    alfa_off=np.arccos((hu+n)/lxzp)    alfa=alfa_xzp+alfa_off    if any( np.isnan([gamma,alfa,beta])):        print(x,y,z,yoffh,hu,hl)    return [gamma,alfa,beta]def setlegsxyz(xvec,yvec,zvec,vvec):    #[a1,a2]=xztoang(xvec[0],zvec[0],1,1)    a=xyztoang(xvec[0]-xhipf,yvec[0]-yhipl,zvec[0],yoffh,hu,hl)  #(x,y,z,yoffh,hu,hl)    spd=1    #any(np.isnan(a))    joint=0    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[0],force=1000,maxVelocity=spd)    joint=1    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[1],force=1000,maxVelocity=vvec[0])    joint=2    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[2],force=1000,maxVelocity=vvec[0])    a=xyztoang(xvec[1]-xhipf,yvec[1]+yhipl,zvec[1],-yoffh,hu,hl)  #(x,y,z,yoffh,hu,hl)    spd=1.0    joint=4    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[0],force=1000,maxVelocity=spd)    joint=5    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[1],force=1000,maxVelocity=vvec[1])    joint=6    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[2],force=1000,maxVelocity=vvec[1])    a=xyztoang(xvec[2]-xhipb,yvec[2]-yhipl,zvec[2],yoffh,hu,hl)  #(x,y,z,yoffh,hu,hl)    spd=1.0    joint=8    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[0],force=1000,maxVelocity=spd)    joint=9    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[1],force=1000,maxVelocity=vvec[2])    joint=10    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[2],force=1000,maxVelocity=vvec[2])    a=xyztoang(xvec[3]-xhipb,yvec[3]+yhipl,zvec[3],-yoffh,hu,hl)  #(x,y,z,yoffh,hu,hl)    spd=1.0    joint=12    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[0],force=1000,maxVelocity=spd)    joint=13    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[1],force=1000,maxVelocity=vvec[3])    joint=14    p.setJointMotorControl2(dog,joint,p.POSITION_CONTROL,targetPosition=a[2],force=1000,maxVelocity=vvec[3])#Pre-init robot positionsetlegsxyz([xhipf,xhipf,xhipb,xhipb],[yhipl+0.1,-yhipl-0.1,yhipl+0.1,-yhipl-0.1],[-0.5,-0.5,-0.5,-0.5],[1,1,1,1])t0=time.time()t=time.time()while ((t-t0)<4):    t=time.time()#Rotation matrix for yaw only between robot-frame and world-framedef RotYawr(yawr):    Rhor=np.array([[np.cos(yawr),-np.sin(yawr),0], [np.sin(yawr),np.cos(yawr),0], [0,0,1]])    return Rhor#Init robot position, orientation and pose params# O means in world-centered coordinates# R means in robot-centered coordinates# r is for "of the robot"# i is initialyawri=1.3xrOi=np.array([1,1,0.5])legsRi=np.array([[xhipf,xhipf,xhipb,xhipb],               [yhipl+0.1,-yhipl-0.1,yhipl+0.1,-yhipl-0.1],               [-0.5,-0.5,-0.5,-0.5]])#Set body to the robot posxbOi=xrOi#Init body position and orientationquat=p.getQuaternionFromEuler([0,0,yawri])p.resetBasePositionAndOrientation(dog,xbOi,quat)#Init leg abs posRyawri=RotYawr(yawri)legsO=(np.dot(Ryawri,legsRi).T + xbOi).T   #Apply rotation plus translation#Set the non-initial variables and matrixyawr=yawrixrO=xrOixbO=xrORyawr=RotYawr(yawri)#Recalc leg rel pos in robot frame and set the legsdlegsO=(legsO.T-xbO).TdlegsR=np.dot(Ryawr.T,dlegsO)setlegsxyz(dlegsR[0],dlegsR[1],dlegsR[2],[1,1,1,1])#Calculate a new robot center position from the average of the feet positions#Calculate a new robot yaw ditrection also from the feet positionsxfO=(legsO[:,0]+legsO[:,1])/2.0xbO=(legsO[:,2]+legsO[:,3])/2.0xrOn=(xfO+xbO)/2.0 + np.array([0,0,0.5])xfmbO=xfO-xbOyawrn=np.arctan2(xfmbO[1],xfmbO[0])#Camera paramers to be able to yaw pitch and zoom the camera (Focus remains on the robot) cyaw=10cpitch=-15cdist=1.5#Walking speed (changes the walking loop time)walkLoopSpd=400#Change general motor speedvvec=[12]*4#Current leg to change positionl=0#Init the center for the robot rotation to the current robot posxrcO=xrO#Set the body position to the robot positionxoff=0yoff=0#Init to walking fwddr=0drp=0#Leg sequence (for rotating the robot, I chose to chg legs in the order front-left, fr, br, bl)lseq=[0,1,3,2]lseqp=[0,1,3,2]#lseq=[2,0,3,1]#lseqp=[2,0,3,1]while (1):    cubePos, cubeOrn = p.getBasePositionAndOrientation(dog)    p.resetDebugVisualizerCamera( cameraDistance=cdist, cameraYaw=cyaw, cameraPitch=cpitch, cameraTargetPosition=cubePos)    keys = p.getKeyboardEvents()    #Keys to change camera    if keys.get(100):  #D        cyaw+=1    if keys.get(97):   #A        cyaw-=1    if keys.get(99):   #C        cpitch+=1    if keys.get(102):  #F        cpitch-=1    if keys.get(122):  #Z        cdist+=.01    if keys.get(120):  #X        cdist-=.01    #Keys to change the robot walk (fwd, bkw, rot right, rot left)    if keys.get(65297): #Up        drp=0    if keys.get(65298): #Down        drp=2    if keys.get(65296): #Right        drp=1        xrcO=xrO        #Set the center for the robot rotation to the current robot pos        lseqp=[1,0,2,3] #Change the leg sequence to open up the front arms rather than close them    if keys.get(65295): #Left        drp=3        xrcO=xrO        lseqp=[0,1,3,2] #Change the leg sequence to open up the front arms rather than close them    #Time cycle    tv=int(((time.time()-t0)*walkLoopSpd)  % 800)    #One leg movement in 200 units. one 4-leg walk cycle in 800 units    #Using <, >, % (modulo) and divide we can easily do something in a specific part of the cycle    #Apply new walking cycle type (e.g. chg from fwd to bkw) only at the start of next cycle    if tv<20 and (not dr==drp):        dr=drp        lseq=lseqp    #Index of the leg to move    l=int(tv/200)    #Actual leg to move    k=lseq[l]    #In the beginning of the leg cycle the body is centered at the robot center    #then it gradually moves in the opposite direction of the leg to be moved     #to ensure the center of gravity remains on the other 3 legs    #when the moving leg goes down again the body center returns to the robot center    #The vars xoff and yoff move the body w.r.t. the robot center in the robot frame    if int(tv%200)<10:        xoff=0        yoff=0    elif int(tv%200)<80:        xoff+=0.002*(-1+2*int(k/2))  #Work it out on paper to see it moves opposite to the stepping leg        yoff+=0.002*(-1+2*(k%2))         elif int(tv%200)>160:        xoff-=0.004*(-1+2*int(k/2))        yoff-=0.004*(-1+2*(k%2))         #Recalc leg rel pos in desired robot frame    dlegsO=(legsO.T-xrO).T  #Translate    dlegsR=np.dot(Ryawr.T,dlegsO)  #Rotate (Note the inverse rotation is the transposed matrix)    #Then apply the body movement and set the legs    setlegsxyz(dlegsR[0]-xoff-0.03,dlegsR[1]-yoff,dlegsR[2],vvec)  #0.03 is for tweaking the center of grav.    if int(tv%200)>80:        dlegsO=(legsO.T-xrcO).T        yawlO=np.arctan2(dlegsO[1,k],dlegsO[0,k])        rlO=np.sqrt(dlegsO[0,k]**2+dlegsO[1,k]**2)        if dr==0:            legsO[0,k]=rlO*np.cos(yawlO)+xrcO[0]+0.01*np.cos(yawr)            legsO[1,k]=rlO*np.sin(yawlO)+xrcO[1]+0.01*np.sin(yawr)        elif dr==1:            yawlO-=0.015             legsO[0,k]=rlO*np.cos(yawlO)+xrcO[0]            legsO[1,k]=rlO*np.sin(yawlO)+xrcO[1]        elif dr==2:            legsO[0,k]=rlO*np.cos(yawlO)+xrcO[0]-0.01*np.cos(yawr)            legsO[1,k]=rlO*np.sin(yawlO)+xrcO[1]-0.01*np.sin(yawr)        elif dr==3:            yawlO+=0.015             legsO[0,k]=rlO*np.cos(yawlO)+xrcO[0]            legsO[1,k]=rlO*np.sin(yawlO)+xrcO[1]        if int(tv%200)<150:            #Move leg k upwards             legsO[2,k]+=.006        else:            #Move leg k wards             legsO[2,k]-=.006    else:        #Move/keep all legs down to the ground        legsO[2,0]=0.0        legsO[2,1]=0.0        legsO[2,2]=0.0        legsO[2,3]=0.0    #Calculate vectors and matrix for the next loop    xfrO=(legsO[:,0]+legsO[:,1])/2.0    xbkO=(legsO[:,2]+legsO[:,3])/2.0    xrO=(xfrO+xbkO)/2.0     xrO[2]=0.5    xfmbO=xfrO-xbkO    yawr=np.arctan2(xfmbO[1],xfmbO[0])    Ryawr=RotYawr(yawr)    time.sleep(0.01)p.disconnect()

运行上述代码,我们可以看到四足机器人的形态、碰撞体积、基础步态
另外此程序还在场景中仿真了一个斜坡用于测试

 点击四足机器人步态仿真(三)四足机器人基础步态仿真 - 古月居 可查看全文

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/21178.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

xLSTM: Extended Long Short-Term Memory

更多内容,请关注微信公众号:NLP分享汇 原文链接:xLSTM: Extended Long Short-Term Memory 论文链接:https://arxiv.org/pdf/2405.04517 为什么要在27年后提出新的LSTM呢? LSTM(长短期记忆网络&#xff09…

Java 生成二维码底下带content

直接上代码&#xff1a;效果如下图 需引入 zxing生成二维码包 <dependency><groupId>com.google.zxing</groupId><artifactId>core</artifactId><version>3.3.3</version></dependency><dependency><groupId>com.…

vue不同页面切换的方式(Vue动态组件)

v-if实现 <!--Calender.vue--> <template><a-calendar v-model:value"value" panelChange"onPanelChange" /></template> <script setup> import { ref } from vue; const value ref(); const onPanelChange (value, mod…

【Matplotlib作图-3.Ranking】50 Matplotlib Visualizations, Python实现,源码可复现

目录 03 Ranking 3.0 Prerequisite 3.1 有序条形图(Ordered Bar Chart) 3.2 棒棒糖图(Lollipop Chart) 3.3 点图(Dot Plot) 3.4 斜率图(Slope Chart) 3.5 杠铃图(Dumbbell Plot) References 03 Ranking 3.0 Prerequisite Setup.py # !pip install brewer2mpl import n…

FJSP:波搜索算法(WSA)求解柔性作业车间调度问题(FJSP),提供MATLAB代码

详细介绍 FJSP&#xff1a;波搜索算法(Wave Search Algorithm, WSA)求解柔性作业车间调度问题&#xff08;FJSP&#xff09;&#xff0c;提供MATLAB代码-CSDN博客 完整MATLAB代码 FJSP&#xff1a;波搜索算法(WSA)求解柔性作业车间调度问题&#xff08;FJSP&#xff09;&…

coredns 被误删了,可以通过重新应用 coredns 的 Deployment 或 DaemonSet 配置文件来恢复

如果 coredns 被误删了&#xff0c;可以通过重新应用 coredns 的 Deployment 或 DaemonSet 配置文件来恢复。以下是恢复 coredns 的步骤&#xff1a; 1. 下载 coredns 配置文件 你可以从 Kubernetes 的官方 GitHub 仓库下载 coredns 的配置文件。以下是下载并应用配置文件的步…

快速排序(排序中篇)

1.快速排序的概念及实现 2.快速排序的时间复杂度 3.优化快速排序 4.关于快速排序的细节 5.总代码 1.快速排序的概念及实现 1.1快速排序的概念 快速排序的单趟是选一个基准值&#xff0c;然后遍历数组的内容把比基准值大的放右边&#xff0c;比基准值小的放在左边&#xf…

一本企业画册怎么制作成二维码分享

​在这个数字化时代&#xff0c;二维码已经成为一种便捷的分享方式。企业画册&#xff0c;作为展示企业形象、宣传产品和服务的重要工具&#xff0c;也可以通过二维码进行分享。现在我来教你如何将一本企业画册制作成二维码分享。 1. 准备好制作工具&#xff1a;FLBOOK在线制作…

Springboot校园食堂智能排餐系统-计算机毕业设计源码85935

摘 要 信息化社会内需要与之针对性的信息获取途径&#xff0c;但是途径的扩展基本上为人们所努力的方向&#xff0c;由于站在的角度存在偏差&#xff0c;人们经常能够获得不同类型信息&#xff0c;这也是技术最为难以攻克的课题。针对校园食堂智能排餐系统等问题&#xff0c;对…

ubuntu--Linux使用

Linux使用 Linux 系统简介 linux Linux 就是一个操作系统&#xff0c;与 Windows 和 Mac OS 一样是操作系统 。 操作系统在整个计算机系统中的角色 : Linux 主要是 系统调用 和 内核 那两层。使用的操作系统还包含一些在其上运行的应用程序&#xff0c;比如vim、google、vs…

Golang | Leetcode Golang题解之第123题买卖股票的最佳时机III

题目&#xff1a; 题解&#xff1a; func maxProfit(prices []int) int {buy1, sell1 : -prices[0], 0buy2, sell2 : -prices[0], 0for i : 1; i < len(prices); i {buy1 max(buy1, -prices[i])sell1 max(sell1, buy1prices[i])buy2 max(buy2, sell1-prices[i])sell2 m…

C++的List

List的使用 构造 与vector的区别 与vector的区别在于不支持 [ ] 由于链表的物理结构不连续,所以只能用迭代器访问 vector可以排序,list不能排序(因为快排的底层需要随机迭代器,而链表是双向迭代器) (算法库里的排序不支持)(需要单独的排序) list存在vector不支持的功能 链…

网站建设方案书

网站建设方案书是指一份书面计划&#xff0c;用于描述关于建立和运营一个网站所需的资源和步骤。这份方案书的目的是确保网站建设过程中的顺利和成功&#xff0c;并最终获得对其所期望的效果。 在撰写方案书时&#xff0c;我们应该遵循以下几个步骤&#xff1a; 一、确定网站的…

[SWPUCTF 2023 秋季新生赛]Junk Code

方法一&#xff1a;手动去除 将所有E9修改为90即可 方法二&#xff1a;花指令去除脚本 start_addr 0x0000000140001454 end_addr 0x00000001400015C7 print(start_addr) print(end_addr) for i in range(start_addr,end_addr):if get_wide_byte(i) 0xE9:patch_byte(i,0x9…

自定义类型:结构体类型

在学习完指针相关的知识后将进入到c语言中又一大重点——自定义类型&#xff0c;在之前学习操作符以及指针时我们对自定义类型中的结构体类型有了初步的了解&#xff0c;学习了结构体类型的创建以及如何创建结构体变量&#xff0c;还有结构体成员操作符的使用&#xff0c;现在我…

win+mac通用的SpringBoot+H2数据库集成过程。

有小部分大学的小部分老师多毛病&#xff0c;喜欢用些晦涩难搞的数据库来折腾学生&#xff0c;我不理解&#xff0c;但大受震撼。按我的理解&#xff0c;这种数据库看着好像本地快速测试代码很舒服&#xff0c;但依赖和数据库限制的很死板&#xff0c;对不上就是用不了&#xf…

Linux基础之进程等待

目录 一、进程等待的基本概念 二、进程等待的重要性 三、进程等待的方法 四、获取子进程status 五、options选项 一、进程等待的基本概念 进程等待是指一个进程在执行过程中暂时停止&#xff0c;并等待某个条件满足后再继续执行的状态。这种等待通常是由于某些事件需要发生…

qt按钮的autoRepeat属性和default属性

autoRepeat属性&#xff1a;按住按钮不松&#xff0c;表示一直在点击按钮 default属性&#xff1a;点击Enter键表示在点击按钮

无缝接入GPT-4o:智创聚合API平台的创新与实践

在2024年5月13日&#xff0c;美国开放人工智能研究中心&#xff08;OpenAI&#xff09;发布了最新版本的ChatGPT——GPT-4o。这一更新标志着人工智能领域的又一重大进步&#xff0c;引起了全球科技界的广泛关注。GPT-4o的“o”代表“omni”&#xff08;全能&#xff09;&#x…

动态规划算法:背包问题

背包问题概述 背包问题 (Knapsack problem) 是⼀种组合优化的 NP完全问题 。 问题可以描述为&#xff1a;给定⼀组物品&#xff0c;每种物品都有⾃⼰的重量和价格&#xff0c;在限定的总重量内&#xff0c;我们如何选择&#xff0c;才能使得物品的总价格最⾼。 根据物品的个…