Python stacking and transportation

1 Environment construction

1.1 Install Python

1.2 Install myBlockly

2 Getting Started

2.1 How to read the angle and coordinate of the mechanical arm

  • Double click to open the software

  • Open the tool panel

  • Select the corresponding machine type and serial port number, and open the serial port

  • Zero the mechanical arm

  • After returning to zero, control the mechanical arm to move by moving the panel quickly

  • Control the mechanical arm to reach the required position, and record the angle/ coordinate parameters at this time

  • Fill the recorded angle/coordinate parameters into the api and input the speed parameters

2.2 Example

  • The following is a simple example of palletizing and moving. The wood block used is 40 X 40. You can copy the code to use or modify it

from pymycobot.ultraArm import ultraArm

# Coordinate position of the wood block to be moved
green_pos = [[74.6, 167.55, 120], [74.6, 167.55, 92.45], [74.6, 167.55, 52.45], [74.6, 167.55, 12.45]]
red_pos = [[112.67, 173.5, 120], [112.67, 173.5, 92.45], [112.67, 173.5, 52.45], [112.67, 173.5, 12.45]]
yellow_pos = [[150.92, 167.61, 120], [150.92, 167.61, 92.45], [150.92, 167.61, 52.45], [150.92, 167.61, 12.45]]

# Coordinate position of wood block
cube_pos_g = [[200, -75, 120], [200, -75, 15], [200, -75, 55], [200, -75, 95]]
cube_pos_r = [[150.63, -75, 15], [150.63, -75, 55], [150.63, -75, 95]]
cube_pos_y = [[109.63, -75, 15], [109.63, -75, 55], [109.63, -75, 95]]

# The direction of the wood block to be moved
block_high = [60, 5, 0]

# The direction of the wood block
cube_high = [-30, 10, 10]


# Connecting serial ports
ua = ultraArm('COM16','115200')

# ultraArm must return to zero before performing coordinate movement and angle movement, otherwise it cannot obtain correct angle/coordinates
ua.go_zero()
ua.sleep(0.5)


# Yellow
# Handling the first wood block
# Move to the direction of the wood block
ua.set_angles(block_high, 50)
ua.sleep(0.5)

ua.set_coords(yellow_pos[0], 50)
ua.sleep(1)

# Reach the location of the wood block
ua.set_coords(yellow_pos[1], 50)
ua.sleep(1)
# Open suction pump
ua.set_gpio_state(0)
ua.sleep(0.5)

# Move to the position you need to reach
ua.set_angles(cube_high, 50)
ua.sleep(0.5)

# Descend to the required position
ua.set_coords(cube_pos_y[0], 50)
ua.sleep(0.5)
# Close the suction pump
ua.set_gpio_state(1)
ua.sleep(0.5)

# Move to the upper part of the wood block, and the first move is completed. The subsequent move is the same as this move
ua.set_angles(cube_high, 50)
ua.sleep(0.5)

#2
ua.set_angles(block_high, 50)
ua.sleep(0.5)

ua.set_coords(yellow_pos[0], 50)
ua.sleep(1)

ua.set_coords(yellow_pos[2], 50)
ua.sleep(1)
ua.set_gpio_state(0)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

ua.set_coords(cube_pos_y[1], 50)
ua.sleep(0.5)
ua.set_gpio_state(1)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

# Red
# 1
ua.set_angles(block_high, 50)
ua.sleep(0.5)

ua.set_coords(red_pos[0], 50)
ua.sleep(1)

ua.set_coords(red_pos[1], 50)
ua.sleep(1)
ua.set_gpio_state(0)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

ua.set_coords(cube_pos_r[0], 50)
ua.sleep(0.5)
ua.set_gpio_state(1)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

#2
ua.set_angles(block_high, 50)
ua.sleep(0.5)

ua.set_coords(red_pos[0], 50)
ua.sleep(1)

ua.set_coords(red_pos[2], 50)
ua.sleep(1)
ua.set_gpio_state(0)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

ua.set_coords(cube_pos_r[1], 50)
ua.sleep(0.5)
ua.set_gpio_state(1)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)


# Green
# 1
ua.set_angles(block_high, 50)
ua.sleep(0.5)

ua.set_coords(green_pos[0], 50)
ua.sleep(1)

ua.set_coords(green_pos[1], 50)
ua.sleep(1)
ua.set_gpio_state(0)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

ua.set_coords(cube_pos_g[0], 50)
ua.sleep(0.5)

ua.set_coords(cube_pos_g[1], 50)
ua.sleep(0.5)
ua.set_gpio_state(1)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

#2
ua.set_angles(block_high, 50)
ua.sleep(0.5)

ua.set_coords(green_pos[0], 50)
ua.sleep(1)

ua.set_coords(green_pos[2], 50)
ua.sleep(1)
ua.set_gpio_state(0)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

ua.set_coords(cube_pos_g[0], 50)
ua.sleep(0.5)

ua.set_coords(cube_pos_g[2], 50)
ua.sleep(0.5)
ua.set_gpio_state(1)
ua.sleep(0.5)

ua.set_angles(cube_high, 50)
ua.sleep(0.5)

2.3 Actual operation effect

There will be an action video here

results matching ""

    No results matching ""