Esempio n. 1
0
    def __init__(self, player: str):
        self.player = player
        if self.player == "b":
            self.robot = Mirobot(portname='/dev/ttyUSB0', debug=False)
            self.chessPickupZ = 37
        else:  # self.player == "r"
            self.robot = Mirobot(portname='/dev/ttyUSB1', debug=False)
            self.chessPickupZ = 31

        self.mapTable = [[[0, 0, self.chessPickupZ] for i in range(1001)]
                         for j in range(1101)]
        self.CalculateMapTable()

        self.RobotInit()
Esempio n. 2
0
        datas.append(round(data.position[2] * 52.297, 2))
        datas.append(round(data.position[3] * 52.297, 2))
        datas.append(round(data.position[4] * 52.297, 2))
        datas.append(round(data.position[5] * 52.297, 2))

        # move when postion change
        if cmp(self.postion, datas) != 0:
            self.postion = datas
            print "change postion to:", self.postion
            self.m.go_to_axis(self.postion[0], self.postion[1],
                              self.postion[2], self.postion[3],
                              self.postion[4], self.postion[5], 2000)


if __name__ == '__main__':
    m = Mirobot(debug=True)
    m.connect('/dev/ttyUSB0')

    # set mirobot to init postion
    m.home_simultaneous()

    sleep(15)
    try:
        #mirobot control init
        mirobot_control_node(m)
    except rospy.ROSInterruptException:
        pass

    while True:
        rospy.spin()
        sleep(0.1)
Esempio n. 3
0
from mirobot import Mirobot

with Mirobot(portname='COM3', debug=True) as m:
    m.home_individual()

    m.go_to_zero()
from mirobot import Mirobot

with Mirobot() as m:
    m.home_simultaneous()
Esempio n. 5
0
#!/usr/bin/env python3
from mirobot import Mirobot

with Mirobot(portname='COM5', debug=False) as m:

    # Mirobot will by default wait for any command because we specified `wait=True` for the class above.
    m.home_simultaneous()

    # print our dataclass maintained by Mirobot. Shows the x,y,z,a,b,c coordinates.
    print(m.cartesian)

    # increment arm's position using a for-loop
    for count in range(5):
        mx = 180.00
        my = 0.00 + count * 5
        mz = 170 + count * 5

        print(f"************Count {count}************")

        # notice how we don't need any "wait" or "sleep" commands!
        # the following command will only return when the Mirobot returns 'Ok' and when Mirobot is 'Idle'
        m.go_to_cartesian_ptp(mx, my, mz)

        # print our cartesian coordinates again
        print(m.cartesian)
Esempio n. 6
0
Python is more powerful than javascript with the Mirbot, because we have access to more commands, can use multiple Mirobots simultaneously, and even access them from the command line without using the web app at all.

We always need to import the Mirobot module in Python before using it! 
We always need to create the Mirobot object in Python before using it!

Basics

# Setup in the web app

from mirobot import Mirobot 	# Import the module

m = Mirobot()					# Create the object to use

# Movement

m.forward(100)			# Move forward by 100 mm

m.back(100)

m.left(45)				# Turn left by 45 degrees

m.right(90)

# Pen Control

m.penup()					# Move the pen up

m.pendown()

# Sensors
Esempio n. 7
0
#!/usr/bin/env python3
from mirobot import Mirobot

# Default for `wait=` is `True`, but explicitly state it here to showcase this.
with Mirobot(wait=True, debug=True) as m:

    # Mirobot will by default wait for any command because we specified `wait=True` for the class above.
    m.home_simultaneous()

    # print our dataclass maintained by Mirobot. Shows the x,y,z,a,b,c coordinates.
    print(m.cartesian)

    # increment arm's position using a for-loop
    for count in range(5):
        mx = 180.00
        my = 0.00 + count * 5
        mz = 170 + count * 5

        print(f"************Count {count}************")

        # notice how we don't need any "wait" or "sleep" commands!
        # the following command will only return when the Mirobot returns 'Ok' and when Mirobot is 'Idle'
        m.go_to_cartesian_ptp(mx, my, mz)

        # print our cartesian coordinates again
        print(m.cartesian)
Esempio n. 8
0
'''
气泵控制
'''
from mirobot import Mirobot
import time
arm = Mirobot(portname='COM7', debug=False)
arm.home_simultaneous()

# 气泵开启
arm.pump_on()
# 等待5s
time.sleep(5)
# 气泵关闭
arm.pump_off()
Esempio n. 9
0
  sys.exit()
  mirobot.disconnect()

# choose the Mirobot to connect to
if len(sys.argv) > 1:
  host = sys.argv[1]
else:
  host = 'local.mirobot.io'

# connect to Mirobot - there are a few different ways of doing this

# Use the host we specified on the command line
#mirobot = Mirobot(host, debug=True)

# Create a Mirobot instance
mirobot = Mirobot(debug=True)
# Autoconnect to a Mirobot on our network (there can be only one)
mirobot.autoConnect()

# Get a menu so we can select which Mirobot to connect to
#mirobot.autoConnect(interactive=True)

# Specify the id of the Mirobot we want to connect to
#mirobot.autoConnect(id='Mirobot-abcd')

print("Mirobot version: %s" % mirobot.version)

# set up error handling
mirobot.errorNotify(on_error)

mirobot.forward(100)
Esempio n. 10
0
from time import sleep
from mirobot import Mirobot

m = Mirobot(debug=True)
m.connect('com3')

sleep(3)

m.home_simultaneous()

sleep(10)

m.disconnect()
Esempio n. 11
0
'''
机械臂回归机械零点与状态查询
'''
from mirobot import Mirobot
import time

print("实例化Mirobot机械臂实例")
arm = Mirobot(portname='COM7', debug=False)

# 机械臂Home 多轴并行
print("机械臂Homing开始")
arm.home_simultaneous(wait=True)
print("机械臂Homing结束")

# 状态更新与查询
print("更新机械臂状态")
arm.update_status()
print(f"更新后的状态对象: {arm.status}")
print(f"更新后的状态名称: {arm.status.state}")
Esempio n. 12
0
#!/usr/bin/env python

from mirobot import Mirobot
import sys

if len(sys.argv) > 1:
  host = sys.argv[1]
else:
  host = 'local.mirobot.io'

mirobot = Mirobot(host, debug=True)

mirobot.forward(100)
mirobot.back(100)
mirobot.penup()

mirobot.disconnect()
Esempio n. 13
0
class RobotController:
    def __init__(self, player: str):
        self.player = player
        if self.player == "b":
            self.robot = Mirobot(portname='/dev/ttyUSB0', debug=False)
            self.chessPickupZ = 37
        else:  # self.player == "r"
            self.robot = Mirobot(portname='/dev/ttyUSB1', debug=False)
            self.chessPickupZ = 31

        self.mapTable = [[[0, 0, self.chessPickupZ] for i in range(1001)]
                         for j in range(1101)]
        self.CalculateMapTable()

        self.RobotInit()

    # regression function
    # Y regression
    def RegressionY(self, A, B, index):
        [row1, col1] = A
        [row2, col2] = B
        [x1, y1, z1] = self.mapTable[row1][col1]
        [x2, y2, z2] = self.mapTable[row2][col2]

        distance = index - col1
        step = col2 - col1
        x = x1 + (x2 - x1) / step * distance
        y = y1 + (y2 - y1) / step * distance
        z = z1 + (z2 - z1) / step * distance
        P = [round(x, 2), round(y, 2), round(z, 2)]
        return P

    # X regression
    def RegressionX(self, A, B, index):
        [row1, col1] = A
        [row2, col2] = B
        [x1, y1, z1] = self.mapTable[row1][col1]
        [x2, y2, z2] = self.mapTable[row2][col2]

        distance = index - row1
        step = row2 - row1
        x = x1 + (x2 - x1) / step * distance
        y = y1 + (y2 - y1) / step * distance
        z = z1 + (z2 - z1) / step * distance
        P = [round(x, 2), round(y, 2), round(z, 2)]
        return P

    # calculating mapping table
    def CalculateMapTable(self):
        if self.player == "r":
            # red
            # line 1, x = 0, y = [0,2,4,6,8,10]
            self.mapTable[0][0] = [86.5, 99, 36.7]
            self.mapTable[0][200] = [124.6, 99, 36.7]
            self.mapTable[0][400] = [156.6, 101, 36.7]
            self.mapTable[0][600] = [193.1, 102.5, 36.2]
            self.mapTable[0][800] = [229.6, 102.5, 36.2]
            self.mapTable[0][1000] = [264.6, 102.5, 35.7]
            # line 2, x = 1, y = [0,2,4,6,8,10]
            self.mapTable[100][0] = [86.5, 84, 36.7]
            self.mapTable[100][200] = [124.6, 84, 36.7]
            self.mapTable[100][400] = [156.6, 84, 36.7]
            self.mapTable[100][600] = [193.1, 85.5, 36.2]
            self.mapTable[100][800] = [229.6, 85.5, 36.2]
            self.mapTable[100][1000] = [264.6, 85.5, 35.7]
            # line 3, x = 3, y = [0,2,4,6,8,10]
            self.mapTable[300][0] = [87.5, 47, 36.7]
            self.mapTable[300][200] = [122.6, 47, 36.7]
            self.mapTable[300][400] = [157.1, 48, 36.7]
            self.mapTable[300][600] = [194.6, 49.5, 36.2]
            self.mapTable[300][800] = [230.1, 49, 36.2]
            self.mapTable[300][1000] = [265.1, 49, 36.2]
            # line 4, x = 5, y = [0,2,4,6,8,10]
            self.mapTable[500][0] = [91.6, 9.5, 37.2]
            self.mapTable[500][200] = [126.6, 9.5, 37.2]
            self.mapTable[500][400] = [159.6, 13, 36.7]
            self.mapTable[500][600] = [193.6, 13.5, 36.2]
            self.mapTable[500][800] = [232.6, 15, 35.7]
            self.mapTable[500][1000] = [267.6, 15, 35.7]
            # line 5, x = 6, y = [0,2,4,6,8,10]
            self.mapTable[600][0] = [91.6, -8, 36.7]
            self.mapTable[600][200] = [126.6, -8, 36.7]
            self.mapTable[600][400] = [158.6, -6, 36.7]
            self.mapTable[600][600] = [194.6, -4, 36.7]
            self.mapTable[600][800] = [232.6, -3.5, 35.7]
            self.mapTable[600][1000] = [267.6, -3.5, 35.7]
            # line 6, x = 8, y = [0,2,4,6,8,10]
            self.mapTable[800][0] = [93.6, -43, 36.7]
            self.mapTable[800][200] = [128.6, -43, 36.7]
            self.mapTable[800][400] = [159.6, -42, 36.7]
            self.mapTable[800][600] = [196.6, -40, 35.7]
            self.mapTable[800][800] = [231.6, -39, 35.7]
            self.mapTable[800][1000] = [266.6, -39, 35.7]
            # line 7, x = 10, y = [0,2,4,6,8,10]
            self.mapTable[1000][0] = [90.6, -79, 36.7]
            self.mapTable[1000][200] = [125.6, -79, 36.7]
            self.mapTable[1000][400] = [162.6, -76.5, 36.2]
            self.mapTable[1000][600] = [197.6, -75, 35.7]
            self.mapTable[1000][800] = [234.1, -75.5, 35.2]
            self.mapTable[1000][1000] = [269.1, -75.5, 35.2]
            # line 8, x = 11, y = [0,2,4,6,8,10]
            self.mapTable[1100][0] = [90.1, -95.5, 36.2]
            self.mapTable[1100][200] = [125.1, -95.5, 36.2]
            self.mapTable[1100][400] = [162.6, -92.5, 36.2]
            self.mapTable[1100][600] = [197.6, -91.5, 35.7]
            self.mapTable[1100][800] = [234.1, -92, 35.2]
            self.mapTable[1100][1000] = [269.1, -92, 35.2]
        else:
            # black
            # line 1, x = 0, y = [0,2,4,6,8,10]
            self.mapTable[0][0] = [269.6, -98, 37.7]
            self.mapTable[0][200] = [234.6, -98, 37.7]
            self.mapTable[0][400] = [199.7, -98.5, 37.7]
            self.mapTable[0][600] = [163.2, -99, 37.7]
            self.mapTable[0][800] = [128.2, -100, 37.7]
            self.mapTable[0][1000] = [92.7, -101, 37.7]
            # line 2, x = 1, y = [0,2,4,6,8,10]
            self.mapTable[100][0] = [269.6, -81, 37.7]
            self.mapTable[100][200] = [234.6, -82, 37.7]
            self.mapTable[100][400] = [198.7, -82, 37.7]
            self.mapTable[100][600] = [162.2, -83, 37.7]
            self.mapTable[100][800] = [127.2, -84, 37.7]
            self.mapTable[100][1000] = [92.2, -85, 37.7]
            # line 3, x = 3, y = [0,2,4,6,8,10]
            self.mapTable[300][0] = [265.2, -45, 37.7]
            self.mapTable[300][200] = [230.7, -44.5, 37.7]
            self.mapTable[300][400] = [196.2, -44.5, 37.7]
            self.mapTable[300][600] = [159.2, -44.5, 38.7]
            self.mapTable[300][800] = [127.7, -47, 37.7]
            self.mapTable[300][1000] = [96.2, -47, 37.7]
            # line 4, x = 5, y = [0,2,4,6,8,10]
            self.mapTable[500][0] = [264.2, -9.5, 37.7]
            self.mapTable[500][200] = [231.2, -9.5, 37.7]
            self.mapTable[500][400] = [198.7, -9.5, 37.7]
            self.mapTable[500][600] = [162.7, -10, 37.7]
            self.mapTable[500][800] = [127.7, -10, 38.2]
            self.mapTable[500][1000] = [92.2, -10, 38.2]
            # line 5, x = 6, y = [0,2,4,6,8,10]
            self.mapTable[600][0] = [265.7, 10, 37.7]
            self.mapTable[600][200] = [230.7, 10, 37.7]
            self.mapTable[600][400] = [195.7, 10, 37.7]
            self.mapTable[600][600] = [159.7, 9, 37.7]
            self.mapTable[600][800] = [127.7, 9, 38.2]
            self.mapTable[600][1000] = [95.7, 9, 38.2]
            # line 6, x = 8, y = [0,2,4,6,8,10]
            self.mapTable[800][0] = [263.1, 45.5, 37.7]
            self.mapTable[800][200] = [230.6, 46, 37.7]
            self.mapTable[800][400] = [198.6, 46, 37.7]
            self.mapTable[800][600] = [163.6, 46, 37.7]
            self.mapTable[800][800] = [127.6, 47, 37.7]
            self.mapTable[800][1000] = [91.6, 47.5, 37.7]
            # line 7, x = 10, y = [0,2,4,6,8,10]
            self.mapTable[1000][0] = [267.1, 80.5, 37.7]
            self.mapTable[1000][200] = [231.1, 80.5, 37.7]
            self.mapTable[1000][400] = [195.1, 81, 37.7]
            self.mapTable[1000][600] = [159.6, 81, 37.7]
            self.mapTable[1000][800] = [124.6, 82.5, 37.7]
            self.mapTable[1000][1000] = [89.6, 83, 37.7]
            # line 8, x = 11, y = [0,2,4,6,8,10]
            self.mapTable[1100][0] = [266.1, 115.5, 37.7]
            self.mapTable[1100][200] = [230.1, 115.5, 37.7]
            self.mapTable[1100][400] = [195.6, 116, 37.7]
            self.mapTable[1100][600] = [160.1, 116, 37.7]
            self.mapTable[1100][800] = [123.1, 117, 37.7]
            self.mapTable[1100][1000] = [90.1, 118, 37.7]

        # row: 0 1 3 5 6 8 10
        for row in [0, 1, 3, 5, 6, 8, 10, 11]:
            for col in range(1000):
                row_A = row * 100
                col_A = 200 * (col // 200)
                row_B = row * 100
                col_B = 200 * (col // 200 + 1)
                self.mapTable[100 * row][col] = self.RegressionY(
                    A=[row_A, col_A], B=[row_B, col_B], index=col)
        # 0-1
        for row in range(0, 100):
            for col in range(1001):
                self.mapTable[row][col] = self.RegressionX(A=[0, col],
                                                           B=[100, col],
                                                           index=row)
        # 1-3
        for row in range(100, 300):
            for col in range(1001):
                self.mapTable[row][col] = self.RegressionX(A=[100, col],
                                                           B=[300, col],
                                                           index=row)
        # 3-5
        for row in range(300, 500):
            for col in range(1001):
                self.mapTable[row][col] = self.RegressionX(A=[300, col],
                                                           B=[500, col],
                                                           index=row)

        # 5-6
        for row in range(500, 600):
            for col in range(1001):
                self.mapTable[row][col] = self.RegressionX(A=[500, col],
                                                           B=[600, col],
                                                           index=row)
        # 6-8
        for row in range(600, 800):
            for col in range(1001):
                self.mapTable[row][col] = self.RegressionX(A=[600, col],
                                                           B=[800, col],
                                                           index=row)
        # 8-10
        for row in range(800, 1000):
            for col in range(1001):
                self.mapTable[row][col] = self.RegressionX(A=[800, col],
                                                           B=[1000, col],
                                                           index=row)
        # 10-11
        for row in range(1000, 1100):
            for col in range(1001):
                self.mapTable[row][col] = self.RegressionX(A=[1000, col],
                                                           B=[1100, col],
                                                           index=row)

    # convert coordinate
    def Convert2RobotCoordinate(self, ChessPos):
        # be careful of the margin +100
        robotCoordinate = (self.mapTable[ChessPos[0] + 100][ChessPos[1] +
                                                            100][0],
                           self.mapTable[ChessPos[0] + 100][ChessPos[1] +
                                                            100][1])
        return robotCoordinate

    # Chess at ChessAPos eat chess at ChessAPos
    def Eat(self, ChessAPos, ChessBPos):

        self.Drop(ChessBPos)
        self.Move(ChessAPos, ChessBPos)
        print("Chess eat operation complete")

    # Move chess at ChessAPos to ChessBPos
    def Move(self, ChessAPos, ChessBPos):
        # Pick up
        chessRealPosA = self.Convert2RobotCoordinate(ChessAPos)
        self.robot.set_wrist_pose(chessRealPosA[0], chessRealPosA[1],
                                  self.chessPickupZ + 10)
        self.robot.set_wrist_pose(chessRealPosA[0], chessRealPosA[1],
                                  self.chessPickupZ)
        self.robot.pump_on()
        self.robot.set_wrist_pose(chessRealPosA[0], chessRealPosA[1],
                                  self.chessPickupZ + 10)

        # Put down
        chessRealPosB = self.Convert2RobotCoordinate(ChessBPos)
        self.robot.set_wrist_pose(chessRealPosB[0], chessRealPosB[1],
                                  self.chessPickupZ + 10)
        self.robot.set_wrist_pose(chessRealPosB[0], chessRealPosB[1],
                                  self.chessPickupZ + 1)
        self.robot.pump_off()
        # Lift the robotic arm
        self.robot.set_wrist_pose(chessRealPosB[0], chessRealPosB[1],
                                  self.chessPickupZ + 15)
        # Go to standby position
        self.robot.go_to_zero()
        self.robot.set_joint_angle({1: 90.0}, wait=True)
        print("Chess move operation complete")

    # drop a chess
    def Drop(self, ChessAPos):
        # Pick up
        chessRealPosA = self.Convert2RobotCoordinate(ChessAPos)
        self.robot.set_wrist_pose(chessRealPosA[0], chessRealPosA[1],
                                  self.chessPickupZ + 20)
        self.robot.set_wrist_pose(chessRealPosA[0], chessRealPosA[1],
                                  self.chessPickupZ)
        self.robot.pump_on()

        # Lift the robotic arm
        self.robot.set_wrist_pose(chessRealPosA[0], chessRealPosA[1],
                                  self.chessPickupZ + 10)
        # Put down
        chessDropPos = (100, -180, 100)
        self.robot.set_wrist_pose(chessDropPos[0], chessDropPos[1],
                                  chessDropPos[2])
        self.robot.pump_off()
        print("Chess drop operation complete")

    # initialize
    def RobotInit(self):
        self.robot.home_simultaneous()
        self.robot.set_joint_angle({1: 90.0}, wait=True)
        print("Robot-Black initialization complete")
Esempio n. 14
0
'''
获取机械臂的状态
'''
from mirobot import Mirobot
import time
arm = Mirobot(portname='COM7', debug=False)

# 注:一定要配置为wait=False,非阻塞式等待
# 要不然会卡死
arm.home_simultaneous(wait=False)
# 等待15s
time.sleep(15)
# 打印机械臂当前的状态
print("获取机械臂的状态 ?")
print(arm.get_status())
Esempio n. 15
0
#!/usr/bin/env python3
from mirobot import Mirobot

# Default for `wait=` is `True`, but explicitly state it here to showcase this.
with Mirobot(wait=True) as m:

    # Mirobot will by default wait for any command because we specified `wait=True` for the class above.
    m.home_simultaneous()

    # print our dataclass maintained by Mirobot. Shows the x,y,z,a,b,c coordinates.
    print(m.cartesian)

    # increment arm's position using a for-loop
    for count in range(5):
        mx = 180.00
        my = 0.00 + count * 5
        mz = 170 + count * 5

        print(f"************Count {count}************")

        # notice how we don't need any "wait" or "sleep" commands!
        # the following command will only return when the Mirobot returns 'Ok' and when Mirobot is 'Idle'
        m.go_to_cartesian_ptp(mx, my, mz)

        # print our cartesian coordinates again
        print(m.cartesian)
Esempio n. 16
0
from time import sleep
from mirobot import Mirobot


m = Mirobot(debug=True)
m.connect('/dev/ttyUSB0')

sleep(3)

m.home_simultaneous()

sleep(10)

m.go_to_axis(0.03,20.53,-22,-0.08,2.04,-10,2000)

sleep(15)
m.home_simultaneous()
m.disconnect()
Esempio n. 17
0
'''
设置机械臂关节的角度, 单位°
'''
from mirobot import Mirobot
import time
arm = Mirobot(portname='COM7', debug=False)
arm.home_simultaneous()

# 设置单个关节的角度
print("测试设置单个关节的角度")
arm.set_joint_angle({1: 100.0}, wait=True)
print("动作执行完毕")
# 状态查询
print(f"状态查询: {arm.get_status()}")
# 停顿2s
time.sleep(2)

# 设置多个关节的角度
print("设置多个关节的角度")
target_angles = {1: 90.0, 2: 30.0, 3: -20.0, 4: 10.0, 5: 0.0, 6: 90.0}
arm.set_joint_angle(target_angles, wait=True)
print("动作执行完毕")
# 状态查询
print(f"状态查询: {arm.get_status()}")
# 停顿2s
time.sleep(2)
Esempio n. 18
0
'''
机械臂腕关节的位置控制, 点控 point to point
'''
from mirobot import Mirobot
import time
arm = Mirobot(portname='COM7', debug=True)
arm.home_simultaneous()

print("运动到目标点 A")
arm.set_wrist_pose(200, 20, 230)
print(f"当前末端在机械臂坐标系下的位姿 {arm.pose}")
time.sleep(1)

print("运动到目标点 B")
arm.set_wrist_pose(200, 20, 150)
print(f"当前末端在机械臂坐标系下的位姿 {arm.pose}")
time.sleep(1)

print("运动到目标点 C, 指定末端的姿态角")
arm.set_wrist_pose(150, -20, 230, roll=30.0, pitch=0, yaw=45.0)
print(f"当前末端在机械臂坐标系下的位姿 {arm.pose}")
Esempio n. 19
0
from mirobot import Mirobot
from time import sleep
api = Mirobot(portname='COM5', debug=False)

api.home_simultaneous()
sleep(1)

# above block
target_angles = {1: 49.0, 2: 9.5, 3: -3.0, 4: 0.0, 5: 0.0, 6: 0.0}
api.set_joint_angle(target_angles, wait=True)
# attach block
target_angles = {1: 49.0, 2: 54.5, 3: -3.0, 4: 0.0, 5: -51.0, 6: 0.0}
api.set_joint_angle(target_angles, wait=True)
# suction ON
api.pump_on()
# above block
target_angles = {1: 49.0, 2: 9.5, 3: -3.0, 4: 0.0, 5: 0.0, 6: 0.0}
api.set_joint_angle(target_angles, wait=True)
# back to zero pos
api.go_to_zero()
# over chuck
target_angles = {1: 0.0, 2: 35.0, 3: 0.0, 4: 0.0, 5: -40.0, 6: 0.0}
api.set_joint_angle(target_angles, wait=True)

# suction Blow
#api.pump_blow()
api.pump_off()

# back to zero pos ( fin )
api.go_to_zero()
#api.pump_off()
Esempio n. 20
0
#!/usr/bin/env python3
from mirobot import Mirobot

# Default for `wait=` is `True`, but explicitly state it here to showcase this.
with Mirobot(wait=True, debug=True, connection_type='bt') as m:

    # Mirobot will by default wait for any command because we specified `wait=True` for the class above.
    m.home_simultaneous()

    # print our dataclass maintained by Mirobot. Shows the x,y,z,a,b,c coordinates.
    print(m.cartesian)

    # increment arm's position using a for-loop
    for count in range(5):
        mx = 180.00
        my = 0.00 + count * 5
        mz = 170 + count * 5

        print(f"************Count {count}************")

        # notice how we don't need any "wait" or "sleep" commands!
        # the following command will only return when the Mirobot returns 'Ok' and when Mirobot is 'Idle'
        m.go_to_cartesian_ptp(mx, my, mz)

        # print our cartesian coordinates again
        print(m.cartesian)