0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

使用ChatGPT学习大象机器人六轴协作机械臂mechArm!

大象机器人科技 来源:大象机器人科技 作者:大象机器人科技 2024-01-31 14:39 次阅读

引言
我是一名机器人方向的大学生,近期学校安排自主做一个机器人方面相关的项目。学校给我们提供了一个小型的六轴机械臂,mechArm 270M5Stack,我打算使用ChatGPT让它来辅助我学习如何使用这个机械臂并且做一个demo。

本篇文章将记录我是如何使用ChatGPT来学习机械臂的使用。

ChatGPT
ChatGPT 是由 OpenAI 开发的一个先进的人工智能对话系统。它基于大规模语言模型 GPT(Generative Pretrained Transformer)技术,能够理解和生成自然语言文本。ChatGPT 能够进行多种交互,包括回答问题、提供解释、撰写文本、编程协助等。它的设计目的是为了模拟人类在特定领域或对话中的表现,从而提供高质量的、类人的交流体验。

ChatGPT 如何帮助学习新知识:

个性化教学:根据用户的问题和回答,ChatGPT 能够个性化地提供信息,使学习过程更加符合用户的需求和水平。
理论与实例结合:ChatGPT 不仅能提供理论知识,还能结合实际案例来解释复杂概念,帮助用户更好地理解和记忆。
步骤指导:对于复杂任务或问题,ChatGPT 可以提供分步骤的指导和建议,帮助用户逐渐掌握技能。
资源推荐:ChatGPT 还能推荐书籍、在线课程、文章等资源,帮助用户深入学习。
学习的过程Process
首先我得赋予他一个身份,一个角色,这样的话它的回答才能不会特别的偏离我们的主题。

me: You are now a senior teacher in robotics. I will ask you some questions to help me learn a robotic arm. ChatGPT: That sounds great! I'm here to help with your questions about robotic arms. Whether it's about their design, operation, programming, or applications, feel free to ask. Let's get started!

在此之间我已经对机器人相关的知识有所了解了,直接让它给我调查我现在这款机械臂是什么该如何使用。然后它就提供了一些机械臂的参数,以及编程环境等等

me: Do you know the mechArm 270 MechArm, a product of Elephant Robotics? My instructor gave us one to use for a case study. I wanted to know the basic information about this robotic arm first. ChatGPT: ... Specifications: Payload Capacity: Up to 250 grams. Reach: 270mm. Degrees of Freedom (DoF): 6, via 6 magnetic encoder motors. Movement Speed: Up to 120°/s. Positioning Accuracy: ±1 mm. Controller: Raspberry Pi 4 Model B, featuring quad-core Cortex-A72 processor, dual-band WiFi 5, and Bluetooth 5.0 connectivity. Supported Cameras: Official Raspberry Pi cameras or third-party USB cameras. USB Ports: 2 USB 3.0 ports, 2 USB 2.0 ports. Power Input: 8-12V/5A DC jack. Weight: Approximately 1 kilogram. Expansion Options: 40-pin GPIO header ...

mechArm 270
经过较详细的汇总,我就得知这是一款桌面型的机械臂,工作半径270mm,能够支持多平台的编译,比较全面的是python编程语言,还附带一个丰富的API控制库方便用户们的使用。

有40个GPIO接口,比较适合做一一些非常小型的自动化任务,也可以做教育环境和研究等应用。

wKgaomW55ziABcGVAAKtvbJgV1Q703.png

环境安装
基于他对于Python支持的比较多,所以我决定用python来进行这个机械臂的学习。

操作系统:window11 编程语言: python3.9+ 主要使用的功能库:pymycobot


pymycobot的使用
ChatGPT介绍了一个基本的使用,从安装到使用都有。

安装库

pip install pymycobot

基础使用

导入使用的库

#import library

from pymycobot.mycobot import MyCobot

初始化机械臂,建立连接

#Initialize the Robot Arm

```

Connect the mechArm to your computer.

Initialize the robotic arm by specifying the port it's connected to and the baud rate

```

mc = MyCobot('com3',115200)

基础命令

Move the Arm: Use methods like send_angles to control the arm's position. For example, to move the arm to a specific angle:

mc.send_angles([0, 0, 0, 0, 0, 0], 100) # Angles for each joint, Speed

Get Current Position: To read the current position of the arm:

angles = mc.get_angles()

print(angles)

Control the Gripper: To open or close the gripper:

mc.set_gripper_state(1, 50) # 1 for open, 0 for close, Speed

以上是ChatGPT给我提供的一些使用的基础方法,我来尝试一下按照他的步骤来进行控制机械臂。

wKgaomW56EqAdmjXAADTAzGgNgU081.png

wKgaomW56ECALPkWABotXluqtEE982.png

然后我自己尝试了使用代码控制机械臂做一个循环动作。

import time from pymycobot.mycobot import MyCobot #Initialize the Robot Arm mc = MyCobot('com13',115200) time.sleep(3) for count in range(3): mc.send_angles([57.21,(-2.1),19.33,(-81.29),(-73.65),(-1.14)],80) time.sleep(1) mc.send_angles([(-9.05),(-1.93),9.05,2.63,(-2.28),(-0.26)],80) time.sleep(1) mc.send_angles([5.36,(-41.57),(-17.31),11.07,(-55.54),(-1.49)],80) time.sleep(1)

wKgZomW56NCAX62yAFfNPIPoiIs541.png

这是一些角度控制机械臂运动,单独控制角度的话我觉得只能做一些固定的动作,对于一些应用场景应该不是特别的实用。于是我问,还有什么其他的控制方法能够适用于物体抓图的运动。

chat

me: Controlling the movement of the angle is only applicable to some special points and postures. For some object grabbing scenes, these unfixed points should not be used. Is there any other method of control? Chatgpt: Absolutely, for scenarios where controlling the robotic arm based on specific angles isn't practical, especially in object grabbing and manipulation tasks, there are alternative control methods that can be more effective: 1. Cartesian (Coordinate) Control: Description: This method involves controlling the robotic arm by specifying the position of the end effector in Cartesian coordinates (X, Y, Z), along with orientation (roll, pitch, yaw). Usage: In Python, using the pymycobot library, you can command the robotic arm to move to a specific Cartesian coordinate. The command might look like:

让我来尝试send_coords()这个方法是怎么运转的,下面是我写的代码在机械臂的末端位置上作出运动。

class MechArm: def __init__(self,port): #初始化链接 self.mc = MyCobot(port, 115200) self.coords = [116.4, -0.1, 178.4, -179.68, 6.5, -179.43] self.speed = 40 self.mode = 0 def increment_x_and_send(self, increment=20): # 增加x值并发送新坐标 self.coords[0] += increment self.mc.send_coords(self.coords, self.speed, self.mode) def increment_y_send(self,increment=20): self.coords[1] += increment self.mc.send_coords(self.coords,self.speed, self.mode)

wKgZomW56aCALtq6ABLJn6MQDyk311.png

我发现在控制机械臂的时候,有些指令会被吞掉,导致机械臂没有办法运动。解决的办法就是需要添加一个等待时间,等待的时间需要大于机械臂运动的时间才能够保证运动完全执行完。

time.sleep(s) # run code mc = RobotArmController('com13') mc.init_p() time.sleep(3) mc.increment_x_and_send() time.sleep(1) mc.increment_y_send() time.sleep(1) mc.increment_x_and_send() time.sleep(1) mc.increment_y_send()

进阶使用
我打算用吸泵来抓取一些东西,之后想做一个视觉的场景结合起来。mechArm有40个IO接口可以外接一些设备使用,比如说吸泵,夹爪等等工具。

wKgaomW56cOAY-tYAALQPy4lg9Y506.png

给末端装上吸泵然后就可以开始实践了。我得找到调用吸泵的方法,pymycobot里面的API太多了,我直接让ChatGPT来帮助我知道吸泵。

me: How to call the suction pump? ChatGPT: Control Commands: Activate the Suction Pump: To turn on the suction pump, you might send a command to set a specific IO port to HIGH. The exact command will depend on how the suction pump is connected to the controller. python mc.set_basic_output(1,0) # Example: Setting pin 1 to HIGH (0) Deactivate the Suction Pump: To turn off the suction pump, you would send a command to set the IO port to LOW. python Copy code mc.set_basic_output(1, 1) # Example: Setting pin 1 to LOW (1) Integrate with Movement Commands: You would typically integrate these commands into a sequence where the robotic arm moves to a target location, activates the suction pump to pick up an object, moves to a new location, and then deactivates the pump to release the object.

wKgZomW56gaAKVXmAAMPBy177k0112.png

现在我们来创建函数来控制吸泵的开关。

def pump_on(self): self.mc.set_basic_output(5,0) def pump_off(self): self.mc.set_basic_output(5,1) mc.initial_position() time.sleep(2) mc.pick_up_postion() time.sleep(2) mc.pump_on() time.sleep(1) mc.increment_z_send() time.sleep(3) mc.pump_off()

wKgaomW56iOAeCTWABP46DB-9c0679.png

本次先记录到这里,之后我打算结合摄像头做一些定位抓取的功能。

总结
随着人工智能的不断发展,它影响的不单单是科技方面,还影响着我们生活中的点点滴滴。它很大程度上提升了我们的学习效率,就拿我来说,如果我要了解一个新事物肯定得把相关文档全部通读一遍,甚至也不一定能理解到位,有了ChatGPT等许多人工智能的工具,学习的方式再也不像之前那样了,是全新的一种风格。及时是一无所知的机械臂,也能再很快的上手使用。

审核编辑 黄宇

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 机器人
    +关注

    关注

    206

    文章

    27052

    浏览量

    201435
  • 人工智能
    +关注

    关注

    1776

    文章

    43899

    浏览量

    230645
  • python
    +关注

    关注

    51

    文章

    4678

    浏览量

    83476
  • 机械臂
    +关注

    关注

    9

    文章

    475

    浏览量

    23827
收藏 人收藏

    评论

    相关推荐

    协作机器人(TB6-R5)各 ±90° 翻转运动测试 | 泰科机器人 #协作机器人

    测试机器人
    深圳市泰科智能机器人有限公司
    发布于 :2024年03月12日 08:48:56

    【先楫HPM5361EVK开发板试用体验】(原创)5.手把手实战AI机械

    HPM5361EVK开发板。现在开始设计实战AI机械的程序。 代码结构 由于编写一个完整的用先楫HPM5361EVK开发板控制三组四自由度机械,并加入红外线传感器、
    发表于 02-06 10:28

    并联机器人 蜘蛛手分拣机械

    机械码垛机器人
    jf_31042997
    发布于 :2024年02月03日 15:03:31

    【国产FPGA+OMAPL138开发板体验】(原创)2.手把手玩转游戏机械

    ChatGPT来增强其交互能力。 5.1 ChatGPT集成 AI算法实现 为了使机械具有AI功能,我会使用机器
    发表于 02-01 20:18

    大象机器人六轴协作机械臂myCobot 320 进行手势识别!

    引言 我是一名专注于机器学习机器人技术自由者。我的热情始于大学期间的人工智能课程,这促使我探索人机交互的新方法。尤其对于机械臂的操作,我一直想要简化其复杂性,使之更加直观和易于使用。
    的头像 发表于 01-31 16:17 207次阅读
    <b class='flag-5'>大象</b><b class='flag-5'>机器人</b>六轴<b class='flag-5'>协作</b><b class='flag-5'>机械</b>臂myCobot 320 进行手势识别!

    协作机器人和工业机器人区别在哪?

    协作机器人和工业机器人区别在哪? 协作机器人和工业机器人是现代工业自动化发展中两个重要的概念。虽
    的头像 发表于 01-26 14:56 1039次阅读

    自动化革命:大象机器人的Mercury A1机械

    引言 大象机器人的Mercury系列,是面向工业自动化和智能制造的新型机械臂产品线。这些机械臂不仅在设计上创新,还在材料选择上使用了碳纤维、铝合金和工程塑料等轻质强韧材料,搭载高精度谐
    的头像 发表于 01-15 14:41 292次阅读
    自动化革命:<b class='flag-5'>大象</b><b class='flag-5'>机器人</b>的Mercury A1<b class='flag-5'>机械</b>臂

    13个精选创意应用案例!协作机器人与智慧生活的融合!

    2023年,大象机器人协作机器人产品年出货量超1万台,销往海内外50+国家,获国内外超500+所高校、企业的认可和应用。
    的头像 发表于 01-10 14:23 1352次阅读
    13个精选创意应用案例!<b class='flag-5'>协作</b><b class='flag-5'>机器人</b>与智慧生活的融合!

    宏集新品 | 宏集Franka系列FP3协作机器人,如人类手臂般灵活! #协作机器人 #机械

    机械协作机器人
    虹科工业物联网技术
    发布于 :2024年01月04日 15:32:40

    大象机器人首发万元级水星Mercury人形机器人系列

    水星Mercury机器人系列共有三款产品:水星Mercury A1 七轴协作机械臂和水星Mercury B1半人形双臂机器人以及 水星Mercury X1通用轮式人形
    发表于 01-03 09:59 140次阅读
    ​<b class='flag-5'>大象</b><b class='flag-5'>机器人</b>首发万元级水星Mercury人形<b class='flag-5'>机器人</b>系列

    LabVIEW的工业机器人运动控制系统

    LabVIEW开发工业机器人运动控制系统 本项目开发了一个高效的工业机器人控制系统,重点关注于运动学算法和轨迹规划算法的实现和测试。LabVIEW作为一个关键技术,在项目中扮演了核
    发表于 12-21 20:03

    机械干粉砂浆堆垛机 工业拆垛机器人

    机器人机械自动化
    asdfghj888
    发布于 :2023年12月09日 11:47:48

    EPR6-S工业机器人通过EtherCAT转profinet网关接入西门子系统

    EPR6-S工业机器人专用伺服驱动器通过EtherCAT转profinet网关与西门子PLC1200连接 本案例EtherCAT转profinet(Profinet转EtherCAT)网关
    发表于 10-24 14:04

    双臂协作机器人-泰科智能 #双臂协作机器人 #双臂7协作机器人 #双臂多机器人 #七协作机器人

    机器人
    深圳市泰科智能机器人有限公司
    发布于 :2023年05月19日 09:06:17