Coordinate control

It is mainly used to realize intelligent route planning and let the mechanical arm move from one position to another. It is divided into [x, y, z], where [x, y, z] represents the position of the head of the mechanical arm in space (the coordinate system is rectangular coordinate system), The implementation of the algorithm requires some academic knowledge, and it will not be explained too much here. We can use this function as long as we understand the rectangular coordinate system.

Note: When setting coordinates, the joint structures of different series of manipulators are different. For the same set of coordinates, different series of manipulators will show different attitudes.

1 Single parameter coordinates

1.1 set_coord(id,coord,speed)

  • Function: Send a single coordinate value to the mechanical arm for movement
  • Parameter description:
    • id:Represents the coordinates of the mechanical arm. The three axes have three coordinates and have a specific representation method. Representation of X coordinate: X 'or' x
    • coord: Enter the coordinate value you want to reach x : -260-300mm y :-300-300mm z : -130-135mm
    • speed: It represents the speed of the mechanical arm movement, and the range is 0-100 (unit: mm/s).
  • Return value: None

2 Multi parameter coordinates

2.1 get_coords_info()

  • Function: Get the current coordinates of the mechanical arm.
  • Return value: List containing coordinates list
    • Triaxial:The length is 3, which is in turn [x, y, z]

2.2 set_coords(coords, speed)

  • Function: Send the overall coordinates so that the head of the mechanical arm moves from the original point to the point you specify.
  • Parameter description:
    • coords:
      • Triaxial:The coordinate value of [x, y, z], with a length of 3 x : -260-300mm y :-300-300mm z : -130-135mm
    • speed: It represents the speed of the mechanical arm movement, and the range is 0-100 (unit: mm/s).
  • Return value: None

3 Case

from pymycobot.ultraArm import ultraArm
import time

#The above should be written at the beginning of the code, meaning to import the project package

# ultraArm class initialization requires two parameters: serial port and baud rate
#   The first is the serial port string, such as:
#       linux: "/dev/ttyUSB0"
#       windows: "COM3"
#   The second is the baud rate:115200
#   For example:
#           linux:
#              ua = ultraArm("/dev/USB0", 115200)
#           windows:
#              ua = ultraArm("COM3", 115200)
#
# Initialize an ultraArm object
# Create object code for Windows version
ua = ultraArm("COM3", 115200)

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

# Get the coordinates and posture of the current head
coords = ua.get_coords_info()
time.sleep(2)
print(coords)

# # Let the mechanical arm reach the coordinates [205, 0, -40], and the speed is 80 mm/s
ua.set_coords([205, 0, -40], 80)

# Set the waiting time of 2 seconds
time.sleep(2)

# Let the mechanical arm reach the coordinates [180, -50, -40], and the speed is 80mm/s
ua.set_coords([180, -50, -40], 80)

# Set the waiting time of 2 seconds
time.sleep(2)

# Only change the x-coordinate of the head, set the x-coordinate of the head to 190, and the speed to 70 mm/s
ua.set_coord(X, 190, 70)

results matching ""

    No results matching ""