2、The head of the robot arm intelligently plans the route

Knowledge preparation for API

send_coords([x,y,z,rx,ry,rz],speed,model)is used to control the movement of the head of the robot arm to a specified point in a specified manner.It is primarily used to enable intelligent planning of the head of the robot arm from one position to another.X,Y,Z represents the position of the head of the robot arm in space(The coordinate system is a right-angle coordinate system),rx,ry,rz represents the posture of the head of the robot arm at that point.(The coordinate system is Euler coordinates)。The implementation of the algorithm and the representation of Euler coordinates require a certain degree of academic knowledge, we won't make too much explanation here, we only need to understand the right angle coordinate system can we use this function well.

Introduction of API

1、send_coords([x,y,z,rx,ry,rz],speed,model)

Function:Intelligently plan the route to move the head of the robot arm from the original point to the specified point.

Parameter Description

[x,y,z,rx,ry,rz]:The parameters are combined into a spatial right-angle coordinate system with x, y, z. The bottom of the robot arm is as the origin, x-positive axis in front, y-positive axis on the right and z-axis on the top.[x,y,z]represented as the position of the head of the robot arm.[rx,ry,rz]indicate the posture of the head of the robot arm. You can adjust the posture of the head of the robot arm and then useget_coords()to get the posture in the position, In this way you don't need to know the Euler coordinate system can you also understand the function.

speed:Represents the speed of the robot arm. The range of values is 0 to 100, the higher the value, the faster the speed.

model:Values are limited to 0 and 1. 0 indicates that the path to the head of the robot arm is nonlinear, means the route is randomly planned, as long as the head of the robot arm moves to the specified point in a specified manner. 1 indicates the movement of the head of the robot arm is linear, means the intelligent planning route allows the head of the robot arm to move in a straight line to the specified point.

2、get_coords()

Function: Get the spatial coordinates of the head of the robot arm at this time and the current posture.

Return value:The returned type is a list collection of six float elements, the first three coordinates x,y,z representing the coordinates of the head of the robot arm, and the last three coordinates rx, ry, rz representing the posture of the head of the robot arm.

3、send_coord(id,coord,speed)

Function:Only one of the coordinates of the x, y, z axis in the head space coordinates of the robot arm is modified separately.

Parameter Description:

id:The type of data is genre.Coord, it represents the X, Y, Z axis of the head of the robot arm. For example:Coord.X.value

coord:The type of data is float, Represents modifying the coordinate value.

speed:Represents the speed of the robot arm. Value range 0~100, the higher the value, the faster it is.

Content of code

from pymycobot.mycobot import MyCobot
from pymycobot.genre import Coord
from pymycobot import PI_PORT, PI_BAUD  # When using the Raspberry Pi version of myCobot, you can refer to these two variables for MyCobot initialization
import time

# Initialize a mycobot object
mc = MyCobot(PI_PORT, PI_BAUD)
# Gets the angle and posture of the current head
coords = mc.get_coords()
print(coords)
# Intelligently plan your route, Let the head linearly arrive at the coordinate[59.9,-65.8,250.7], and keep[-50.99,83.14,-52.42]this position.
mc.send_coords([59.9, -65.8, 250.7, -50.99, 83.14, -52.42], 80, 1)
# Set the wait time
time.sleep(1.5)
# Intelligently plan your route, Let the head linearly arrive at the coordinate[59.9,-65.8,350.7], and keep[-50.99,83.14,-52.42]this position
mc.send_coords([59.9, -65.8, 350.7, -50.99, 83.14, -52.42], 80, 1)
# Set the wait time
time.sleep(1.5)
# Change only the x coordinates of the head,Set the x coordinate of the head to -40. Let it intelligently plan the route to move the head to the changed position
mc.send_coord(Coord.X.value, -40, 70)

Effects as shown

2

results matching ""

    No results matching ""